Skip to content

Commit

Permalink
Merge branch 'limit-to-5.7.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
davedevelopment committed Aug 7, 2017
2 parents 05311bc + 4389144 commit b99c29c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -24,7 +24,7 @@
* Fix Mockery not setting properties on overloaded instance mocks
* BC BREAK - Fix Mockery not trying default expectations if there is any concrete expectation
* BC BREAK - Mockery's PHPUnit integration will mark a test as risky if it
thinks one it's exceptions has been swallowed. Use `$e->dismiss()` to dismiss.
thinks one it's exceptions has been swallowed in PHPUnit > 5.7.6. Use `$e->dismiss()` to dismiss.


## 0.9.4 (XXXX-XX-XX)
Expand Down
4 changes: 4 additions & 0 deletions library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php
Expand Up @@ -54,6 +54,10 @@ protected function addMockeryExpectationsToAssertionCount()

protected function checkMockeryExceptions()
{
if (!method_exists($this, "markAsRisky")) {
return;
}

foreach (Mockery::getContainer()->mockery_thrownExceptions() as $e) {
if (!$e->dismissed()) {
$this->markAsRisky('Mockery found an exception that appears to have been swallowed: '.$e->getMessage());
Expand Down
14 changes: 11 additions & 3 deletions tests/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationTest.php
Expand Up @@ -13,12 +13,17 @@ class BaseClassStub

function finish() {
$this->checkMockeryExceptions();
}
}

function markAsRisky() {}
};

class MockeryPHPUnitIntegrationTest extends MockeryTestCase
{
/** @test */
/**
* @test
* @requires PHPUnit 5.7.6
*/
public function it_marks_a_passing_test_as_risky_if_we_threw_exceptions()
{
$mock = mock();
Expand All @@ -34,7 +39,10 @@ public function it_marks_a_passing_test_as_risky_if_we_threw_exceptions()
$test->shouldHaveReceived()->markAsRisky(m::type("string"));
}

/** @test */
/**
* @test
* @requires PHPUnit 5.7.6
*/
public function the_user_can_manually_dismiss_an_exception_to_avoid_the_risky_test()
{
$mock = mock();
Expand Down

0 comments on commit b99c29c

Please sign in to comment.