Google\Cloud\Tests\Datastore\DatastoreClientTest::testKey PHP Method

testKey() public method

public testKey ( )
    public function testKey()
    {
        $key = $this->datastore->key('Foo', 'Bar');
        $this->assertInstanceOf(Key::class, $key);
        $this->assertEquals($key->keyObject()['path'][0]['kind'], 'Foo');
        $this->assertEquals($key->keyObject()['path'][0]['name'], 'Bar');
        $key = $this->datastore->key('Foo', '123');
        $this->assertEquals($key->keyObject()['path'][0]['kind'], 'Foo');
        $this->assertEquals($key->keyObject()['path'][0]['id'], '123');
        $key = $this->datastore->key('Foo', 123);
        $this->assertEquals($key->keyObject()['path'][0]['kind'], 'Foo');
        $this->assertEquals($key->keyObject()['path'][0]['id'], '123');
    }