Skip to content

Commit

Permalink
Merge 4c43a09 into 173ff91
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Apr 3, 2015
2 parents 173ff91 + 4c43a09 commit c950ed7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"require": {
"php": ">=5.4.0",
"zircote/swagger-php": "0.9.*",
"phpunit/phpunit": "4.0.*"
"sebastian/comparator": "~1.1"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
Expand Down
9 changes: 5 additions & 4 deletions src/Compare/CompareResponseAndAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace SwaggerAssert\Compare;

use SebastianBergmann\Comparator\ComparisonFailure;
use SebastianBergmann\Comparator\Factory as ComparatorFactory;
use SwaggerAssert\CompareInterface;
use SwaggerAssert\PickInterface;
use SwaggerAssert\Exception\CompareException;
use PHPUnit_Framework_ComparatorFactory;
use SebastianBergmann\Diff\Differ;

/**
Expand All @@ -16,7 +17,7 @@ class CompareResponseAndAnnotation implements CompareInterface
/* @var \SwaggerAssert\Pick\PickResponseAndAnnotation $pick */
private $pick;

/* @var \PHPUnit_Framework_ComparatorFactory */
/* @var ComparatorFactory */
private $comparatorFactory;

/* @var \SebastianBergmann\Diff\Differ */
Expand All @@ -29,7 +30,7 @@ public function __construct(PickInterface $pick)
{
$this->pick = $pick;
$this->pick->execute();
$this->comparatorFactory = PHPUnit_Framework_ComparatorFactory::getDefaultInstance();
$this->comparatorFactory = ComparatorFactory::getInstance();
$this->differ = new Differ("--- Response\n+++ Swagger\n");
}

Expand Down Expand Up @@ -70,7 +71,7 @@ private function emulateAssertEquals($expected, $actual)
try {
$comparator = $this->comparatorFactory->getComparatorFor($expected, $actual);
$comparator->assertEquals($actual, $expected, 0, false, false);
} catch (\PHPUnit_Framework_ComparisonFailure $e) {
} catch (ComparisonFailure $e) {
$messageHead = "Failed asserting that API response and swagger document are equal.\n";
throw new CompareException($messageHead . $this->differ->diff($e->getExpectedAsString(), $e->getActualAsString()));
}
Expand Down
10 changes: 0 additions & 10 deletions tests/SwaggerAssert/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,4 @@ public function keysWithValue($subject)
{
$this->assertInstanceOf('SwaggerAssert\Container\Actual', $subject->sample);
}

/**
* @test
* @expectedException \Exception
*/
public function setWithInvalidValue()
{
$subject = new Container();
$subject->push('sample', ['something array']);
}
}

0 comments on commit c950ed7

Please sign in to comment.