From a4fe72bd533ef6ebe2040b0dbc8c26ebed1528e2 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 2 May 2013 15:40:43 -0500 Subject: [ticket/11420] Fix notification options conversion PHPBB3-11420 --- tests/notification/convert_test.php | 110 ++++++++++++++++++++++++++++++++ tests/notification/fixtures/convert.xml | 52 +++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 tests/notification/convert_test.php create mode 100644 tests/notification/fixtures/convert.xml (limited to 'tests') diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php new file mode 100644 index 0000000000..fdd0d19e72 --- /dev/null +++ b/tests/notification/convert_test.php @@ -0,0 +1,110 @@ +createXMLDataSet(dirname(__FILE__) . '/fixtures/convert.xml'); + } + + protected function setUp() + { + parent::setUp(); + + global $phpbb_root_path, $phpEx; + + $this->db = $this->new_dbal(); + + $this->migration = new phpbb_db_migration_data_310_notifications3( + new phpbb_config(array()), + $this->db, + new phpbb_db_tools($this->db), + $phpbb_root_path, + $phpEx, + 'phpbb_' + ); + } + + public function test_convert() + { + $buffer = new phpbb_mock_sql_insert_buffer($this->db, 'phpbb_user_notifications'); + $this->migration->perform_conversion($buffer, 'phpbb_user_notifications'); + + $expected = array_merge( + $this->create_expected('post', 1, 'email'), + $this->create_expected('topic', 1, 'email'), + + $this->create_expected('post', 2, 'email'), + $this->create_expected('topic', 2, 'email'), + $this->create_expected('pm', 2, 'email'), + + $this->create_expected('post', 3, 'jabber'), + $this->create_expected('topic', 3, 'jabber'), + + $this->create_expected('post', 4, 'jabber'), + $this->create_expected('topic', 4, 'jabber'), + $this->create_expected('pm', 4, 'jabber'), + + $this->create_expected('post', 5, 'both'), + $this->create_expected('topic', 5, 'both'), + + $this->create_expected('post', 6, 'both'), + $this->create_expected('topic', 6, 'both'), + $this->create_expected('pm', 6, 'both') + ); + + $this->assertEquals($expected, $buffer->get_buffer()); + } + + protected function create_expected($type, $user_id, $method = '') + { + $return = array(); + + if ($method != '') + { + $return[] = array( + 'item_type' => $type, + 'item_id' => 0, + 'user_id' => $user_id, + 'method' => '', + 'notify' => 1, + ); + } + + if ($method == 'email' || $method == 'both') + { + $return[] = array( + 'item_type' => $type, + 'item_id' => 0, + 'user_id' => $user_id, + 'method' => 'email', + 'notify' => 1, + ); + } + + if ($method == 'jabber' || $method == 'both') + { + $return[] = array( + 'item_type' => $type, + 'item_id' => 0, + 'user_id' => $user_id, + 'method' => 'jabber', + 'notify' => 1, + ); + } + + return $return; + } +} diff --git a/tests/notification/fixtures/convert.xml b/tests/notification/fixtures/convert.xml new file mode 100644 index 0000000000..a244070a95 --- /dev/null +++ b/tests/notification/fixtures/convert.xml @@ -0,0 +1,52 @@ + + + + user_id + username + username_clean + user_notify_type + user_notify_pm + + 1 + 1 + 1 + 0 + 0 + + + 2 + 2 + 2 + 0 + 1 + + + 3 + 3 + 3 + 1 + 0 + + + 4 + 4 + 4 + 1 + 1 + + + 5 + 5 + 5 + 2 + 0 + + + 6 + 6 + 6 + 2 + 1 + +
+
-- cgit v1.2.1 From 77436595630d3aa267ebb9b00d12e899818a34b7 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 3 May 2013 08:37:09 -0500 Subject: [ticket/11420] Forgot to include mock sql_insert_buffer PHPBB3-11420 --- tests/mock/sql_insert_buffer.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/mock/sql_insert_buffer.php (limited to 'tests') diff --git a/tests/mock/sql_insert_buffer.php b/tests/mock/sql_insert_buffer.php new file mode 100644 index 0000000000..ba09aa8d7f --- /dev/null +++ b/tests/mock/sql_insert_buffer.php @@ -0,0 +1,21 @@ +buffer)) ? true : false; + } + + public function get_buffer() + { + return $this->buffer; + } +} -- cgit v1.2.1 From 9f85a4d118544e6097005ea3ef37e1e627838278 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 6 Jul 2013 12:59:26 -0500 Subject: [ticket/11420] Use !==, === when comparing strings PHPBB3-11420 --- tests/notification/convert_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index fdd0d19e72..e07c144e16 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -72,7 +72,7 @@ class phpbb_notification_convert_test extends phpbb_database_test_case { $return = array(); - if ($method != '') + if ($method !== '') { $return[] = array( 'item_type' => $type, @@ -83,7 +83,7 @@ class phpbb_notification_convert_test extends phpbb_database_test_case ); } - if ($method == 'email' || $method == 'both') + if ($method === 'email' || $method === 'both') { $return[] = array( 'item_type' => $type, @@ -94,7 +94,7 @@ class phpbb_notification_convert_test extends phpbb_database_test_case ); } - if ($method == 'jabber' || $method == 'both') + if ($method === 'jabber' || $method === 'both') { $return[] = array( 'item_type' => $type, -- cgit v1.2.1 From 91165e0758ccb47878fe33708ffeee5021614083 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 11 Jul 2013 15:49:32 -0500 Subject: [ticket/11420] Fix tests PHPBB3-11420 --- tests/notification/fixtures/convert.xml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/notification/fixtures/convert.xml b/tests/notification/fixtures/convert.xml index a244070a95..98dd5fe0d5 100644 --- a/tests/notification/fixtures/convert.xml +++ b/tests/notification/fixtures/convert.xml @@ -6,12 +6,14 @@ username_clean user_notify_type user_notify_pm + user_permissions 1 1 1 0 0 + 2 @@ -19,6 +21,7 @@ 2 0 1 + 3 @@ -26,6 +29,7 @@ 3 1 0 + 4 @@ -33,6 +37,7 @@ 4 1 1 + 5 @@ -40,6 +45,7 @@ 5 2 0 + 6 @@ -47,6 +53,7 @@ 6 2 1 + -- cgit v1.2.1 From 9bfb567854b6c7487fcdc8dd5cd58748b0016911 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 11 Jul 2013 15:58:02 -0500 Subject: [ticket/11420] Fix tests PHPBB3-11420 --- tests/notification/convert_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index e07c144e16..4d00fa0a1e 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -27,7 +27,7 @@ class phpbb_notification_convert_test extends phpbb_database_test_case $this->db = $this->new_dbal(); - $this->migration = new phpbb_db_migration_data_310_notifications3( + $this->migration = new phpbb_db_migration_data_310_notification_options_reconvert( new phpbb_config(array()), $this->db, new phpbb_db_tools($this->db), -- cgit v1.2.1 From c17f8a5d373e103fd397766358e3ff7fc3891192 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:15:22 -0400 Subject: [feature/auth-refactor] Test that acp_board excludes invalid providers PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/acp_board/select_auth_method_test.php (limited to 'tests') diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php new file mode 100644 index 0000000000..f81cf19db3 --- /dev/null +++ b/tests/acp_board/select_auth_method_test.php @@ -0,0 +1,43 @@ +set('auth.provider_collection', array( + 'auth.provider.acp_board_valid' => new phpbb_auth_provider_acp_board_valid, + 'auth.provider.acp_board_invalid' => new phpbb_auth_provider_acp_board_invalid, + ) + ); + + $acp_board = new acp_board(); + + $expected = ''; + $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_valid')); + } +} + +class phpbb_auth_provider_acp_board_valid extends phpbb_auth_provider_base +{ + public function login($username, $password) + { + return; + } +} + +class phpbb_auth_provider_acp_board_invalid +{ + +} -- cgit v1.2.1 From 0fbf8f8c81e2ec3eddda58498c52812cf8e4a419 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:21:50 -0400 Subject: [feature/auth-refactor] Move test classes into separate directory PHPBB3-9734 --- tests/acp_board/auth_provider/invalid.php | 13 +++++++++++++ tests/acp_board/auth_provider/valid.php | 16 ++++++++++++++++ tests/acp_board/select_auth_method_test.php | 15 ++------------- 3 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 tests/acp_board/auth_provider/invalid.php create mode 100644 tests/acp_board/auth_provider/valid.php (limited to 'tests') diff --git a/tests/acp_board/auth_provider/invalid.php b/tests/acp_board/auth_provider/invalid.php new file mode 100644 index 0000000000..c12851afe6 --- /dev/null +++ b/tests/acp_board/auth_provider/invalid.php @@ -0,0 +1,13 @@ +assertEquals($expected, $acp_board->select_auth_method('acp_board_valid')); } } - -class phpbb_auth_provider_acp_board_valid extends phpbb_auth_provider_base -{ - public function login($username, $password) - { - return; - } -} - -class phpbb_auth_provider_acp_board_invalid -{ - -} -- cgit v1.2.1 From 8b2ca35b54e1678c443082b8945a393fb5d58e35 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:25:04 -0400 Subject: [feature/auth-refactor] Code style change PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index 922ddda1d6..8453ec6b3b 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -7,9 +7,9 @@ * */ -require_once dirname(__FILE__).'/../../phpBB/includes/acp/acp_board.php'; -require_once dirname(__FILE__).'/auth_provider/invalid.php'; -require_once dirname(__FILE__).'/auth_provider/valid.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_board.php'; +require_once dirname(__FILE__) . '/auth_provider/invalid.php'; +require_once dirname(__FILE__) . '/auth_provider/valid.php'; class phpbb_acp_board_select_auth_method_test extends PHPUnit_Framework_TestCase { -- cgit v1.2.1 From 4bd676e4aedd6bc0737781a61bbc6d8dc0b26809 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:26:39 -0400 Subject: [feature/auth-refactor] Test selecting invalid provider as well PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index 8453ec6b3b..d93522d93a 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -21,12 +21,14 @@ class phpbb_acp_board_select_auth_method_test extends PHPUnit_Framework_TestCase $phpbb_container->set('auth.provider_collection', array( 'auth.provider.acp_board_valid' => new phpbb_auth_provider_acp_board_valid, 'auth.provider.acp_board_invalid' => new phpbb_auth_provider_acp_board_invalid, - ) - ); + )); $acp_board = new acp_board(); $expected = ''; $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_valid')); + + $expected = ''; + $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_invalid')); } } -- cgit v1.2.1 From e5f1e0f98471f5b757c22b85bf38be4d505c4f72 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:35:41 -0400 Subject: [feature/auth-refactor] DataProvider for acp_board test PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index d93522d93a..2172436aa2 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -11,9 +11,20 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_board.php'; require_once dirname(__FILE__) . '/auth_provider/invalid.php'; require_once dirname(__FILE__) . '/auth_provider/valid.php'; -class phpbb_acp_board_select_auth_method_test extends PHPUnit_Framework_TestCase +class phpbb_acp_board_select_auth_method_test extends phpbb_test_case { - public function test_invalid_provider() + public static function function_return() + { + return array( + array('acp_board_valid', ''), + array('acp_board_invalid', ''), + ); + } + + /** + * @dataProvider function_return + */ + public function test_invalid_provider($selected, $expected) { global $phpbb_container; $phpbb_container = new phpbb_mock_container_builder(); @@ -25,10 +36,6 @@ class phpbb_acp_board_select_auth_method_test extends PHPUnit_Framework_TestCase $acp_board = new acp_board(); - $expected = ''; - $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_valid')); - - $expected = ''; - $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_invalid')); + $this->assertEquals($expected, $acp_board->select_auth_method($selected)); } } -- cgit v1.2.1 From 79f0866b781853769c561138bc1a5646a9287b81 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:47:42 -0400 Subject: [feature/auth-refactor] Changes PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index 2172436aa2..34ca013824 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -13,7 +13,9 @@ require_once dirname(__FILE__) . '/auth_provider/valid.php'; class phpbb_acp_board_select_auth_method_test extends phpbb_test_case { - public static function function_return() + protected $acp_board; + + public static function select_auth_method_data() { return array( array('acp_board_valid', ''), @@ -21,10 +23,7 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case ); } - /** - * @dataProvider function_return - */ - public function test_invalid_provider($selected, $expected) + public function setUp() { global $phpbb_container; $phpbb_container = new phpbb_mock_container_builder(); @@ -34,8 +33,14 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case 'auth.provider.acp_board_invalid' => new phpbb_auth_provider_acp_board_invalid, )); - $acp_board = new acp_board(); + $this->acp_board = new acp_board(); + } - $this->assertEquals($expected, $acp_board->select_auth_method($selected)); + /** + * @dataProvider select_auth_method_data + */ + public function test_select_auth_method($selected, $expected) + { + $this->assertEquals($expected, $this->acp_board->select_auth_method($selected)); } } -- cgit v1.2.1 From b9f33e5a872af35128629872b5bb60032d25f932 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 21:57:03 -0400 Subject: [feature/auth-refactor] Add parent::setUp() in setUp() PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index 34ca013824..91aa5d1232 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -25,6 +25,8 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case public function setUp() { + parent::setUp(); + global $phpbb_container; $phpbb_container = new phpbb_mock_container_builder(); -- cgit v1.2.1 From fa8f62a604d5d885f6126619ca1dc3db7b0731a7 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 12 Jul 2013 09:14:36 -0500 Subject: [ticket/11420] Fix tests PHPBB3-11420 --- tests/notification/fixtures/convert.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/notification/fixtures/convert.xml b/tests/notification/fixtures/convert.xml index 98dd5fe0d5..3f0a065cc4 100644 --- a/tests/notification/fixtures/convert.xml +++ b/tests/notification/fixtures/convert.xml @@ -7,6 +7,9 @@ user_notify_type user_notify_pm user_permissions + user_sig + user_occ + user_interests 1 1 @@ -14,6 +17,9 @@ 0 0 + + + 2 @@ -22,6 +28,9 @@ 0 1 + + + 3 @@ -30,6 +39,9 @@ 1 0 + + + 4 @@ -38,6 +50,9 @@ 1 1 + + + 5 @@ -46,6 +61,9 @@ 2 0 + + + 6 @@ -54,6 +72,9 @@ 2 1 + + + -- cgit v1.2.1 From f4b7cbd9766fff3e4232c5514da18c8fc3ff102b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 12 Jul 2013 17:10:18 +0200 Subject: [ticket/11662] Typos: occured -> occurred PHPBB3-11662 --- tests/template/template_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/template/template_test.php b/tests/template/template_test.php index fd68124c89..94ec2ab8a7 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -32,7 +32,7 @@ class phpbb_template_template_test extends phpbb_test_case } catch (Exception $exception) { - // reset the error level even when an error occured + // reset the error level even when an error occurred // PHPUnit turns trigger_error into exceptions as well error_reporting($error_level); ob_end_clean(); -- cgit v1.2.1 From 658b378b6375aec3df9a4f4a576428ba817cdda8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 12 Jul 2013 17:51:29 +0200 Subject: [ticket/11662] Typos: occured -> occurred PHPBB3-11662 --- tests/template/template_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 4a7bf8d168..6d87e5ebc0 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -33,7 +33,7 @@ class phpbb_template_template_test_case extends phpbb_test_case } catch (Exception $exception) { - // reset output buffering even when an error occured + // reset output buffering even when an error occurred // PHPUnit turns trigger_error into exceptions as well ob_end_clean(); throw $exception; -- cgit v1.2.1 From 7e20b711806abf247209ea0211a45a8083f6ad3b Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 12 Jul 2013 11:47:34 -0500 Subject: [ticket/11665] Can't change file names already sent to set_filenames PHPBB3-11665 --- tests/template/template_parser_test.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/template/template_parser_test.php (limited to 'tests') diff --git a/tests/template/template_parser_test.php b/tests/template/template_parser_test.php new file mode 100644 index 0000000000..aa7a9412d6 --- /dev/null +++ b/tests/template/template_parser_test.php @@ -0,0 +1,29 @@ +template->set_filenames(array( + 'basic' => 'basic.html', + )); + + $this->assertEquals("passpasspass", str_replace(array("\n", "\r", "\t"), '', $this->template->assign_display('basic'))); + + $this->template->set_filenames(array( + 'basic' => 'if.html', + )); + + $this->assertEquals("03!false", str_replace(array("\n", "\r", "\t"), '', $this->template->assign_display('basic'))); + } +} -- cgit v1.2.1 From df3f0a212ee55fbcd06f25abed23f9f1d1ca01ae Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 12 Jul 2013 11:22:10 -0500 Subject: [ticket/11664] Stop creating php.html file in root path in tests Also includephp_absolute.html PHPBB3-11664 --- tests/template/includephp_test.php | 2 +- tests/template/template_test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php index a3dc9bd5c5..ff7b890d11 100644 --- a/tests/template/includephp_test.php +++ b/tests/template/includephp_test.php @@ -39,7 +39,7 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case $this->assertTrue(phpbb_is_absolute($path_to_php)); $template_text = "Path is absolute.\n"; - $cache_dir = dirname($phpbb_root_path . 'cache') . '/'; + $cache_dir = $phpbb_root_path . 'cache/'; $fp = fopen($cache_dir . 'includephp_absolute.html', 'w'); fputs($fp, $template_text); fclose($fp); diff --git a/tests/template/template_test.php b/tests/template/template_test.php index fedfeba33a..802f0c19ba 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -403,7 +403,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $template_text = 'echo "test";'; - $cache_dir = dirname($phpbb_root_path . 'cache') . '/'; + $cache_dir = $phpbb_root_path . 'cache/'; $fp = fopen($cache_dir . 'php.html', 'w'); fputs($fp, $template_text); fclose($fp); -- cgit v1.2.1 From 27b550ae66ccc3257eea92a8f7b96e3d9c729a4c Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 12 Jul 2013 12:10:57 -0500 Subject: [ticket/11665] Fix test class name PHPBB3-11665 --- tests/template/template_parser_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/template/template_parser_test.php b/tests/template/template_parser_test.php index aa7a9412d6..c200770adf 100644 --- a/tests/template/template_parser_test.php +++ b/tests/template/template_parser_test.php @@ -10,7 +10,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/template_test_case.php'; -class phpbb_template_template_test extends phpbb_template_template_test_case +class phpbb_template_template_parser_test extends phpbb_template_template_test_case { public function test_set_filenames() { -- cgit v1.2.1 From da8e35ac77c5d78f327d08fa1a9d0ff21ed38e83 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 12 Jul 2013 13:40:30 -0400 Subject: [ticket/11548] Fix incorrect usage of array_map on acp groups page The array_map was only ran on small parts of the actual error array instead of the whole one. This resulted in the output of the language variables' names rather than their actual value. PHPBB3-11548 --- tests/functional/common_groups_test.php | 49 +++++++++++++++++++++++++++++++++ tests/functional/ucp_groups_test.php | 49 --------------------------------- 2 files changed, 49 insertions(+), 49 deletions(-) (limited to 'tests') diff --git a/tests/functional/common_groups_test.php b/tests/functional/common_groups_test.php index 7c88ec900d..427a930cb9 100644 --- a/tests/functional/common_groups_test.php +++ b/tests/functional/common_groups_test.php @@ -14,6 +14,26 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test { abstract protected function get_url(); + // Enable all avatars in the ACP + protected function enable_all_avatars() + { + $this->add_lang('acp/board'); + + $crawler = self::request('GET', 'adm/index.php?i=board&mode=avatar&sid=' . $this->sid); + // Check the default entries we should have + $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text()); + + // Now start setting the needed settings + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['config[allow_avatar_local]']->select(1); + $form['config[allow_avatar_remote]']->select(1); + $form['config[allow_avatar_remote_upload]']->select(1); + $crawler = self::submit($form); + $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text()); + } + public function groups_manage_test_data() { return array( @@ -41,4 +61,33 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test $crawler = self::submit($form); $this->assertContains($this->lang($expected), $crawler->text()); } + + public function group_avatar_min_max_data() + { + return array( + array('uploadurl', 'foo', 'TOO_SHORT'), + array('uploadurl', 'foobar', 'AVATAR_URL_INVALID'), + array('uploadurl', str_repeat('f', 256), 'TOO_LONG'), + array('remotelink', 'foo', 'TOO_SHORT'), + array('remotelink', 'foobar', 'AVATAR_URL_INVALID'), + array('remotelink', str_repeat('f', 256), 'TOO_LONG'), + ); + } + + /** + * @dataProvider group_avatar_min_max_data + */ + public function test_group_avatar_min_max($form_name, $input, $expected) + { + $this->login(); + $this->admin_login(); + $this->add_lang(array('ucp', 'acp/groups')); + $this->enable_all_avatars(); + + $crawler = self::request('GET', $this->get_url() . '&g=5&sid=' . $this->sid); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form[$form_name]->setValue($input); + $crawler = self::submit($form); + $this->assertContains($this->lang($expected), $crawler->text()); + } } diff --git a/tests/functional/ucp_groups_test.php b/tests/functional/ucp_groups_test.php index 0d9ef22798..9c6b1edc5e 100644 --- a/tests/functional/ucp_groups_test.php +++ b/tests/functional/ucp_groups_test.php @@ -18,53 +18,4 @@ class phpbb_functional_ucp_groups_test extends phpbb_functional_common_groups_te { return 'ucp.php?i=groups&mode=manage&action=edit'; } - - // Enable all avatars in the ACP - private function enable_all_avatars() - { - $this->add_lang('acp/board'); - - $crawler = self::request('GET', 'adm/index.php?i=board&mode=avatar&sid=' . $this->sid); - // Check the default entries we should have - $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text()); - - // Now start setting the needed settings - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['config[allow_avatar_local]']->select(1); - $form['config[allow_avatar_remote]']->select(1); - $form['config[allow_avatar_remote_upload]']->select(1); - $crawler = self::submit($form); - $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text()); - } - - public function group_avatar_min_max_data() - { - return array( - array('uploadurl', 'foo', 'TOO_SHORT'), - array('uploadurl', 'foobar', 'AVATAR_URL_INVALID'), - array('uploadurl', str_repeat('f', 256), 'TOO_LONG'), - array('remotelink', 'foo', 'TOO_SHORT'), - array('remotelink', 'foobar', 'AVATAR_URL_INVALID'), - array('remotelink', str_repeat('f', 256), 'TOO_LONG'), - ); - } - - /** - * @dataProvider group_avatar_min_max_data - */ - public function test_group_avatar_min_max($form_name, $input, $expected) - { - $this->login(); - $this->admin_login(); - $this->add_lang(array('ucp', 'acp/groups')); - $this->enable_all_avatars(); - - $crawler = self::request('GET', $this->get_url() . '&g=5&sid=' . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form[$form_name]->setValue($input); - $crawler = self::submit($form); - $this->assertContains($this->lang($expected), $crawler->text()); - } } -- cgit v1.2.1 From 01b9f9f9b6f14d602ce57a37f0969707d1f0c41b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 12 Jul 2013 14:38:18 -0400 Subject: [ticket/11548] Fix test errors in groups test on develop This will fix the errors that appeared in the functional groups test due to the changes in the new avatar system. The patch will make them work again. PHPBB3-11548 --- tests/functional/common_groups_test.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/functional/common_groups_test.php b/tests/functional/common_groups_test.php index f6b447dc90..6c6572af62 100644 --- a/tests/functional/common_groups_test.php +++ b/tests/functional/common_groups_test.php @@ -84,19 +84,19 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test public function group_avatar_min_max_data() { return array( - array('uploadurl', 'foo', 'TOO_SHORT'), - array('uploadurl', 'foobar', 'AVATAR_URL_INVALID'), - array('uploadurl', str_repeat('f', 256), 'TOO_LONG'), - array('remotelink', 'foo', 'TOO_SHORT'), - array('remotelink', 'foobar', 'AVATAR_URL_INVALID'), - array('remotelink', str_repeat('f', 256), 'TOO_LONG'), + array('avatar_driver_upload', 'avatar_upload_url', 'foo', 'AVATAR_URL_INVALID'), + array('avatar_driver_upload', 'avatar_upload_url', 'foobar', 'AVATAR_URL_INVALID'), + array('avatar_driver_upload', 'avatar_upload_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'), + array('avatar_driver_remote', 'avatar_remote_url', 'foo', 'AVATAR_URL_INVALID'), + array('avatar_driver_remote', 'avatar_remote_url', 'foobar', 'AVATAR_URL_INVALID'), + array('avatar_driver_remote', 'avatar_remote_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'), ); } /** * @dataProvider group_avatar_min_max_data */ - public function test_group_avatar_min_max($form_name, $input, $expected) + public function test_group_avatar_min_max($avatar_type, $form_name, $input, $expected) { $this->login(); $this->admin_login(); @@ -105,6 +105,7 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test $crawler = self::request('GET', $this->get_url() . '&g=5&sid=' . $this->sid); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->setValue($avatar_type); $form[$form_name]->setValue($input); $crawler = self::submit($form); $this->assertContains($this->lang($expected), $crawler->text()); -- cgit v1.2.1 From 224aec0f2dc3c14cddabc972f7893395a6fe5cb9 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 12 Jul 2013 13:57:24 -0500 Subject: [ticket/11669] Fix PHP bug #55124 (recursive mkdir on /./) PHPBB3-11669 --- tests/test_framework/phpbb_test_case_helpers.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 50b2bf03ec..3d9cd10f32 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -94,6 +94,9 @@ class phpbb_test_case_helpers public function makedirs($path) { + // PHP bug #55124 (fixed in 5.4.0) + $path = str_replace('/./', '/', $path); + mkdir($path, 0777, true); } -- cgit v1.2.1