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

testStateNamed() public method

public testStateNamed ( )
    public function testStateNamed()
    {
        $ds = $this->prophesize(DatastoreClient::class);
        $ds->key(Argument::any(), Argument::any())->will(function ($args) {
            return new Key('my-awesome-project', ['path' => [['kind' => $args[0], 'id' => $args[1]]]]);
        });
        $snippet = $this->snippetFromMethod(Key::class, 'state', 1);
        $snippet->addLocal('datastore', $ds->reveal());
        $snippet->addUse(Key::class);
        $res = $snippet->invoke();
        $this->assertEquals('Key is named!', $res->output());
    }