diff --git a/composer.json b/composer.json index 36c3e2b..e652261 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,10 @@ "source": "https://github.com/pear/Image_Color" }, "type": "library", + "require" : { + "php": ">=5.6, < 8.0" + }, "require-dev": { - "phpunit/phpunit": "*" + "yoast/phpunit-polyfills": "^2.0" } } diff --git a/package.xml b/package.xml index 039c626..acb8939 100644 --- a/package.xml +++ b/package.xml @@ -39,7 +39,6 @@ Add to Packagist - diff --git a/tests/AllTests.php b/tests/AllTests.php deleted file mode 100644 index 80d8f27..0000000 --- a/tests/AllTests.php +++ /dev/null @@ -1,27 +0,0 @@ -addTestSuite('ColorTest'); - - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'AllTests::main') { - AllTests::main(); -} - -?> diff --git a/tests/ColorTest.php b/tests/ColorTest.php index 8f6b1df..b22b8f0 100644 --- a/tests/ColorTest.php +++ b/tests/ColorTest.php @@ -7,17 +7,23 @@ * @copyright 2005 */ -require_once 'PHPUnit/Framework/TestCase.php'; +// As we want to run on PHP < 7.1, +// we can't use return type declaration in fixtures. +// Therefore we use PHPUnitPolyFills snakecase fixtures set_up/tear_down +// instead of setUp/tearDown. +// See https://github.com/Yoast/PHPUnit-Polyfills?tab=readme-ov-file#option-1-yoastphpunitpolyfillstestcasestestcase +use Yoast\PHPUnitPolyfills\TestCases\TestCase; + require_once 'Image/Color.php'; -class ColorTest extends PHPUnit_Framework_TestCase { +class ColorTest extends Yoast\PHPUnitPolyfills\TestCases\TestCase { var $color; - function setUp() { + function set_up() { $this->color = new Image_Color(); } - function tearDown() { + function tear_down() { unset($this->color); } @@ -37,13 +43,13 @@ function testSetWebsafe() { function testGetGetRange_DefaultParam() { $this->color->setColors('#ffffff', '#000000'); $result = $this->color->getRange(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals(2, count($result)); } function testGetGetRange_Param5() { $this->color->setColors('#ffffff', '#000000'); $result = $this->color->getRange(5); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals(5, count($result)); }