Configure test fixtures and implement conference page functional test

This commit is contained in:
2024-07-28 18:27:27 -04:00
parent 1d0f293827
commit 3b259e058b
3 changed files with 72 additions and 2 deletions

View File

@@ -14,4 +14,34 @@ class ConferenceControllerTest extends WebTestCase
$this->assertResponseIsSuccessful();
$this->assertSelectorTextContains('h2', 'Give your feedback');
}
public function testConferencePage()
{
$client = static::createClient();
$crawler = $client->request('GET', '/');
$this->assertCount(2, $crawler->filter('h4'));
$client->clickLink('View');
$this->assertPageTitleContains('Amsterdam');
$this->assertResponseIsSuccessful();
$this->assertSelectorTextContains('h2', 'Amsterdam 2019');
$this->assertSelectorExists('div:contains("There are 1 comments")');
}
public function testCommentSubmission()
{
$client = static::createClient();
$client->request('GET', 'conference/amsterdam-2019');
$client->submitForm('Submit', [
'comment[author]' => 'Bob',
'comment[text]' => 'Some feedback from an automated functional test',
'comment[email]' => 'test@example.com',
'comment[photo]' => dirname(__DIR__, 2) . '/public/images/under-construction.gif',
]);
$this->assertResponseRedirects();
$client->followRedirect();
$this->assertSelectorExists('div:contains("There are 2 comments")');
}
}