diff --git a/tests/functional/portal_acp_test.php b/tests/functional/portal_acp_test.php index b5be48ec..e53adba9 100644 --- a/tests/functional/portal_acp_test.php +++ b/tests/functional/portal_acp_test.php @@ -69,7 +69,7 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor $this->assertContains('The module was removed successfully.', $crawler->text()); // Add it back - $crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&add[center]=true&sid=' . $this->sid); + $crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&add[center]=true&module_column=2&sid=' . $this->sid); $form = $crawler->selectButton('submit')->form(); $form->setValues(array('module_classname' => $module_name)); self::submit($form); @@ -109,4 +109,34 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor $crawler = self::request('GET', 'app.php/portal?sid=' . $this->sid); $this->assertContains('foobar', $crawler->text()); } + + public function data_add_second_module() + { + return array( + array('\board3\portal\modules\news', 2, 'The module was added successfully.'), + array('\board3\portal\modules\news', 1, 'It is not possible to add the module to the selected column.', true), + array('\board3\portal\modules\attachments', 2, 'The module was added successfully'), + array('\board3\portal\modules\attachments', 2, 'This module can only be added once', true), + array('\board3\portal\modules\attachments', 1, 'This module can only be added once', true), + ); + } + + /** + * @dataProvider data_add_second_module + */ + public function test_add_second_news($module_class, $column, $expected_message, $incomplete = false) + { + // Mark tests as incomplete that can't be run with the current DomCrawler + if ($incomplete) + { + $this->markTestIncomplete('Cannot select invalid value in select in current DomCrawler'); + } + + $this->add_lang_ext('board3/portal', 'info_acp_portal'); + $crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=modules&add_column=' . $column . '&add[center]=add&sid=' . $this->sid); + $form = $crawler->selectButton('submit')->form(); + $form->setValues(array('module_classname' => $module_class)); + $crawler = self::submit($form); + $this->assertContains($expected_message, $crawler->text()); + } }