Google\Cloud\Tests\Snippets\Datastore\DatastoreClientTest::testUpdate PHP Method

testUpdate() public method

public testUpdate ( )
    public function testUpdate()
    {
        $snippet = $this->snippetFromMethod(DatastoreClient::class, 'update');
        $snippet->addLocal('datastore', $this->client);
        $snippet->addLocal('entity', $this->client->entity($this->key, [], ['populatedByService' => true]));
        $this->connection->commit(Argument::that(function ($args) {
            if (array_keys($args['mutations'][0])[0] !== 'update') {
                return false;
            }
            return true;
        }))->shouldBeCalled()->willReturn(['mutationResults' => [['version' => 1]]]);
        $this->client->setConnection($this->connection->reveal());
        $res = $snippet->invoke();
    }