-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix assertions after minor PHPUnit upgrade
PHPUnit 8.5.3 shows deprecation warnings when calling expectExceptionMessageRegExp. PHPUnit was updated from 8.5.2 to 8.5.2 at the beginning of this branch. See sebastianbergmann/phpunit#4133
- Loading branch information
Showing
4 changed files
with
12 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
use FileFetcher\SimpleFileFetcher; | ||
use org\bovigo\vfs\vfsStream; | ||
use org\bovigo\vfs\vfsStreamDirectory; | ||
use PHPUnit\Framework\TestCase; | ||
use RuntimeException; | ||
use WMDE\Fundraising\Frontend\Infrastructure\ConfigReader; | ||
|
||
|
@@ -16,7 +17,7 @@ | |
* @licence GNU GPL v2+ | ||
* @author Jeroen De Dauw < [email protected] > | ||
*/ | ||
class ConfigReaderTest extends \PHPUnit\Framework\TestCase { | ||
class ConfigReaderTest extends TestCase { | ||
|
||
/** | ||
* @var vfsStreamDirectory | ||
|
@@ -104,15 +105,15 @@ public function testWhenDistFileDoesNotExist_exceptionIsThrown(): void { | |
$reader = new ConfigReader( new SimpleFileFetcher(), $this->distPath . 'foo', $this->emptyPath ); | ||
|
||
$this->expectException( RuntimeException::class ); | ||
$this->expectExceptionMessageRegExp( '/Cannot read config file at path.*/' ); | ||
$this->expectExceptionMessageMatches( '/Cannot read config file at path.*/' ); | ||
$reader->getConfig(); | ||
} | ||
|
||
public function testWhenInstanceFileDoesNotExist_exceptionIsThrown(): void { | ||
$reader = new \WMDE\Fundraising\Frontend\Infrastructure\ConfigReader( new SimpleFileFetcher(), $this->distPath, $this->emptyPath . 'foo' ); | ||
$reader = new ConfigReader( new SimpleFileFetcher(), $this->distPath, $this->emptyPath . 'foo' ); | ||
|
||
$this->expectException( RuntimeException::class ); | ||
$this->expectExceptionMessageRegExp( '/Cannot read config file at path.*/' ); | ||
$this->expectExceptionMessageMatches( '/Cannot read config file at path.*/' ); | ||
$reader->getConfig(); | ||
} | ||
|
||
|
@@ -122,17 +123,17 @@ public function testWhenConfigIsNotJson_exceptionIsThrown(): void { | |
$reader = new ConfigReader( new SimpleFileFetcher(), $notJsonPath ); | ||
|
||
$this->expectException( RuntimeException::class ); | ||
$this->expectExceptionMessageRegExp( '/No valid config data found in config file at path.*/' ); | ||
$this->expectExceptionMessageMatches( '/No valid config data found in config file at path.*/' ); | ||
$reader->getConfig(); | ||
} | ||
|
||
public function testWhenConfigJsonIsNotArray_exceptionIsThrown(): void { | ||
$notArrayPath = vfsStream::newFile( 'not-array.json' )->at( $this->dir )->withContent( '42' )->url(); | ||
|
||
$reader = new \WMDE\Fundraising\Frontend\Infrastructure\ConfigReader( new SimpleFileFetcher(), $notArrayPath ); | ||
$reader = new ConfigReader( new SimpleFileFetcher(), $notArrayPath ); | ||
|
||
$this->expectException( RuntimeException::class ); | ||
$this->expectExceptionMessageRegExp( '/No valid config data found in config file at path.*/' ); | ||
$this->expectExceptionMessageMatches( '/No valid config data found in config file at path.*/' ); | ||
$reader->getConfig(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters