diff options
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/extension_acp_test.php | 2 | ||||
-rw-r--r-- | tests/functional/extension_global_lang_test.php | 7 | ||||
-rw-r--r-- | tests/functional/feed_test.php | 8 | ||||
-rw-r--r-- | tests/functional/metadata_manager_test.php | 7 | ||||
-rw-r--r-- | tests/functional/notification_test.php | 2 | ||||
-rw-r--r-- | tests/functional/plupload_test.php | 1 | ||||
-rw-r--r-- | tests/functional/posting_test.php | 16 | ||||
-rw-r--r-- | tests/functional/search/base.php | 20 | ||||
-rw-r--r-- | tests/functional/user_password_reset_test.php | 43 |
9 files changed, 96 insertions, 10 deletions
diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 7be8957ec7..8a71a5ce04 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -41,6 +41,8 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case { parent::setUp(); + $this->purge_cache(); + $this->get_db(); // Clear the phpbb_ext table diff --git a/tests/functional/extension_global_lang_test.php b/tests/functional/extension_global_lang_test.php index 53bb9af5ca..f615114c08 100644 --- a/tests/functional/extension_global_lang_test.php +++ b/tests/functional/extension_global_lang_test.php @@ -52,6 +52,13 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_ $this->purge_cache(); } + public function tearDown() + { + parent::tearDown(); + + $this->purge_cache(); + } + public function test_load_extension_lang_globally() { $this->phpbb_extension_manager->enable('foo/bar'); diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 9041c8dc69..e48dfc043a 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -20,6 +20,12 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case static public $init_values = array(); + public function setUp() + { + parent::setUp(); + $this->purge_cache(); + } + public function __construct($name = null, array $data = array(), $dataName = '') { parent::__construct($name, $data, $dataName); @@ -1395,7 +1401,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case foreach ($attachments as $i => $attachment) { $content = $crawler->filterXPath("//entry[{$entry_id}]/content")->text(); - $url = "./download/file.php?id={$attachment['id']}"; + $url = self::$root_url . "download/file.php?id={$attachment['id']}"; $string = "Attachment #{$i}"; if ($attachment['displayed']) diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php index 080822d249..0d2fdf082e 100644 --- a/tests/functional/metadata_manager_test.php +++ b/tests/functional/metadata_manager_test.php @@ -24,6 +24,13 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case 'foo/bar/', ); + public function tearDown() + { + $this->purge_cache(); + + parent::tearDown(); + } + static public function setUpBeforeClass() { parent::setUpBeforeClass(); diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index ec03f7a6a4..d4c61cc062 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -82,6 +82,6 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case // Get form token $link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri(); $crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); - $this->assertEquals(0, $crawler->filter('#notification_list_button strong')->text()); + $this->assertCount(0, $crawler->filter('#notification_list_button strong')); } } diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php index ee71597ffc..d358681ad1 100644 --- a/tests/functional/plupload_test.php +++ b/tests/functional/plupload_test.php @@ -33,6 +33,7 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case public function setUp() { parent::setUp(); + $this->purge_cache(); $this->set_extension_group_permission(1); $this->path = __DIR__ . '/fixtures/files/'; $this->add_lang('posting'); diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 33632a01e1..914233240e 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -130,6 +130,22 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case } } + public function test_post_poll() + { + $this->login(); + + $post = $this->create_topic( + 2, + '[ticket/14802] Test Poll Option Spacing', + 'Empty/blank lines should not be additional poll options.', + array('poll_title' => 'Poll Title', 'poll_option_text' => "\n A \nB\n\nC \n D\nE\n\n \n") + ); + + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertEquals('Poll Title', $crawler->filter('.poll-title')->text()); + $this->assertEquals(5, $crawler->filter('*[data-poll-option-id]')->count()); + } + protected function set_quote_depth($depth) { $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post'); diff --git a/tests/functional/search/base.php b/tests/functional/search/base.php index 1d37d748df..f1e9b517d4 100644 --- a/tests/functional/search/base.php +++ b/tests/functional/search/base.php @@ -75,30 +75,34 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case protected function create_search_index() { $this->add_lang('acp/search'); - $crawler = self::request( - 'POST', - 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid, + $crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid); + $form = $crawler->selectButton('Create index')->form(); + $form_values = $form->getValues(); + $form_values = array_merge($form_values, array( 'search_type' => $this->search_backend, 'action' => 'create', - 'submit' => true, ) ); + $form->setValues($form_values); + $crawler = self::submit($form); $this->assertContainsLang('SEARCH_INDEX_CREATED', $crawler->text()); } protected function delete_search_index() { $this->add_lang('acp/search'); - $crawler = self::request( - 'POST', - 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid, + $crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid); + $form = $crawler->selectButton('Delete index')->form(); + $form_values = $form->getValues(); + $form_values = array_merge($form_values, array( 'search_type' => $this->search_backend, 'action' => 'delete', - 'submit' => true, ) ); + $form->setValues($form_values); + $crawler = self::submit($form); $this->assertContainsLang('SEARCH_INDEX_REMOVED', $crawler->text()); } } diff --git a/tests/functional/user_password_reset_test.php b/tests/functional/user_password_reset_test.php index f9406f0eb5..3da78407cf 100644 --- a/tests/functional/user_password_reset_test.php +++ b/tests/functional/user_password_reset_test.php @@ -113,6 +113,49 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca $this->assertContains($this->lang('LOGIN_ERROR_PASSWORD', '', ''), $crawler->filter('html')->text()); } + /** + * @depends test_login + */ + public function test_acivateAfterDeactivate() + { + // User is active, actkey should not exist + $this->get_user_data(); + $this->assertEmpty($this->user_data['user_actkey']); + + $this->login(); + $this->admin_login(); + $this->add_lang('acp/users'); + + // Go to user account page + $crawler = self::request('GET', 'adm/index.php?i=acp_users&mode=overview&sid=' . $this->sid); + $this->assertContainsLang('FIND_USERNAME', $crawler->filter('html')->text()); + + $form = $crawler->selectButton('Submit')->form(); + $crawler = self::submit($form, array('username' => 'reset-password-test-user')); + + // Deactivate account and go back to overview of current user + $this->assertContainsLang('USER_TOOLS', $crawler->filter('html')->text()); + $form = $crawler->filter('input[name=update]')->selectButton('Submit')->form(); + $crawler = self::submit($form, array('action' => 'active')); + + $this->assertContainsLang('USER_ADMIN_DEACTIVED', $crawler->filter('html')->text()); + $link = $crawler->selectLink('Back to previous page')->link(); + $crawler = self::request('GET', preg_replace('#(.+)(adm/index.php.+)#', '$2', $link->getUri())); + + // Ensure again that actkey is empty after deactivation + $this->get_user_data(); + $this->assertEmpty($this->user_data['user_actkey']); + + // Force reactivation of account and check that act key is not empty anymore + $this->assertContainsLang('USER_TOOLS', $crawler->filter('html')->text()); + $form = $crawler->filter('input[name=update]')->selectButton('Submit')->form(); + $crawler = self::submit($form, array('action' => 'reactivate')); + $this->assertContainsLang('FORCE_REACTIVATION_SUCCESS', $crawler->filter('html')->text()); + + $this->get_user_data(); + $this->assertNotEmpty($this->user_data['user_actkey']); + } + protected function get_user_data() { $db = $this->get_db(); |