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

testLookupFound() public method

public testLookupFound ( )
    public function testLookupFound()
    {
        $body = json_decode(file_get_contents(__DIR__ . '/../fixtures/datastore/entity-batch-lookup.json'), true);
        $this->connection->lookup(Argument::any())->willReturn(['found' => $body]);
        $this->operation->setConnection($this->connection->reveal());
        $key = $this->operation->key('Kind', 'ID');
        $res = $this->operation->lookup([$key]);
        $this->assertTrue(is_array($res));
        $this->assertTrue(isset($res['found']) && is_array($res['found']));
        $this->assertInstanceOf(Entity::class, $res['found'][0]);
        $this->assertEquals($res['found'][0]['Number'], $body[0]['entity']['properties']['Number']['stringValue']);
        $this->assertInstanceOf(Entity::class, $res['found'][1]);
        $this->assertEquals($res['found'][1]['Number'], $body[1]['entity']['properties']['Number']['stringValue']);
    }