Google\Cloud\Tests\Snippets\Datastore\TransactionTest::testLookupBatch PHP 메소드

testLookupBatch() 공개 메소드

public testLookupBatch ( )
    public function testLookupBatch()
    {
        $snippet = $this->snippetFromMethod(Transaction::class, 'lookupBatch');
        $snippet->addLocal('datastore', $this->datastore);
        $snippet->addLocal('transaction', $this->transaction);
        $this->connection->lookup(Argument::that(function ($args) {
            if ($args['transaction'] !== $this->transactionId) {
                return false;
            }
            return true;
        }))->shouldBeCalled()->willReturn(['found' => [['entity' => ['key' => ['path' => [['kind' => 'Person', 'name' => 'Bob']]], 'properties' => ['firstName' => ['stringValue' => 'Bob']]]], ['entity' => ['key' => ['path' => [['kind' => 'Person', 'name' => 'John']]], 'properties' => ['firstName' => ['stringValue' => 'John']]]]]]);
        $this->operation->setConnection($this->connection->reveal());
        $res = $snippet->invoke();
        $this->assertEquals("Bob", explode("\n", $res->output())[0]);
        $this->assertEquals("John", explode("\n", $res->output())[1]);
    }