Skip to content

Commit

Permalink
Clean up some risky test warnings on PHPUnit 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
stevegrunwell committed Oct 29, 2020
1 parent a14f08b commit d139bd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/Concerns/RunkitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ public function it_should_skip_tests_that_require_runkit_if_it_is_unavailable()
$method = new \ReflectionMethod($this->instance, 'requiresRunkit');
$method->setAccessible(true);

$this->expectException(SkippedTestError::class);
// Older versions of PHPUnit will actually try to mark this as skipped.
try {
$method->invoke($this->instance);
} catch (SkippedTestError $e) {
$this->assertInstanceOf(SkippedTestError::class, $e);
return;
}

$method->invoke($this->instance);
$this->fail('Did not catch the expected SkippedTestError.');
}
}
4 changes: 4 additions & 0 deletions tests/GlobalVariablesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
*/
class GlobalVariablesTest extends TestCase
{
protected $backupGlobalsBlacklist = [
'setGlobalVariable',
];

/**
* @test
* @testdox setGlobalVariable() should be able to handle new global variables
Expand Down

0 comments on commit d139bd0

Please sign in to comment.