request("GET", "/helloRandom"); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertStringContainsString("Hello ", $crawler->filter("h1")->text()); } function testRandomNameGenerator() { $rdName = HelloController::generateRandomName(); $this->assertGreaterThan(1, strlen($rdName)); } public function testNameActionWithProvidedName() { $client = static::createClient(); $crawler = $client->request('GET', '/hello/John'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertStringContainsString('Hello John', $crawler->filter('h1')->text()); } public function testNameActionWithDefaultName() { $client = static::createClient(); $crawler = $client->request('GET', '/hello'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertStringContainsString("Hello ", $crawler->filter("h1")->text()); } }