Skip to content

Commit b38f5a9

Browse files
committed
[CI] Fix test runner and update PHPUnit version
1 parent d566139 commit b38f5a9

18 files changed

+40
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ composer.lock
44
bin/composer.phar
55
!bin/php
66
!build/.gitkeep
7+
.phpunit.result.cache

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
ARG PHP_VERSION=7.1
1+
ARG PHP_VERSION=8.0
22

33
FROM php:${PHP_VERSION}-cli-alpine
44

5-
ARG XDEBUG_VERSION=2.7.0RC1
5+
ARG XDEBUG_VERSION=3.1.3
66

77
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
88
&& apk add --no-cache --virtual .runtime-deps git libzip-dev gmp-dev \
99
&& docker-php-ext-install zip gmp \
1010
&& pecl install xdebug-$XDEBUG_VERSION \
1111
&& docker-php-ext-enable xdebug \
1212
&& echo "xdebug.max_nesting_level=15000" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
13-
&& echo "xdebug.remote_enable=true" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
1413
&& echo "xdebug.remote_host=localhost" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
1514
&& echo "xdebug.idekey=PHPSTORM" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
1615
&& echo "xdebug.remote_handler=dbgp" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
17-
&& echo "xdebug.remote_autostart=1" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
18-
&& echo "xdebug.remote_connect_back=0" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
16+
&& echo "xdebug.mode=develop" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
1917
&& git clone --recursive --depth=1 https://github.com/kjdev/php-ext-snappy.git \
2018
&& cd php-ext-snappy \
2119
&& phpize \

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ MAKEFLAGS =+ -rR --warn-undefined-variables
44
.PHONY: composer-install composer-update examples docker run
55

66
COMPOSER ?= bin/composer.phar
7-
COMPOSER_VERSION ?= 1.8.3
7+
COMPOSER_VERSION ?= 2.2.7
88
PHP ?= bin/php
9-
PHP_VERSION ?= 7.2
10-
XDEBUG_VERSION ?= 2.7.0RC1
9+
PHP_VERSION ?= 8.0
10+
XDEBUG_VERSION ?= 3.1.3
1111

1212
export
1313

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"description": "Avro schema encoder/decoder. Fork of rg/avro-php",
44
"license": "Apache-2.0",
55
"require": {
6-
"php": ">=7.1"
6+
"php": ">=7.4|>=8.0"
77
},
88
"require-dev": {
9-
"phpunit/phpunit": "^5.0"
9+
"phpunit/phpunit": "~8.5"
1010
},
1111
"suggest": {
1212
"ext-gmp": "Large integer support for 32-bit platforms.",

lib/avro/schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ public function __construct($name, $doc, $symbols, &$schemata=null, $logical_typ
11701170
foreach ($symbols as $symbol)
11711171
if (!is_string($symbol) || empty($symbol))
11721172
throw new AvroSchemaParseException(
1173-
sprintf('Enum schema symbol must be a string %',
1173+
sprintf('Enum schema symbol must be a string %s',
11741174
print_r($symbol, true)));
11751175

11761176
parent::__construct(AvroSchema::ENUM_SCHEMA, $name, $doc, $schemata, $logical_type, $extra_attributes);

phpunit.xml.dist

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<phpunit
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/7.0/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
66
colors="true"
77
>
88

@@ -12,4 +12,10 @@
1212
</whitelist>
1313
</filter>
1414

15+
<testsuites>
16+
<testsuite name="unit">
17+
<directory>test</directory>
18+
</testsuite>
19+
</testsuites>
20+
1521
</phpunit>

test/AllTests.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* limitations under the License.
1818
*/
1919

20+
use PHPUnit\Framework\TestSuite;
21+
2022
require_once('DataFileTest.php');
2123
require_once('SchemaTest.php');
2224
require_once('NameTest.php');
@@ -35,11 +37,11 @@
3537
class AllTests
3638
{
3739
/**
38-
* @return PHPUnit_Framework_TestSuite
40+
* @return TestSuite
3941
*/
4042
public static function suite()
4143
{
42-
$suite = new PHPUnit_Framework_TestSuite('AvroAllTests');
44+
$suite = new TestSuite('AvroAllTests');
4345
$suite->addTestSuite('DataFileTest');
4446
$suite->addTestSuite('SchemaTest');
4547
$suite->addTestSuite('NameTest');

test/DataFileTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/**
2323
* Class DataFileTest
2424
*/
25-
class DataFileTest extends PHPUnit_Framework_TestCase
25+
class DataFileTest extends \PHPUnit\Framework\TestCase
2626
{
2727
private $data_files;
2828
const REMOVE_DATA_FILES = true;
@@ -62,14 +62,14 @@ protected function remove_data_files()
6262
$this->remove_data_file($data_file);
6363
}
6464

65-
protected function setUp()
65+
protected function setUp(): void
6666
{
6767
if (!file_exists(TEST_TEMP_DIR))
6868
mkdir(TEST_TEMP_DIR);
6969
$this->remove_data_files();
7070
}
7171

72-
protected function tearDown()
72+
protected function tearDown(): void
7373
{
7474
$this->remove_data_files();
7575
}

test/DatumIOTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/**
2323
* Class DatumIOTest
2424
*/
25-
class DatumIOTest extends PHPUnit_Framework_TestCase
25+
class DatumIOTest extends \PHPUnit\Framework\TestCase
2626
{
2727
/**
2828
* @dataProvider data_provider

test/FileIOTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
/**
2323
* Tests against a preexisting file created by a different library
2424
*/
25-
class FileIOTest extends PHPUnit_Framework_TestCase
25+
class FileIOTest extends \PHPUnit\Framework\TestCase
2626
{
27-
protected function tearDown()
27+
protected function tearDown(): void
2828
{
2929
$file = $this->getTmpFile();
3030
if (file_exists($file))

0 commit comments

Comments
 (0)