예제 #1
0
 /**
  * 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);
     }
 }
예제 #2
0
파일: REST.php 프로젝트: corcre/elabftw
 /**
  * Opposite to seeResponseContainsJson
  *
  * @part json
  * @param array $json
  */
 public function dontSeeResponseContainsJson($json = [])
 {
     $jsonResponseArray = new JsonArray($this->response);
     \PHPUnit_Framework_Assert::assertFalse($jsonResponseArray->containsArray($json), "Response JSON does not contain JSON provided\n" . "- <info>" . var_export($json, true) . "</info>\n" . "+ " . var_export($jsonResponseArray->toArray(), true));
 }
예제 #3
0
파일: REST.php 프로젝트: surjit/Codeception
 /**
  * Opposite to seeResponseContainsJson
  *
  * @part json
  * @param array $json
  */
 public function dontSeeResponseContainsJson($json = [])
 {
     $jsonResponseArray = new JsonArray($this->connectionModule->_getResponseContent());
     $this->assertFalse($jsonResponseArray->containsArray($json), "Response JSON contains provided JSON\n" . "- <info>" . var_export($json, true) . "</info>\n" . "+ " . var_export($jsonResponseArray->toArray(), true));
 }
예제 #4
0
 public function seeInFormResult($expected)
 {
     $jsonArray = new JsonArray($this->grabTextFrom(['id' => 'data']));
     $this->assertTrue($jsonArray->containsArray($expected), var_export($jsonArray->toArray(), true));
 }