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']); }