Ejemplo n.º 1
0
 /**
  * @Then /^the "([^"]+)" cookie JSON node ?(.*) should be equal to "([^"]+)"$/
  */
 public function theCookieJsonNodeShouldBeEqualTo($cookieName, $path, $expectedValue)
 {
     $cookie = $this->getCookie($cookieName);
     \PHPUnit_Framework_Assert::assertEquals($expectedValue, JsonUtil::getArrayPath(json_decode($cookie->getValue(), true), $path));
 }
Ejemplo n.º 2
0
 /**
  * @Then /^the JSON node ?(.*) should match:$/
  */
 public function theNodeXShouldMatch($path, TableNode $table)
 {
     $node = JsonUtil::getJsonPath($this, $path);
     $tableHash = $table->getHash();
     $properties = $tableHash[0];
     foreach ($properties as $propertyPath => $expectedValue) {
         if ($expectedValue != JsonUtil::getArrayPath($node, $propertyPath)) {
             throw new \Exception(sprintf('The JSON node "%s" does not contain the following object: %s.', $path, json_encode($properties)));
         }
     }
 }