From 1c03b4e1414032725787c8acb604a5e9f3256b2c Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 18 Mar 2025 05:59:54 +0000 Subject: [PATCH 1/6] Bump PHPUnit dependencies --- composer.json | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 5df6378..2eb52a7 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,14 @@ { "name": "zendtech/ibmitoolkit", "description": "PHP frontend to XMLSERVICE for IBM i development.", - "keywords": ["ibmitoolkit","ibmxmltoolkit","XMLSERVICE","IBM i","zend","as400"], + "keywords": [ + "ibmitoolkit", + "ibmxmltoolkit", + "XMLSERVICE", + "IBM i", + "zend", + "as400" + ], "license": "BSD-3-Clause", "authors": [ { @@ -16,35 +23,37 @@ } ], "require": { - "php": ">=5.3.3", - "ext-mbstring": "*", - "ext-pcre": "*", - "ext-pdo": "*", - "ext-simplexml": "*" + "php": ">=5.3.3", + "ext-mbstring": "*", + "ext-pcre": "*", + "ext-pdo": "*", + "ext-simplexml": "*" }, "suggest": { - "ext-ibm_db2": "For the Db2 transport", - "ext-odbc": "For the ODBC transport", - "ext-pdo_ibm": "For the PDO Db2 transport", - "ext-pdo_odbc": "For the PDO ODBC transport", - "ext-pcntl": "For the local transport", - "ext-ssh2": "For the SSH transport" + "ext-ibm_db2": "For the Db2 transport", + "ext-odbc": "For the ODBC transport", + "ext-pdo_ibm": "For the PDO Db2 transport", + "ext-pdo_odbc": "For the PDO ODBC transport", + "ext-pcntl": "For the local transport", + "ext-ssh2": "For the SSH transport" }, "autoload": { - "classmap": ["ToolkitApi/"], + "classmap": [ + "ToolkitApi/" + ], "psr-4": { - "ToolkitApi\\":"ToolkitApi" + "ToolkitApi\\": "ToolkitApi" } }, "autoload-dev": { "psr-4": { - "ToolkitApi\\":"ToolkitApi", - "ToolkitApiTest\\":"tests/ToolkitApiTest", + "ToolkitApi\\": "ToolkitApi", + "ToolkitApiTest\\": "tests/ToolkitApiTest", "ToolkitFunctionalTest\\": "tests/functional" } }, "require-dev": { - "phpunit/phpunit": "^8.2", + "phpunit/phpunit": "^10.0", "symfony/process": "^4.3" } } From 282821b63345b5aa95deba751d8f93de935de038 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 18 Mar 2025 05:59:54 +0000 Subject: [PATCH 2/6] Set return type of base TestCase methods From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type: - `setUpBeforeClass()` - `setUp()` - `assertPreConditions()` - `assertPostConditions()` - `tearDown()` - `tearDownAfterClass()` - `onNotSuccessfulTest()` [1]: https://phpunit.de/announcements/phpunit-8.html --- tests/ToolkitApiTest/ToolkitServiceParameterTest.php | 4 ++-- tests/ToolkitApiTest/ToolkitTest.php | 2 +- tests/functional/ToolkitTest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/ToolkitApiTest/ToolkitServiceParameterTest.php b/tests/ToolkitApiTest/ToolkitServiceParameterTest.php index 3c90e36..0b3ab1d 100644 --- a/tests/ToolkitApiTest/ToolkitServiceParameterTest.php +++ b/tests/ToolkitApiTest/ToolkitServiceParameterTest.php @@ -25,7 +25,7 @@ final class ProgramParameterTest extends TestCase protected $dim; protected $by; - public function setUp(): void + protected function setUp(): void { $this->size = 20; $this->type = sprintf('%dB', $this->size); @@ -168,7 +168,7 @@ final class BinParamTest extends TestCase */ protected $programParameter; - public function setUp(): void + protected function setUp(): void { $size = 20; $this->binParam = new BinParam('both', $size, 'UncodeSample', 'p1', 'test'); diff --git a/tests/ToolkitApiTest/ToolkitTest.php b/tests/ToolkitApiTest/ToolkitTest.php index 39fc998..a165bae 100644 --- a/tests/ToolkitApiTest/ToolkitTest.php +++ b/tests/ToolkitApiTest/ToolkitTest.php @@ -35,7 +35,7 @@ final class ToolkitTest extends TestCase */ protected $toolkit; - public function setUp(): void + protected function setUp(): void { $this->toolkit = new Toolkit('*LOCAL', '0', 'testPwd', 'http', false); } diff --git a/tests/functional/ToolkitTest.php b/tests/functional/ToolkitTest.php index d8e9152..835f035 100644 --- a/tests/functional/ToolkitTest.php +++ b/tests/functional/ToolkitTest.php @@ -21,7 +21,7 @@ final class ToolkitTest extends TestCase */ private $toolkitOptions; - public function setUp(): void + protected function setUp(): void { $config = getConfig(); From 90cb5000d4818497fd35fa6fdf37f8f840e41f17 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 18 Mar 2025 05:59:54 +0000 Subject: [PATCH 3/6] Ignore PHPUnit cache folder --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a2cc256..dd1b314 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ composer.phar phpunit.xml vendor/ tests/config/db.config.php -.phpunit.result.cache +/.phpunit.cache From 7a90ca9dc2e83ede31dbd2df619393a6f7b6fca5 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 18 Mar 2025 05:59:54 +0000 Subject: [PATCH 4/6] Add return types to test methods --- tests/ToolkitApiTest/HttpSuppTest.php | 4 +- tests/ToolkitApiTest/Int16ParamTest.php | 2 +- tests/ToolkitApiTest/Int8ParamTest.php | 2 +- .../ToolkitServiceParameterTest.php | 6 +-- tests/ToolkitApiTest/ToolkitTest.php | 54 +++++++++---------- tests/ToolkitApiTest/UInt16ParamTest.php | 2 +- tests/ToolkitApiTest/UInt8ParamTest.php | 2 +- tests/functional/ToolkitTest.php | 6 +-- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/tests/ToolkitApiTest/HttpSuppTest.php b/tests/ToolkitApiTest/HttpSuppTest.php index 89f1914..ed7785d 100644 --- a/tests/ToolkitApiTest/HttpSuppTest.php +++ b/tests/ToolkitApiTest/HttpSuppTest.php @@ -6,7 +6,7 @@ final class HttpSuppTest extends TestCase { - public function testCanSetIpc() + public function testCanSetIpc(): void { $ipc = 'test'; @@ -16,7 +16,7 @@ public function testCanSetIpc() $this->assertEquals($ipc, $httpsupp->getIpc()); } - public function testIsIpcSet() + public function testIsIpcSet(): void { $ipc = 'test'; diff --git a/tests/ToolkitApiTest/Int16ParamTest.php b/tests/ToolkitApiTest/Int16ParamTest.php index 63c11c5..bd083cc 100644 --- a/tests/ToolkitApiTest/Int16ParamTest.php +++ b/tests/ToolkitApiTest/Int16ParamTest.php @@ -11,7 +11,7 @@ */ final class Int16ParamTest extends TestCase { - public function testCanCreateInstance() + public function testCanCreateInstance(): void { $parameter = new Int16Param('both', 'test comment', 'testVar', 8); $this->assertTrue($parameter instanceof ProgramParameter); diff --git a/tests/ToolkitApiTest/Int8ParamTest.php b/tests/ToolkitApiTest/Int8ParamTest.php index e539a4d..ac98500 100644 --- a/tests/ToolkitApiTest/Int8ParamTest.php +++ b/tests/ToolkitApiTest/Int8ParamTest.php @@ -11,7 +11,7 @@ */ final class Int8ParamTest extends TestCase { - public function testCanCreateInstance() + public function testCanCreateInstance(): void { $parameter = new Int8Param('both', 'test comment', 'testVar', 8); $this->assertTrue($parameter instanceof ProgramParameter); diff --git a/tests/ToolkitApiTest/ToolkitServiceParameterTest.php b/tests/ToolkitApiTest/ToolkitServiceParameterTest.php index 0b3ab1d..a70b05e 100644 --- a/tests/ToolkitApiTest/ToolkitServiceParameterTest.php +++ b/tests/ToolkitApiTest/ToolkitServiceParameterTest.php @@ -48,7 +48,7 @@ protected function setUp(): void ); } - public function testCanGetParameterProperties() + public function testCanGetParameterProperties(): void { $data1 = $this->programParameter->getParamProperities(); $data2 = array( @@ -73,7 +73,7 @@ public function testCanGetParameterProperties() $this->assertEquals($data1, $data2); } - public function testGetParameterPropertiesFacadeMethodReturnsSameAsRealMethod() + public function testGetParameterPropertiesFacadeMethodReturnsSameAsRealMethod(): void { $data1 = $this->programParameter->getParamProperities(); $data2 = $this->programParameter->getParamProperties(); @@ -176,7 +176,7 @@ protected function setUp(): void $this->programParameter = new ProgramParameter($type, 'both', 'p1', 'test', 'off', 0, '', false); } - public function testCanConvertBinaryToString() + public function testCanConvertBinaryToString(): void { $hex = '74657374'; $data1 = $this->binParam->bin2str($hex); diff --git a/tests/ToolkitApiTest/ToolkitTest.php b/tests/ToolkitApiTest/ToolkitTest.php index a165bae..66326ba 100644 --- a/tests/ToolkitApiTest/ToolkitTest.php +++ b/tests/ToolkitApiTest/ToolkitTest.php @@ -40,126 +40,126 @@ protected function setUp(): void $this->toolkit = new Toolkit('*LOCAL', '0', 'testPwd', 'http', false); } - public function testCanAddSigned8ByteIntegerParameter() + public function testCanAddSigned8ByteIntegerParameter(): void { $parameter = $this->toolkit->AddParameterInt8('both', 'test comment', 'testVar', 8); $this->assertTrue($parameter instanceof Int8Param); } - public function testCanAddSigned16ByteIntegerParameter() + public function testCanAddSigned16ByteIntegerParameter(): void { $parameter = $this->toolkit->AddParameterInt16('both', 'test comment', 'testVar', 10); $this->assertTrue($parameter instanceof Int16Param); } - public function testCanAddSigned32ByteIntegerParameter() + public function testCanAddSigned32ByteIntegerParameter(): void { $parameter = $this->toolkit->AddParameterInt32('both', 'test comment', 'testVar', 100); $this->assertTrue($parameter instanceof Int32Param); } - public function testCanAddSigned64ByteIntegerParameter() + public function testCanAddSigned64ByteIntegerParameter(): void { $parameter = $this->toolkit->AddParameterInt64('both', 'test comment', 'testVar', 1000); $this->assertTrue($parameter instanceof Int64Param); } - public function testCanAddUnsigned8ByteIntegerParameter() + public function testCanAddUnsigned8ByteIntegerParameter(): void { $parameter = $this->toolkit->AddParameterUInt8('both', 'test comment', 'testVar', 8); $this->assertTrue($parameter instanceof UInt8Param); } - public function testCanAddUnsigned16ByteIntegerParameter() + public function testCanAddUnsigned16ByteIntegerParameter(): void { $parameter = $this->toolkit->AddParameterUInt16('both', 'test comment', 'testVar', 8); $this->assertTrue($parameter instanceof UInt16Param); } - public function testCanAddUnsigned32ByteIntegerParameter() + public function testCanAddUnsigned32ByteIntegerParameter(): void { $parameter = $this->toolkit->AddParameterUInt32('both', 'test comment', 'testVar', 8); $this->assertTrue($parameter instanceof UInt32Param); } - public function testCanAddUnsigned64ByteIntegerParameter() + public function testCanAddUnsigned64ByteIntegerParameter(): void { $parameter = $this->toolkit->AddParameterUInt64('both', 'test comment', 'testVar', 8); $this->assertTrue($parameter instanceof UInt64Param); } - public function testCanAddCharacterParameter() + public function testCanAddCharacterParameter(): void { $parameter = $this->toolkit->AddParameterChar('both', 10, 'CODE', 'CODE', 'code'); $this->assertTrue($parameter instanceof CharParam); } - public function testCanAddFloatParameter() + public function testCanAddFloatParameter(): void { $parameter = $this->toolkit->AddParameterFloat('both', 'test comment', 'varName', 'false'); $this->assertTrue($parameter instanceof FloatParam); } - public function testCanAddRealParameter() + public function testCanAddRealParameter(): void { $parameter = $this->toolkit->AddParameterReal('both', 'test comment', 'varName', 'testValue'); $this->assertTrue($parameter instanceof RealParam); } - public function testCanAddPackedDecimalParameter() + public function testCanAddPackedDecimalParameter(): void { $parameter = $this->toolkit->AddParameterPackDec('both', 7,4, 'INDEC1', 'var3', '001.0001'); $this->assertTrue($parameter instanceof PackedDecParam); } - public function testCanAddZonedParameter() + public function testCanAddZonedParameter(): void { $parameter = $this->toolkit->AddParameterZoned('both', 12, 2, 'Check amount', 'amount', '2000.25'); $this->assertTrue($parameter instanceof ZonedParam); } - public function testCanAddParameterHole() + public function testCanAddParameterHole(): void { $parameter = $this->toolkit->AddParameterHole(12, 'hole'); $this->assertTrue($parameter instanceof HoleParam); } - public function testCanAddBinaryParameter() + public function testCanAddBinaryParameter(): void { $parameter = $this->toolkit->AddParameterBin('both', 20, 'UncodeSample', 'p1', 'test'); $this->assertTrue($parameter instanceof BinParam); } - public function testCanAddParameterSize() + public function testCanAddParameterSize(): void { $size = $this->toolkit->AddParameterSize('test comment', 'varName', 3); $this->assertTrue($size instanceof SizeParam); } - public function testCanAddParameterSizePack() + public function testCanAddParameterSizePack(): void { $parameter = $this->toolkit->AddParameterSizePack('test comment', 'varName', 4); $this->assertTrue($parameter instanceof SizePackParam); } - public function testCanSetPersistent() + public function testCanSetPersistent(): void { $isPersistent = false; @@ -168,63 +168,63 @@ public function testCanSetPersistent() $this->assertEquals($isPersistent, $this->toolkit->getIsPersistent()); } - public function testCanReturnScriptAbsolutePath() + public function testCanReturnScriptAbsolutePath(): void { $path = Toolkit::classPath(); $this->assertEquals($path, $this->toolkit->classPath()); } - public function testCanGetPhpOperatingSystem() + public function testCanGetPhpOperatingSystem(): void { $os = php_uname('s'); $this->assertEquals($os, $this->toolkit->getPhpOperatingSystem()); } - public function testCanTellIfPhpIsRunningOnIbmI() + public function testCanTellIfPhpIsRunningOnIbmI(): void { $isRunningOnIbmI = (php_uname('s') === 'OS400'); $this->assertEquals($isRunningOnIbmI, $this->toolkit->isPhpRunningOnIbmI()); } - public function testDatabaseNameOrResourceIsNotBoolean() + public function testDatabaseNameOrResourceIsNotBoolean(): void { $resource = false; $this->expectException(Exception::class); new Toolkit($resource); } - public function testDatabaseNameOrResourceIsNotFloat() + public function testDatabaseNameOrResourceIsNotFloat(): void { $resource = 1.81; $this->expectException(Exception::class); new Toolkit($resource); } - public function testDatabaseNameOrResourceIsNotObject() + public function testDatabaseNameOrResourceIsNotObject(): void { $resource = new DataArea(); $this->expectException(Exception::class); new Toolkit($resource); } - public function testDatabaseNameOrResourceIsNotInteger() + public function testDatabaseNameOrResourceIsNotInteger(): void { $resource = 12; $this->expectException(Exception::class); new Toolkit($resource); } - public function testDatabaseNameOrResourceIsNotArray() + public function testDatabaseNameOrResourceIsNotArray(): void { $resource = array(1, 2, 3); $this->expectException(Exception::class); new Toolkit($resource); } - public function testDatabaseNameOrResourceIsNotNull() + public function testDatabaseNameOrResourceIsNotNull(): void { $resource = null; $this->expectException(Exception::class); diff --git a/tests/ToolkitApiTest/UInt16ParamTest.php b/tests/ToolkitApiTest/UInt16ParamTest.php index 24e5fce..dfedc1a 100644 --- a/tests/ToolkitApiTest/UInt16ParamTest.php +++ b/tests/ToolkitApiTest/UInt16ParamTest.php @@ -11,7 +11,7 @@ */ final class UInt16ParamTest extends TestCase { - public function testCanCreateInstance() + public function testCanCreateInstance(): void { $parameter = new UInt16Param('both', 'test comment', 'testVar', 8); $this->assertTrue($parameter instanceof ProgramParameter); diff --git a/tests/ToolkitApiTest/UInt8ParamTest.php b/tests/ToolkitApiTest/UInt8ParamTest.php index ee383e1..8621cbd 100644 --- a/tests/ToolkitApiTest/UInt8ParamTest.php +++ b/tests/ToolkitApiTest/UInt8ParamTest.php @@ -11,7 +11,7 @@ */ final class UInt8ParamTest extends TestCase { - public function testCanCreateInstance() + public function testCanCreateInstance(): void { $parameter = new UInt8Param('both', 'test comment', 'testVar', 8); $this->assertTrue($parameter instanceof ProgramParameter); diff --git a/tests/functional/ToolkitTest.php b/tests/functional/ToolkitTest.php index 835f035..3b95f33 100644 --- a/tests/functional/ToolkitTest.php +++ b/tests/functional/ToolkitTest.php @@ -32,7 +32,7 @@ protected function setUp(): void /** * @throws \Exception */ - public function testCanPassPdoOdbcObjectToToolkit() + public function testCanPassPdoOdbcObjectToToolkit(): void { $pdo = new \PDO( 'odbc:' . $this->connectionOptions['dsn'], @@ -55,7 +55,7 @@ public function testCanPassPdoOdbcObjectToToolkit() /** * @throws \Exception */ - public function testCanPassOdbcResourceToToolkit() + public function testCanPassOdbcResourceToToolkit(): void { $connection = odbc_connect($this->connectionOptions['dsn'], $this->connectionOptions['username'], $this->connectionOptions['password']); @@ -71,7 +71,7 @@ public function testCanPassOdbcResourceToToolkit() /** * @throws \Exception */ - public function testCanPassOdbcConnectionParametersToToolkit() + public function testCanPassOdbcConnectionParametersToToolkit(): void { $toolkit = new Toolkit( $this->connectionOptions['dsn'], From 9731f94e41d82aa2a9fe74dcba9a41fa8b34ce79 Mon Sep 17 00:00:00 2001 From: Wilfried JOnker Date: Tue, 18 Mar 2025 07:04:16 +0100 Subject: [PATCH 5/6] Reverted composer.json and .gitignore to commit 15fb93d --- .gitignore | 2 +- composer.json | 43 +++++++++++++++++-------------------------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index dd1b314..a2cc256 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ composer.phar phpunit.xml vendor/ tests/config/db.config.php -/.phpunit.cache +.phpunit.result.cache diff --git a/composer.json b/composer.json index 2eb52a7..5df6378 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,7 @@ { "name": "zendtech/ibmitoolkit", "description": "PHP frontend to XMLSERVICE for IBM i development.", - "keywords": [ - "ibmitoolkit", - "ibmxmltoolkit", - "XMLSERVICE", - "IBM i", - "zend", - "as400" - ], + "keywords": ["ibmitoolkit","ibmxmltoolkit","XMLSERVICE","IBM i","zend","as400"], "license": "BSD-3-Clause", "authors": [ { @@ -23,37 +16,35 @@ } ], "require": { - "php": ">=5.3.3", - "ext-mbstring": "*", - "ext-pcre": "*", - "ext-pdo": "*", - "ext-simplexml": "*" + "php": ">=5.3.3", + "ext-mbstring": "*", + "ext-pcre": "*", + "ext-pdo": "*", + "ext-simplexml": "*" }, "suggest": { - "ext-ibm_db2": "For the Db2 transport", - "ext-odbc": "For the ODBC transport", - "ext-pdo_ibm": "For the PDO Db2 transport", - "ext-pdo_odbc": "For the PDO ODBC transport", - "ext-pcntl": "For the local transport", - "ext-ssh2": "For the SSH transport" + "ext-ibm_db2": "For the Db2 transport", + "ext-odbc": "For the ODBC transport", + "ext-pdo_ibm": "For the PDO Db2 transport", + "ext-pdo_odbc": "For the PDO ODBC transport", + "ext-pcntl": "For the local transport", + "ext-ssh2": "For the SSH transport" }, "autoload": { - "classmap": [ - "ToolkitApi/" - ], + "classmap": ["ToolkitApi/"], "psr-4": { - "ToolkitApi\\": "ToolkitApi" + "ToolkitApi\\":"ToolkitApi" } }, "autoload-dev": { "psr-4": { - "ToolkitApi\\": "ToolkitApi", - "ToolkitApiTest\\": "tests/ToolkitApiTest", + "ToolkitApi\\":"ToolkitApi", + "ToolkitApiTest\\":"tests/ToolkitApiTest", "ToolkitFunctionalTest\\": "tests/functional" } }, "require-dev": { - "phpunit/phpunit": "^10.0", + "phpunit/phpunit": "^8.2", "symfony/process": "^4.3" } } From b769e623715bb4c09511196d195e85f9ad69a5e3 Mon Sep 17 00:00:00 2001 From: Wilfried JOnker Date: Tue, 18 Mar 2025 07:09:07 +0100 Subject: [PATCH 6/6] PHPUnit v11 --- composer.json | 2 +- ...ToolkitServiceParameterTest.php => ProgramParameterTest.php} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/ToolkitApiTest/{ToolkitServiceParameterTest.php => ProgramParameterTest.php} (100%) diff --git a/composer.json b/composer.json index 5df6378..0f9aca0 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ } }, "require-dev": { - "phpunit/phpunit": "^8.2", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.3" } } diff --git a/tests/ToolkitApiTest/ToolkitServiceParameterTest.php b/tests/ToolkitApiTest/ProgramParameterTest.php similarity index 100% rename from tests/ToolkitApiTest/ToolkitServiceParameterTest.php rename to tests/ToolkitApiTest/ProgramParameterTest.php