Service errors will NOT bubble up from this method. It will always return
a boolean value. If you want to check for errors, use
{@see \Google\Cloud\PubSub\Subscription::info()}.
If you need to re-check the existence of a subscription that is already
downloaded, call {@see \Google\Cloud\PubSub\Subscription::reload()} first
to refresh the cached information.
Example:
if ($subscription->exists()) {
echo 'Subscription exists!';
}
public function testExistsNotFound() { $this->connection->getSubscription(Argument::any())->willThrow(new NotFoundException('bad'))->shouldBeCalledTimes(1); $subscription = new Subscription($this->connection->reveal(), 'subscription-name', 'topic-name', 'project-id'); $this->assertFalse($subscription->exists()); }