Flow\JSONPath\Test\JSONPathArrayAccessTest::testIterating PHP Method

testIterating() public method

public testIterating ( )
    public function testIterating()
    {
        $data = $this->exampleData(rand(0, 1));
        $conferences = (new JSONPath($data))->find('.conferences.*');
        $names = [];
        foreach ($conferences as $conference) {
            $players = $conference->find('.teams.*.players[?(@.active=yes)]');
            foreach ($players as $player) {
                $names[] = $player->name;
            }
        }
        $this->assertEquals(['Joe Face', 'something'], $names);
    }