Google\Cloud\Tests\Snippets\Datastore\KeyTest::testAncestorKey PHP Method

testAncestorKey() public method

public testAncestorKey ( )
    public function testAncestorKey()
    {
        $ds = $this->prophesize(DatastoreClient::class);
        $ds->key(Argument::any(), Argument::any())->will(function ($args) {
            return new Key('my-awesome-project', ['path' => [['kind' => $args[0], 'name' => $args[1]]]]);
        });
        $snippet = $this->snippetFromMethod(Key::class, 'ancestorKey');
        $snippet->addLocal('key', $this->key);
        $snippet->addLocal('datastore', $ds->reveal());
        $res = $snippet->invoke();
        $this->assertEquals('Dad', $this->key->path()[0]['name']);
    }