create() public method

Example: $topicInfo = $topic->create();
See also: https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/create Create Topic
public create ( array $options = [] ) : array
$options array [optional] Configuration Options
return array Topic information
Beispiel #1
0
 public function testCreate()
 {
     $this->connection->createTopic(Argument::withEntry('foo', 'bar'))->willReturn(['name' => 'projects/project-name/topics/topic-name']);
     $this->connection->getTopic()->shouldNotBeCalled();
     $topic = new Topic($this->connection->reveal(), 'topic-name', 'project-name');
     $res = $topic->create(['foo' => 'bar']);
     // Make sure the topic data gets cached!
     $topic->info();
     $this->assertEquals('projects/project-name/topics/topic-name', $res['name']);
 }