Google\Cloud\Tests\PubSub\SubscriptionTest::testPull PHP Method

testPull() public method

public testPull ( )
    public function testPull()
    {
        $messages = ['receivedMessages' => [['message' => []], ['message' => []]]];
        $this->connection->pull(Argument::withEntry('foo', 'bar'))->willReturn($messages)->shouldBeCalledTimes(1);
        $this->subscription->setConnection($this->connection->reveal());
        $result = $this->subscription->pull(['foo' => 'bar']);
        $this->assertInstanceOf(Generator::class, $result);
        $arr = iterator_to_array($result);
        $this->assertInstanceOf(Message::class, $arr[0]);
        $this->assertInstanceOf(Message::class, $arr[1]);
    }