/** * Evaluates the constraint for parameter $other. Returns true if the * constraint is met, false otherwise. * * @param mixed $other Value or object to evaluate. * * @return bool */ protected function matches($other) { $jsonResponseArray = new JsonArray($other); if ($jsonResponseArray->containsArray($this->expected)) { return true; } $comparator = new ArrayComparator(); $comparator->setFactory(new Factory()); try { //$comparator->assertEquals(var_export($this->expected, true), var_export($jsonResponseArray->toArray(), true)); $comparator->assertEquals($this->expected, $jsonResponseArray->toArray()); } catch (ComparisonFailure $failure) { throw new \PHPUnit_Framework_ExpectationFailedException("Response JSON does not contain the provided JSON\n", $failure); } }
public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false, array &$processed = array()) { /** @var Collection $expected */ $expected = $expected->toArray(); /** @var Collection $actual */ $actual = $actual->toArray(); parent::assertEquals($expected, $actual, $delta, $canonicalize, $ignoreCase, $processed); }
public function __construct() { parent::__construct(); $this->exporter = new Exporter(); }