Google\Cloud\Tests\PubSub\TopicTest::testSubscribe PHP Method

testSubscribe() public method

public testSubscribe ( )
    public function testSubscribe()
    {
        $subscriptionData = ['name' => 'projects/project-name/subscriptions/subscription-name', 'topic' => 'projects/project-name/topics/topic-name'];
        $this->connection->createSubscription(Argument::withEntry('foo', 'bar'))->willReturn($subscriptionData)->shouldBeCalledTimes(1);
        $this->topic->setConnection($this->connection->reveal());
        $subscription = $this->topic->subscribe('subscription-name', ['foo' => 'bar']);
        $this->assertInstanceOf(Subscription::class, $subscription);
    }