diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 022a028..5dfe5be 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,6 +65,8 @@ jobs: branch: REL1_39 - php: 8.1 branch: REL1_39 + - php: 8.1 + branch: REL1_40 env: USE_MOCK: 1 branch: ${{ matrix.branch }} @@ -99,7 +101,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: mbstring, intl, opcache, mysqli - tools: composer${{ env.branch != 'REL1_39' && ':v1' || '' }} + tools: composer${{ env.branch != 'REL1_39' && env.branch != 'REL1_40' && ':v1' || '' }} - name: (debug) Print "php -i" run: php -i - uses: edwardspec/github-action-build-mediawiki@v1 diff --git a/tests/phpunit/AmazonS3LocalCacheTest.php b/tests/phpunit/AmazonS3LocalCacheTest.php index 66e23e4..157f655 100644 --- a/tests/phpunit/AmazonS3LocalCacheTest.php +++ b/tests/phpunit/AmazonS3LocalCacheTest.php @@ -132,7 +132,7 @@ public function testEnabledLocalCache() { $this->assertInstanceOf( \MWAWS\FSFile::class, $file ); $this->assertNotInstanceOf( TempFSFile::class, $file ); $this->assertFalse( $file->exists() ); - $this->assertRegExp( $expectedTemporaryPathRegex, $file->getPath() ); + $this->assertRegExpTemp( $expectedTemporaryPathRegex, $file->getPath() ); // If contents downloaded into $file are smaller than $wgAWSLocalCacheMinSize bytes, // then $file must become temporary after postDownloadLogic(). @@ -165,7 +165,7 @@ public function testEnabledLocalCache() { $this->assertInstanceOf( MWAWS\FSFile::class, $testFile ); $this->assertNotInstanceOf( TempFSFile::class, $testFile ); $this->assertTrue( $testFile->exists() ); - $this->assertNotRegExp( $expectedTemporaryPathRegex, $testFile->getPath() ); + $this->assertNotRegExpTemp( $expectedTemporaryPathRegex, $testFile->getPath() ); $this->assertEquals( $largeFileContents, file_get_contents( $testFile->getPath() ) ); }; @@ -187,4 +187,26 @@ public function testEnabledLocalCache() { // wouldn't result in any errors or warnings. AmazonS3LocalCache::invalidate( $this->virtualUrl ); } + + /** + * B/C: assertRegExp() is deprecated in MediaWiki 1.40, but 1.35-1.39 don't have a replacement. + * @param string $pattern + * @param string $string + */ + protected function assertRegExpTemp( $pattern, $string ) { + $method = method_exists( $this, 'assertMatchesRegularExpression' ) ? + 'assertMatchesRegularExpression' : 'assertRegExp'; + $this->$method( $pattern, $string ); + } + + /** + * B/C: assertNotRegExp() is deprecated in MediaWiki 1.40, but 1.35-1.39 don't have a replacement. + * @param string $pattern + * @param string $string + */ + protected function assertNotRegExpTemp( $pattern, $string ) { + $method = method_exists( $this, 'assertDoesNotMatchRegularExpression' ) ? + 'assertDoesNotMatchRegularExpression' : 'assertNotRegExp'; + $this->$method( $pattern, $string ); + } }