exists() public method

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\Topic::info()}. Example: if ($topic->exists()) { echo 'Topic exists'; }
public exists ( array $options = [] ) : boolean
$options array [optional] Configuration Options
return boolean
Beispiel #1
0
 public function testExistsReturnsFalse()
 {
     $this->connection->getTopic(Argument::withEntry('foo', 'bar'))->willThrow(new NotFoundException('uh oh'));
     $topic = new Topic($this->connection->reveal(), 'topic-name', 'project-name');
     $this->assertFalse($topic->exists(['foo' => 'bar']));
 }