From 3887ee681bb076bc5d98d2d3e19f0ca1cf01cb9c Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 17:13:59 +0000 Subject: [PATCH 01/17] Install semantic-result-formats dev-master for MW 1.42 --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f5130b5..617d5c63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,6 @@ jobs: coverage: false experimental: false - mediawiki_version: '1.40' - smw_version: dev-master php_version: 8.1 al_version: 0.6.3 database_type: mysql @@ -35,6 +34,7 @@ jobs: experimental: false - mediawiki_version: '1.42' smw_version: dev-master + srf_version: dev-master php_version: 8.2 al_version: 0.6.3 database_type: mysql @@ -45,6 +45,7 @@ jobs: env: MW_VERSION: ${{ matrix.mediawiki_version }} SMW_VERSION: ${{ matrix.smw_version }} + SRF_VERSION: ${{ matrix.srf_version }} PHP_VERSION: ${{ matrix.php_version }} AL_VERSION: ${{ matrix.al_version }} DB_TYPE: ${{ matrix.database_type }} From ea21a40eb80dc752f6aefff20c9a08ae2897ef63 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 17:14:18 +0000 Subject: [PATCH 02/17] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 617d5c63..c4ac9b08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ jobs: coverage: false experimental: false - mediawiki_version: '1.40' + smw_version: dev-master php_version: 8.1 al_version: 0.6.3 database_type: mysql From 3ec9179e3df5efaf4054c7ae4cf21947157d3eae Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 17:21:49 +0000 Subject: [PATCH 03/17] Update phpunit.xml.dist --- phpunit.xml.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 807ea166..da404282 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,4 +1,3 @@ - Date: Wed, 18 Dec 2024 20:15:02 +0000 Subject: [PATCH 04/17] Update phpunit.xml.dist --- phpunit.xml.dist | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index da404282..88490c5d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,4 +1,6 @@ - Date: Wed, 18 Dec 2024 20:18:38 +0000 Subject: [PATCH 05/17] Update phpunit.xml.dist --- phpunit.xml.dist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 88490c5d..081ab742 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -17,9 +17,9 @@ tests/phpunit - - + + includes - - + + From 8e54d6db58afe16506e376d8b7b60ddcd7198841 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 20:25:37 +0000 Subject: [PATCH 06/17] Update phpunit.xml.dist --- phpunit.xml.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 081ab742..4d2c9468 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,6 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" backupStaticAttributes="false" - cacheTokens="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" From 171ceff04a1b6409292721a397de6efa9c3759ca Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 20:38:44 +0000 Subject: [PATCH 07/17] Update phpunit.xml.dist --- phpunit.xml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4d2c9468..ac847c2d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -10,6 +10,7 @@ stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" + stderr="true" verbose="true"> From 397ef72faba3043e19171adbd8b1bf5a3ca45280 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 20:40:02 +0000 Subject: [PATCH 08/17] Update phpunit.xml.dist --- phpunit.xml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ac847c2d..0dd767f8 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,3 +1,4 @@ + Date: Wed, 18 Dec 2024 20:45:28 +0000 Subject: [PATCH 09/17] Update composer.json --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b6521601..d6b01233 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,7 @@ "mediawiki/minus-x": "1.1.3", "php-parallel-lint/php-console-highlighter": "1.0.0", "php-parallel-lint/php-parallel-lint": "1.4.0", - "phpstan/phpstan": "^1.7", - "vimeo/psalm": "^4.23" + "phpstan/phpstan": "^1.7" }, "scripts": { "test": [ From f022eb82a0bb81af2c1597e6fd52ab7cab3c8d74 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 20:53:20 +0000 Subject: [PATCH 10/17] Update composer.json --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d6b01233..eb01059e 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "mediawiki/minus-x": "1.1.3", "php-parallel-lint/php-console-highlighter": "1.0.0", "php-parallel-lint/php-parallel-lint": "1.4.0", - "phpstan/phpstan": "^1.7" + "phpstan/phpstan": "^1.7", + "vimeo/psalm": "^5.26" }, "scripts": { "test": [ From 25cddec0e9f64287d3176a8bdcc738a210cd1af6 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 21:03:39 +0000 Subject: [PATCH 11/17] Update JsonTestCaseScriptRunnerTest.php --- .../Integration/JSONScript/JsonTestCaseScriptRunnerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/phpunit/Integration/JSONScript/JsonTestCaseScriptRunnerTest.php b/tests/phpunit/Integration/JSONScript/JsonTestCaseScriptRunnerTest.php index 079bf4ae..1d838607 100644 --- a/tests/phpunit/Integration/JSONScript/JsonTestCaseScriptRunnerTest.php +++ b/tests/phpunit/Integration/JSONScript/JsonTestCaseScriptRunnerTest.php @@ -9,6 +9,7 @@ /** * @group SD * @group SMWExtension + * @group Database */ class JsonTestCaseScriptRunnerTest extends JSONScriptTestCaseRunnerTest { From 1de5796adb3237c4779e8968e168d654a128adb8 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 21:10:03 +0000 Subject: [PATCH 12/17] Update TemporaryTableManager.php --- includes/TemporaryTableManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/TemporaryTableManager.php b/includes/TemporaryTableManager.php index b324324b..72595596 100644 --- a/includes/TemporaryTableManager.php +++ b/includes/TemporaryTableManager.php @@ -2,19 +2,19 @@ namespace SD; -use DatabaseBase; +use Wikimedia\Rdbms\Database; /** * Provides helper method to execute SQL queries in auto-commit mode */ class TemporaryTableManager { - /** @var \Wikimedia\Rdbms\IDatabase|DatabaseBase */ + /** @var \Wikimedia\Rdbms\IDatabase|Database */ private $databaseConnection; /** * TemporaryTableManager constructor. - * @param \Wikimedia\Rdbms\IDatabase|DatabaseBase $databaseConnection the DB connection to execute queries against + * @param \Wikimedia\Rdbms\IDatabase|Database $databaseConnection the DB connection to execute queries against */ public function __construct( $databaseConnection ) { $this->databaseConnection = $databaseConnection; From d470b652a2569da61dedf212d66c053db4ea549a Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 21:15:43 +0000 Subject: [PATCH 13/17] Update TemporaryTableManagerTest.php --- .../Unit/TemporaryTableManagerTest.php | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/phpunit/Unit/TemporaryTableManagerTest.php b/tests/phpunit/Unit/TemporaryTableManagerTest.php index 30bf73d8..59bbff42 100644 --- a/tests/phpunit/Unit/TemporaryTableManagerTest.php +++ b/tests/phpunit/Unit/TemporaryTableManagerTest.php @@ -2,17 +2,15 @@ namespace SD\Tests\Unit; -use DatabaseBase; -use PHPUnit; use SD\TemporaryTableManager; -use Wikimedia; -use const DBO_TRX; +use Wikimedia\Rdbms\Database; +use Wikimedia\Rdbms\IDatabase ; /** * @covers \SD\TemporaryTableManager */ -class TemporaryTableManagerTest extends PHPUnit\Framework\TestCase { - /** @var DatabaseBase|\Wikimedia\Rdbms\IDatabase */ +class TemporaryTableManagerTest extends \PHPUnit\Framework\TestCase { + /** @var Database|IDatabase */ private $databaseConnectionMock; /** @var TemporaryTableManager */ @@ -22,8 +20,7 @@ protected function setUp(): void { parent::setUp(); // Database::commit is final, cannot be mocked - we must use interface :/ - $dbClassName = class_exists( DatabaseType::class ) ? DatabaseType::class : Wikimedia\Rdbms\IDatabase::class; - $this->databaseConnectionMock = $this->getMockBuilder( $dbClassName ) + $this->databaseConnectionMock = $this->getMockBuilder( IDatabase::class ) ->disableOriginalConstructor() ->getMock(); @@ -37,7 +34,7 @@ protected function setUp(): void { public function testTransactionStateAndFlagsAreNotManipulatedWhenDboTrxIsNotSet( $sqlQuery ) { $this->databaseConnectionMock->expects( $this->any() ) ->method( 'getFlag' ) - ->with( DBO_TRX ) + ->with( IDatabase::DBO_TRX ) ->willReturn( false ); $this->databaseConnectionMock->expects( $this->once() ) @@ -61,7 +58,7 @@ public function testDboTrxFlagIsPreservedButCommitIsNotCalledIfDboTrxIsSetWithNo ) { $this->databaseConnectionMock->expects( $this->any() ) ->method( 'getFlag' ) - ->with( DBO_TRX ) + ->with( IDatabase::DBO_TRX ) ->willReturn( true ); $this->databaseConnectionMock->expects( $this->any() ) ->method( 'trxLevel' ) @@ -75,7 +72,7 @@ public function testDboTrxFlagIsPreservedButCommitIsNotCalledIfDboTrxIsSetWithNo ->method( 'startAtomic' ); $this->databaseConnectionMock->expects( $this->once() ) ->method( 'setFlag' ) - ->with( DBO_TRX ); + ->with( IDatabase::DBO_TRX ); $this->temporaryTableManager->queryWithAutoCommit( $sqlQuery ); } @@ -89,7 +86,7 @@ public function testDboTrxFlagIsPreservedAndCommitIsCalledIfDboTrxIsSetWithOpenT ) { $this->databaseConnectionMock->expects( $this->any() ) ->method( 'getFlag' ) - ->with( DBO_TRX ) + ->with( IDatabase::DBO_TRX ) ->willReturn( true ); $this->databaseConnectionMock->expects( $this->any() ) ->method( 'trxLevel' ) @@ -103,7 +100,7 @@ public function testDboTrxFlagIsPreservedAndCommitIsCalledIfDboTrxIsSetWithOpenT ->method( 'startAtomic' ); $this->databaseConnectionMock->expects( $this->once() ) ->method( 'setFlag' ) - ->with( DBO_TRX ); + ->with( IDatabase::DBO_TRX ); $this->temporaryTableManager->queryWithAutoCommit( $sqlQuery ); } From edaa83ec03d7ce8abe1624cca712473291dc5ce7 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 21:18:13 +0000 Subject: [PATCH 14/17] Update TemporaryTableManagerTest.php --- tests/phpunit/Unit/TemporaryTableManagerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/Unit/TemporaryTableManagerTest.php b/tests/phpunit/Unit/TemporaryTableManagerTest.php index 59bbff42..7638182f 100644 --- a/tests/phpunit/Unit/TemporaryTableManagerTest.php +++ b/tests/phpunit/Unit/TemporaryTableManagerTest.php @@ -4,7 +4,7 @@ use SD\TemporaryTableManager; use Wikimedia\Rdbms\Database; -use Wikimedia\Rdbms\IDatabase ; +use Wikimedia\Rdbms\IDatabase; /** * @covers \SD\TemporaryTableManager From 67322743a5c3b5a138e4dbd8bc22ee9c25303026 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 23:04:41 +0000 Subject: [PATCH 15/17] Update ci.yml --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4ac9b08..df61cd55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,15 @@ jobs: database_image: "mariadb:11.2" coverage: true experimental: false + - mediawiki_version: '1.41' + smw_version: dev-master + srf_version: dev-master + php_version: 8.2 + al_version: 0.6.3 + database_type: mysql + database_image: "mariadb:11.2" + coverage: false + experimental: true - mediawiki_version: '1.42' smw_version: dev-master srf_version: dev-master From 512c408e88b8f9f72283453da62a65906626fe57 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 18 Dec 2024 23:07:36 +0000 Subject: [PATCH 16/17] Update ci.yml --- .github/workflows/ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df61cd55..c4ac9b08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,15 +33,6 @@ jobs: database_image: "mariadb:11.2" coverage: true experimental: false - - mediawiki_version: '1.41' - smw_version: dev-master - srf_version: dev-master - php_version: 8.2 - al_version: 0.6.3 - database_type: mysql - database_image: "mariadb:11.2" - coverage: false - experimental: true - mediawiki_version: '1.42' smw_version: dev-master srf_version: dev-master From 037eacfd2c973f4413adbf005f1b772bf2798544 Mon Sep 17 00:00:00 2001 From: paladox Date: Thu, 19 Dec 2024 11:08:12 +0000 Subject: [PATCH 17/17] Update TemporaryTableManager.php --- includes/TemporaryTableManager.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/TemporaryTableManager.php b/includes/TemporaryTableManager.php index 72595596..84a7b2eb 100644 --- a/includes/TemporaryTableManager.php +++ b/includes/TemporaryTableManager.php @@ -3,6 +3,7 @@ namespace SD; use Wikimedia\Rdbms\Database; +use Wikimedia\Rdbms\IDatabase; /** * Provides helper method to execute SQL queries in auto-commit mode @@ -28,8 +29,8 @@ public function __construct( $databaseConnection ) { * @param string $method method name to log for query, defaults to this method */ public function queryWithAutoCommit( $sqlQuery, $method = __METHOD__ ) { - $wasAutoTrx = $this->databaseConnection->getFlag( DBO_TRX ); - $this->databaseConnection->clearFlag( DBO_TRX ); + $wasAutoTrx = $this->databaseConnection->getFlag( IDatabase::DBO_TRX ); + $this->databaseConnection->clearFlag( IDatabase::DBO_TRX ); // If a transaction was automatically started on first query, make sure we commit it if ( $wasAutoTrx && $this->databaseConnection->trxLevel() ) { @@ -43,7 +44,7 @@ public function queryWithAutoCommit( $sqlQuery, $method = __METHOD__ ) { } if ( $wasAutoTrx ) { - $this->databaseConnection->setFlag( DBO_TRX ); + $this->databaseConnection->setFlag( IDatabase::DBO_TRX ); } } }