Skip to content

Commit

Permalink
(tests) Run tests on REL1_40 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardspec committed Mar 26, 2023
1 parent aba18d2 commit 744e594
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down
26 changes: 24 additions & 2 deletions tests/phpunit/AmazonS3LocalCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down Expand Up @@ -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() ) );
};

Expand All @@ -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 );
}
}

0 comments on commit 744e594

Please sign in to comment.