Flow\JSONPath\Test\JSONPathArrayAccessTest::testChaining PHP Méthode

testChaining() public méthode

public testChaining ( )
    public function testChaining()
    {
        $data = $this->exampleData(rand(0, 1));
        $conferences = (new JSONPath($data))->find('.conferences.*');
        $teams = $conferences->find('..teams.*');
        $this->assertEquals('Dodger', $teams[0]['name']);
        $this->assertEquals('Mets', $teams[1]['name']);
        $teams = (new JSONPath($data))->find('.conferences.*')->find('..teams.*');
        $this->assertEquals('Dodger', $teams[0]['name']);
        $this->assertEquals('Mets', $teams[1]['name']);
        $teams = (new JSONPath($data))->find('.conferences..teams.*');
        $this->assertEquals('Dodger', $teams[0]['name']);
        $this->assertEquals('Mets', $teams[1]['name']);
    }