blink\testing\RequestActor::seeJsonContains PHP Method

seeJsonContains() protected method

Assert that the response contains the given JSON.
protected seeJsonContains ( array $data, boolean $negate = false )
$data array
$negate boolean
    protected function seeJsonContains(array $data, $negate = false)
    {
        $method = $negate ? 'assertFalse' : 'assertTrue';
        $actual = json_encode($this->sortRecursive(json_decode($this->response->content(), true)));
        foreach ($this->sortRecursive($data) as $key => $value) {
            $expected = $this->formatToExpectedJson($key, $value);
            $this->phpunit->{$method}(strpos($actual, $expected) !== false, ($negate ? 'Found unexpected' : 'Unable to find') . " JSON fragment [{$expected}] within [{$actual}].");
        }
        return $this;
    }