更新功能测试

不要忘记更新功能测试以考虑url和内容更改:

12 34 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
——/ /控制器/ ConferenceControllerTest.php测试+ + + b /测试/控制器/ ConferenceControllerTest.php@@ -11,7 +11,7 @@类ConferenceControllerTest扩展WebTestCase公共函数testIndex() {$client = static::createClient();- $client->request('GET', '/');+ $client->request('GET', '/ zh /');$ this - > assertResponseIsSuccessful ();$this->assertSelectorTextContains('h2', '给你的反馈');@@ -20,7 +20,7 @@类ConferenceControllerTest扩展WebTestCase公共函数testCommentSubmission() {$client = static::createClient();- $client->request('GET', '/conference/amsterdam-2019');+ $client->request('GET', '/en/conference/amsterdam-2019');$client->submitForm('Submit', ['comment_form[author]' => 'Fabien', 'comment_form[text]' => '自动功能测试的一些反馈',@@ - 47,7 + 47,7 @@类ConferenceControllerTest扩展WebTestCase公共函数testConferencePage() {$client = static::createClient();- $crawler = $client->request('GET', '/');+ $crawler = $client->request('GET', '/ zh /');$ this - > assertCount(2,履带- >过滤器(h4));@@ -50,6 +50,6 @@ class ConferenceControllerTest extends WebTestCase $this-> assertpagetitleconcontains ('Amsterdam');$ this - > assertResponseIsSuccessful ();$this->assertSelectorTextContains('h2', '阿姆斯特丹2019');- $this->assertSelectorExists('div:contains("有1条评论")');+ $this->assertSelectorExists('div:contains("有一个注释")');}}
此工作,包括代码示例,是根据知识共享协议BY-NC-SA 4.0许可证。