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

testInsertBatch() public method

public testInsertBatch ( )
    public function testInsertBatch()
    {
        $snippet = $this->snippetFromMethod(DatastoreClient::class, 'insertBatch');
        $snippet->addLocal('datastore', $this->client);
        $this->connection->commit(Argument::that(function ($args) {
            if (array_keys($args['mutations'][0])[0] !== 'insert') {
                return false;
            }
            return true;
        }))->shouldBeCalled();
        $this->allocateIdsConnectionMock();
        $this->client->setConnection($this->connection->reveal());
        $res = $snippet->invoke('entities');
        $this->assertEquals(Key::STATE_NAMED, $res->returnVal()[0]->key()->state());
    }