reload() public method

Currently this resource returns only the topic name, if the topic exists. It is mostly useful therefore for checking if a topic exists. Since this method will throw an exception if the topic is not found, you may find that Topic::exists() is a better fit for a true/false check. This method will retrieve a new result from the API. To use a previously cached result, if one exists, use {@see \Google\Cloud\Pubsub\Topic::info()}. Example: $topic->reload(); $info = $topic->info(); echo $info['name']; // projects/my-awesome-project/topics/my-new-topic
See also: https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/get Get Topic
public reload ( array $options = [] ) : array
$options array [optional] Configuration Options
return array [A representation of a Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics)
Beispiel #1
0
 public function testReload()
 {
     $this->connection->getTopic(Argument::withEntry('foo', 'bar'))->willReturn(['name' => 'projects/project-name/topics/topic-name']);
     $topic = new Topic($this->connection->reveal(), 'topic-name', 'project-name');
     $res = $topic->reload(['foo' => 'bar']);
     $this->assertEquals($res['name'], 'projects/project-name/topics/topic-name');
 }