Google\Cloud\Tests\Datastore\OperationTest::testRunQueryNoResults PHP Method

testRunQueryNoResults() public method

    public function testRunQueryNoResults()
    {
        $queryResult = json_decode(file_get_contents(__DIR__ . '/../fixtures/datastore/query-results.json'), true);
        $this->connection->runQuery(Argument::type('array'))->willReturn($queryResult['noResults']);
        $this->operation->setConnection($this->connection->reveal());
        $q = $this->prophesize(QueryInterface::class);
        $q->queryKey()->shouldBeCalled()->willReturn('query');
        $q->queryObject()->shouldBeCalled()->willReturn([]);
        $res = $this->operation->runQuery($q->reveal());
        $this->assertInstanceOf(\Generator::class, $res);
        $arr = iterator_to_array($res);
        $this->assertEquals(count($arr), 0);
    }