diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/controller/controller_test.php | 3 | ||||
-rw-r--r-- | tests/controller/helper_route_test.php | 28 | ||||
-rw-r--r-- | tests/functional/feed_test.php | 31 | ||||
-rw-r--r-- | tests/functional/visibility_softdelete_test.php | 2 | ||||
-rw-r--r-- | tests/mock/controller_helper.php | 22 | ||||
-rw-r--r-- | tests/pagination/pagination_test.php | 8 |
6 files changed, 54 insertions, 40 deletions
diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 7d9fe652eb..7b8b78dd22 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -29,7 +29,8 @@ class phpbb_controller_controller_test extends phpbb_test_case public function test_provider() { - $provider = new \phpbb\controller\provider($this->extension_manager->get_finder()); + $provider = new \phpbb\controller\provider(); + $provider->find_routing_files($this->extension_manager->get_finder()); $routes = $provider->find(__DIR__)->get_routes(); // This will need to be updated if any new routes are defined diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index 5264c788c7..ae6f924a62 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -27,23 +27,25 @@ class phpbb_controller_helper_route_test extends phpbb_test_case ); $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $this->user, new \phpbb\template\context()); + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor2/foo/', + ), + ) + ); $finder = new \phpbb\extension\finder( - new phpbb_mock_extension_manager( - dirname(__FILE__) . '/', - array( - 'vendor2/foo' => array( - 'ext_name' => 'vendor2/foo', - 'ext_active' => '1', - 'ext_path' => 'ext/vendor2/foo/', - ), - ) - ), + $this->extension_manager, new \phpbb\filesystem(), dirname(__FILE__) . '/', new phpbb_mock_cache() ); - $this->provider = new \phpbb\controller\provider($finder); + $this->provider = new \phpbb\controller\provider(); + $this->provider->find_routing_files($finder); $this->provider->find(dirname(__FILE__) . '/'); } @@ -82,7 +84,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case */ public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description) { - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, '', 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, '', 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } @@ -122,7 +124,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description) { $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, '', 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, '', 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } } diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index fbcbfa3943..b6287bf10f 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -480,7 +480,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_create_softdelete_post() { - $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -504,7 +503,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_softdelete_post() { - $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -532,7 +530,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_softdeleted_post_admin() { - $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -575,7 +572,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_softdeleted_post_guest() { - $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -609,7 +605,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_softdelete_topic() { - $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -639,7 +634,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_softdeleted_topic_admin() { - $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -709,7 +703,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_softdeleted_topic_guest() { - $this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -758,7 +751,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_create_unapproved_post() { - $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -780,7 +772,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_unapproved_post_admin() { - $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -823,7 +814,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_unapproved_post_disapprove_user() { - $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -857,7 +847,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_create_unapproved_topic() { - $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -877,7 +866,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_unapproved_topic_admin() { - $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -944,7 +932,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_unapproved_topic_disapprove_user() { - $this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459'); $this->load_ids(array( 'forums' => array( 'Feeds #1.1', @@ -1026,7 +1013,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case $this->assert_feeds(array( 'f' => array( array( - 'nb_entries' => 2, + 'nb_entries' => 4, 'id' => $this->data['forums']['Feeds #1'], 'attachments' => array( 1 => array( // First entry @@ -1054,7 +1041,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 11, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1067,7 +1054,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1080,7 +1067,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1093,7 +1080,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1153,7 +1140,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 6, + 'nb_entries' => 7, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1166,7 +1153,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1179,7 +1166,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch @@ -1192,7 +1179,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 5, + 'nb_entries' => 6, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch diff --git a/tests/functional/visibility_softdelete_test.php b/tests/functional/visibility_softdelete_test.php index f8ada9687c..3d44476ff0 100644 --- a/tests/functional/visibility_softdelete_test.php +++ b/tests/functional/visibility_softdelete_test.php @@ -608,7 +608,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); - $this->assertContainsLang('POST_DELETED', $crawler->filter('body')->text()); + $this->assertContainsLang('POST_DELETED_ACTION', $crawler->filter('body')->text()); $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( 'forum_posts_approved' => 1, diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php new file mode 100644 index 0000000000..01ac6494d0 --- /dev/null +++ b/tests/mock/controller_helper.php @@ -0,0 +1,22 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +class phpbb_mock_controller_helper extends \phpbb\controller\helper +{ + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, $phpbb_root_path, $php_ext, $phpbb_root_path_ext) + { + $this->template = $template; + $this->user = $user; + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $provider->find_routing_files($manager->get_finder()); + $this->route_collection = $provider->find($phpbb_root_path_ext)->get_routes(); + } +} diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 71206dff58..f7a02dc419 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -30,17 +30,19 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); + $manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array()); $this->finder = new \phpbb\extension\finder( - new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array()), + $manager, new \phpbb\filesystem(), dirname(__FILE__) . '/', new phpbb_mock_cache() ); $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); - $provider = new \phpbb\controller\provider($this->finder); + $provider = new \phpbb\controller\provider(); + $provider->find_routing_files($this->finder); $provider->find(dirname(__FILE__) . '/'); - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $provider, '', 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $provider, $manager, '', 'php', dirname(__FILE__) . '/'); $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper); } |