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

testMapEntityResult() public method

public testMapEntityResult ( )
    public function testMapEntityResult()
    {
        $res = json_decode(file_get_contents(__DIR__ . '/../fixtures/datastore/entity-result.json'), true);
        $this->connection->lookup(Argument::type('array'))->willReturn(['found' => $res]);
        $this->operation->setConnection($this->connection->reveal());
        $k = $this->prophesize(Key::class);
        $k->state()->willReturn(Key::STATE_NAMED);
        $entity = $this->operation->lookup([$k->reveal()]);
        $this->assertInstanceOf(Entity::class, $entity['found'][0]);
        $this->assertEquals($entity['found'][0]->baseVersion(), $res[0]['version']);
        $this->assertEquals($entity['found'][0]->cursor(), $res[0]['cursor']);
        $this->assertEquals($entity['found'][0]->prop, $res[0]['entity']['properties']['prop']['stringValue']);
    }