diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/download_test.php | 2 | ||||
-rw-r--r-- | tests/functional/paging_test.php | 14 | ||||
-rw-r--r-- | tests/functional/prune_shadow_topic_test.php | 2 | ||||
-rw-r--r-- | tests/functional/softdelete_test.php | 4 | ||||
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 2 | ||||
-rw-r--r-- | tests/upload/filespec_test.php | 14 |
6 files changed, 26 insertions, 12 deletions
diff --git a/tests/functional/download_test.php b/tests/functional/download_test.php index 24366992d5..087250157d 100644 --- a/tests/functional/download_test.php +++ b/tests/functional/download_test.php @@ -57,7 +57,7 @@ class phpbb_functional_download_test extends phpbb_functional_test_case $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); $this->assertContains('Re: Download Topic #1-#2', $crawler->filter('html')->text()); - $this->data['posts']['Re: Download Topic #1-#2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->eq(1)->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + $this->data['posts']['Re: Download Topic #1-#2'] = (int) $post2['post_id']; } public function test_download_accessible() diff --git a/tests/functional/paging_test.php b/tests/functional/paging_test.php index 91f14cb75d..b0e4743d5b 100644 --- a/tests/functional/paging_test.php +++ b/tests/functional/paging_test.php @@ -18,22 +18,22 @@ class phpbb_functional_paging_test extends phpbb_functional_test_case $this->login(); $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); - for ($post_id = 1; $post_id <= 11; $post_id++) + for ($post_id = 1; $post_id <= 16; $post_id++) { $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post no' . $post_id . ' posted by the testing framework.'); } $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); - $this->assertContains('post no9', $crawler->text()); - $this->assertNotContains('post no11', $crawler->text()); + $this->assertContains('post no4', $crawler->text()); + $this->assertNotContains('post no16', $crawler->text()); $next_link = $crawler->filter('#viewtopic > fieldset > a.arrow-right')->attr('href'); $crawler = self::request('GET', $next_link); - $this->assertContains('post no11', $crawler->text()); - $this->assertNotContains('post no9', $crawler->text()); + $this->assertNotContains('post no4', $crawler->text()); + $this->assertContains('post no16', $crawler->text()); $prev_link = $crawler->filter('#viewtopic > fieldset > a.arrow-left')->attr('href'); $crawler = self::request('GET', $prev_link); - $this->assertContains('post no9', $crawler->text()); - $this->assertNotContains('post no11', $crawler->text()); + $this->assertContains('post no4', $crawler->text()); + $this->assertNotContains('post no16', $crawler->text()); } } diff --git a/tests/functional/prune_shadow_topic_test.php b/tests/functional/prune_shadow_topic_test.php index 901cedb389..a9fd2457bb 100644 --- a/tests/functional/prune_shadow_topic_test.php +++ b/tests/functional/prune_shadow_topic_test.php @@ -76,7 +76,7 @@ class phpbb_functional_prune_shadow_topic_test extends phpbb_functional_test_cas $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); $this->assertContains('Re: Prune Shadow #1-#2', $crawler->filter('html')->text()); - $this->data['posts']['Re: Prune Shadow #1-#2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->eq(1)->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + $this->data['posts']['Re: Prune Shadow #1-#2'] = (int) $post2['post_id']; $this->assert_forum_details($this->data['forums']['Prune Shadow'], array( 'forum_posts_approved' => 2, diff --git a/tests/functional/softdelete_test.php b/tests/functional/softdelete_test.php index bd4d34cf99..1c86d00b9b 100644 --- a/tests/functional/softdelete_test.php +++ b/tests/functional/softdelete_test.php @@ -83,7 +83,7 @@ class phpbb_functional_softdelete_test extends phpbb_functional_test_case $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); $this->assertContains('Re: Soft Delete Topic #1-#2', $crawler->filter('html')->text()); - $this->data['posts']['Re: Soft Delete Topic #1-#2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->eq(1)->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + $this->data['posts']['Re: Soft Delete Topic #1-#2'] = (int) $post2['post_id']; $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( 'forum_posts_approved' => 2, @@ -410,7 +410,7 @@ class phpbb_functional_softdelete_test extends phpbb_functional_test_case $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); $this->add_lang('mcp'); - $form = $crawler->selectButton($this->lang('RESTORE'))->form(); + $form = $crawler->filter('#p' . $this->data['posts']['Soft Delete Topic #1'])->selectButton($this->lang('RESTORE'))->form(); $crawler = self::submit($form); $this->assertContainsLang('RESTORE_POST', $crawler->text()); diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index daa8b802b5..1f372fff0c 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -300,7 +300,7 @@ class phpbb_functional_test_case extends phpbb_test_case // because that step will create a config.php file if phpBB has the // permission to do so. We have to create the config file on our own // in order to get the DEBUG constants defined. - $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, true); + $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, false, true); $config_created = file_put_contents($config_file, $config_php_data) !== false; if (!$config_created) { diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php index 492f31cee6..2d46fd4058 100644 --- a/tests/upload/filespec_test.php +++ b/tests/upload/filespec_test.php @@ -273,4 +273,18 @@ class phpbb_filespec_test extends phpbb_test_case $phpEx = ''; } + + /** + * @dataProvider clean_filename_variables + */ + public function test_uploadname($filename) + { + $type_cast_helper = new \phpbb\request\type_cast_helper(); + + $upload_name = ''; + $type_cast_helper->set_var($upload_name, $filename, 'string', true, true); + $filespec = $this->get_filespec(array('name'=> $upload_name)); + + $this->assertSame(trim(utf8_basename(htmlspecialchars($filename))), $filespec->uploadname); + } } |