Skip to content

Commit

Permalink
Fix assertions after minor PHPUnit upgrade
Browse files Browse the repository at this point in the history
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
gbirke authored and Abban committed May 5, 2020
1 parent b5917f2 commit 0de4133
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/Unit/Infrastructure/ConfigReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -16,7 +17,7 @@
* @licence GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
class ConfigReaderTest extends \PHPUnit\Framework\TestCase {
class ConfigReaderTest extends TestCase {

/**
* @var vfsStreamDirectory
Expand Down Expand Up @@ -109,7 +110,7 @@ public function testWhenDistFileDoesNotExist_exceptionIsThrown(): void {
}

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->expectExceptionMessageMatches( '/Cannot read config file at path.*/' );
Expand All @@ -129,7 +130,7 @@ public function testWhenConfigIsNotJson_exceptionIsThrown(): void {
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->expectExceptionMessageMatches( '/No valid config data found in config file at path.*/' );
Expand Down

0 comments on commit 0de4133

Please sign in to comment.