Google\Cloud\Tests\System\PubSub\ManageTopicsTest::testCreateAndListTopics PHP Method

testCreateAndListTopics() public method

public testCreateAndListTopics ( $client )
    public function testCreateAndListTopics($client)
    {
        $foundTopics = [];
        $topicsToCreate = [uniqid(self::TESTING_PREFIX), uniqid(self::TESTING_PREFIX)];
        foreach ($topicsToCreate as $topicToCreate) {
            self::$deletionQueue[] = $client->createTopic($topicToCreate);
        }
        $topics = $client->topics();
        foreach ($topics as $topic) {
            $nameParts = explode('/', $topic->name());
            $tName = end($nameParts);
            foreach ($topicsToCreate as $key => $topicToCreate) {
                if ($tName === $topicToCreate) {
                    $foundTopics[$key] = $tName;
                }
            }
        }
        $this->assertEquals($topicsToCreate, $foundTopics);
    }