Skip to content

Commit

Permalink
Fix incompatability for PHPUnit 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotchance committed Sep 13, 2014
1 parent 6702645 commit 788d561
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,20 @@ public function testCanAcceptATestSuite()
$this->assert($result, contains_string, "foo");
}

protected function getComparisonFailure()
{
// PHPUnit 4.0
if (class_exists('PHPUnit_Framework_ComparisonFailure')) {
return 'PHPUnit_Framework_ComparisonFailure';
}

// PHPUnit 4.1+
return 'SebastianBergmann\Comparator\ComparisonFailure';
}

public function testPHPUnitDiffsAreShown()
{
$failure = $this->mock('SebastianBergmann\Comparator\ComparisonFailure', array('foo', 'bar', 'foo', 'bar'))
$failure = $this->mock($this->getComparisonFailure(), array('foo', 'bar', 'foo', 'bar'))
->expect('getDiff')->andReturn('foobar')
->done();
$this->exception = new \PHPUnit_Framework_ExpectationFailedException('', $failure);
Expand Down

0 comments on commit 788d561

Please sign in to comment.