From bfe5e0417fce365a773451952f6ad3f38d865c02 Mon Sep 17 00:00:00 2001 From: Meisam Nobari Date: Sun, 21 Jan 2018 17:59:41 +0330 Subject: [PATCH] fix --- acp/usu.php | 16 ++--- styles/all/template/phpbb_seo.js | 2 +- tests/core.php | 59 ------------------ tests/core/drop_sid_test.php | 87 --------------------------- tests/core/format_url_test.php | 45 -------------- tests/core/get_url_info_test_.php | 36 ----------- tests/core/prepare_topic_url_test.php | 57 ------------------ tests/core/prepare_url_test.php | 40 ------------ tests/core/query_string_test.php | 43 ------------- tests/core/set_user_url_test.php | 50 --------------- tests/mock/auth.php | 68 --------------------- tests/mock/cache.php | 35 ----------- tests/mock/request.php | 70 --------------------- tests/mock/user.php | 26 -------- tests/phpbb_seo_test_case.php | 57 ------------------ 15 files changed, 9 insertions(+), 682 deletions(-) delete mode 100644 tests/core.php delete mode 100644 tests/core/drop_sid_test.php delete mode 100644 tests/core/format_url_test.php delete mode 100644 tests/core/get_url_info_test_.php delete mode 100644 tests/core/prepare_topic_url_test.php delete mode 100644 tests/core/prepare_url_test.php delete mode 100644 tests/core/query_string_test.php delete mode 100644 tests/core/set_user_url_test.php delete mode 100644 tests/mock/auth.php delete mode 100644 tests/mock/cache.php delete mode 100644 tests/mock/request.php delete mode 100644 tests/mock/user.php delete mode 100644 tests/phpbb_seo_test_case.php diff --git a/acp/usu.php b/acp/usu.php index 92619f5..0fe16fc 100644 --- a/acp/usu.php +++ b/acp/usu.php @@ -1657,17 +1657,17 @@ function set_phpbb_seo_links() $modrtype_lang['type'] = $modrtype_lang['types'][$this->core->modrtype]; $modrtype_lang['modrlinks_en'] = array( - 1 => 'http://www.phpbb-seo.com/en/simple-seo-url/simple-phpbb-seo-url-t1566.html', - 2 => 'http://www.phpbb-seo.com/en/mixed-seo-url/mixed-phpbb-seo-url-t1565.html', - 3 => 'http://www.phpbb-seo.com/en/advanced-seo-url/advanced-phpbb-seo-url-t1219.html', - 'u' => 'http://www.phpbb-seo.com/en/phpbb-mod-rewrite/ultimate-seo-url-t4608.html', + 1 => 'http://www.phpbb-seo.org/simple-seo-url/simple-phpbb-seo-url-t1566.html', + 2 => 'http://www.phpbb-seo.org/mixed-seo-url/mixed-phpbb-seo-url-t1565.html', + 3 => 'http://www.phpbb-seo.org/advanced-seo-url/advanced-phpbb-seo-url-t1219.html', + 'u' => 'http://www.phpbb-seo.org/phpbb-mod-rewrite/ultimate-seo-url-t4608.html', ); $modrtype_lang['modrforumlinks_en'] = array( - 1 => 'http://www.phpbb-seo.com/en/simple-seo-url/', - 2 => 'http://www.phpbb-seo.com/en/mixed-seo-url/', - 3 => 'http://www.phpbb-seo.com/en/advanced-seo-url/', - 'u' => 'http://www.phpbb-seo.com/en/phpbb-mod-rewrite/', + 1 => 'http://www.phpbb-seo.org/simple-seo-url/', + 2 => 'http://www.phpbb-seo.or/mixed-seo-url/', + 3 => 'http://www.phpbb-seo.org/advanced-seo-url/', + 'u' => 'http://www.phpbb-seo.org/phpbb-mod-rewrite/', ); if (strpos($this->config['default_lang'], 'fr') !== false) diff --git a/styles/all/template/phpbb_seo.js b/styles/all/template/phpbb_seo.js index 81e3aaf..6faf815 100644 --- a/styles/all/template/phpbb_seo.js +++ b/styles/all/template/phpbb_seo.js @@ -2,7 +2,7 @@ * * @package Ultimate phpBB SEO Friendly URL * @version $$ -* @copyright (c) 2006 - 2014 www.phpbb-seo.com +* @copyright (c) 2006 - 2014 www.phpbb-seo.org * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/core.php b/tests/core.php deleted file mode 100644 index 302d347..0000000 --- a/tests/core.php +++ /dev/null @@ -1,59 +0,0 @@ -seo_opt = array( - 'url_rewrite' => true, - 'modrtype' => 3, - 'sql_rewrite' => false, - 'profile_inj' => false, - 'profile_vfolder' => false, - 'profile_noids' => false, - 'rewrite_usermsg' => false, - 'rewrite_files' => false, - 'rem_sid' => false, - 'rem_hilit' => true, - 'rem_small_words' => false, - 'virtual_folder' => true, - 'virtual_root' => false, - 'cache_layer' => true, - 'rem_ids' => false, - 'redirect_404_forum' => false, - 'zero_dupe' => array( - 'on' => true, - 'strict' => true, - 'post_redir' => 'all', - ), - ); - - $this->cache_config['forum_urls'] = array(); - - $this->cache_config['settings'] = & $tc_settings; - $this->cache_config['forum_urls'] = & $tc_forum_urls; - $this->cache_config['cached'] = true; - $this->seo_opt = array_replace_recursive($this->seo_opt, $tc_settings); - $this->modrtype = @isset($this->seo_opt['modrtype']) ? $this->seo_opt['modrtype'] : $this->modrtype; - - if ($this->modrtype > 1) - { - $this->seo_url['forum'] = & $this->cache_config['forum_urls']; - } - } -} diff --git a/tests/core/drop_sid_test.php b/tests/core/drop_sid_test.php deleted file mode 100644 index 8bb7835..0000000 --- a/tests/core/drop_sid_test.php +++ /dev/null @@ -1,87 +0,0 @@ - 'http://www.example.com/path/page.ext?sid=%1$s', - 'expected' => 'http://www.example.com/path/page.ext', - ), - array( - 'case' => 'http://www.example.com/path/page.ext?sid=%1$s&var1=val1&var2=val2', - 'expected' => 'http://www.example.com/path/page.ext?var1=val1&var2=val2', - ), - array( - 'case' => 'http://www.example.com/path/page.ext?var1=val1&var2=val2&sid=%1$s', - 'expected' => 'http://www.example.com/path/page.ext?var1=val1&var2=val2', - ), - array( - 'case' => 'http://www.example.com/path/page.ext?var1=val1&var2=val2&sid=%1$s&var3=val3', - 'expected' => 'http://www.example.com/path/page.ext?var1=val1&var2=val2&var3=val3', - ), - ); - - // generate all sub cases - $data = array(); - - foreach ($base_cases as $test) - { - extract($test); - - // test & if appropriate - $expected_amp = ''; - - if (strpos($case, '&') !== false) - { - $expected_amp = str_replace('&', '&', $expected); - } - - // generate all sid cases - foreach ($sids as $sid) - { - $_case = sprintf($case, $sid); - - $data[] = array( - 'case' => $_case, - 'expected' => $expected, - ); - - // also test & if appropriate - if ($expected_amp) - { - $case_amp = str_replace('&', '&', $_case); - - $data[] = array( - 'case' => $case_amp, - 'expected' => $expected_amp, - ); - } - } - } - - return $data; - } - /** - * @dataProvider drop_sid_test_data - */ - function test_drop_sid($case, $expected) - { - $this->configure(); - $this->assertEquals($expected, $this->phpbb_seo->drop_sid($case)); - } -} diff --git a/tests/core/format_url_test.php b/tests/core/format_url_test.php deleted file mode 100644 index 453d0a6..0000000 --- a/tests/core/format_url_test.php +++ /dev/null @@ -1,45 +0,0 @@ - 'This is a test', - 'expected' => 'this-is-a-test', - ), - array( - 'case' => 'phpBB & SEO', - 'expected' => 'phpbb-seo', - ), - array( - 'case' => '&.-', - 'expected' => 'topic', - ), - array( - 'case' => '&.-', - 'expected' => 'forum', - 'type' => 'forum', - ), - ); - } - - /** - * @dataProvider format_url_test_data - */ - function test_format_url($case, $expected, $type = 'topic') - { - $this->configure(); - $this->assertEquals($expected, $this->phpbb_seo->format_url($case, $type)); - } -} diff --git a/tests/core/get_url_info_test_.php b/tests/core/get_url_info_test_.php deleted file mode 100644 index d5aabb7..0000000 --- a/tests/core/get_url_info_test_.php +++ /dev/null @@ -1,36 +0,0 @@ - 'topic', - 'url' => 'welcome-to-phpbb3', - 'info' => 'title', - 'expected' => array(), - ), - ); - } - - /** - * @dataProvider get_url_info_test_data - */ - function test_get_url_info($type, $url, $info, $expected) - { - //$this->markTestIncomplete('.'); - - $this->configure(); - $this->assertEquals($expected, $this->phpbb_seo->get_url_info($type, $url, $info)); - } -} diff --git a/tests/core/prepare_topic_url_test.php b/tests/core/prepare_topic_url_test.php deleted file mode 100644 index 1533dff..0000000 --- a/tests/core/prepare_topic_url_test.php +++ /dev/null @@ -1,57 +0,0 @@ - array( - 'topic_id' => 1, - 'forum_id' => 1, - 'topic_title' => 'Welcome to phpBB3', - 'topic_type' => POST_NORMAL, - ), - 'expected' => array( - 1 => '/welcome-to-phpbb3-t1', - 2 => '/welcome-phpbb3-t1', - ), - ), - array( - 'topic_data' => array( - 'topic_id' => 23, - 'forum_id' => 43, - 'topic_title' => 'This is a global announcment', - 'topic_type' => POST_GLOBAL, - ), - 'expected' => array( - 1 => 'announces/this-is-a-global-announcment-t23', - 2 => 'announces/this-global-announcment-t23', - ), - ), - ); - } - - /** - * @dataProvider prepare_topic_url_test_data - */ - function test_prepare_topic_url($topic_data, $expected) - { - $this->configure(); - $this->assertEquals($expected[1], $this->phpbb_seo->prepare_topic_url($topic_data)); - - $this->configure(array( - 'rem_small_words' => true, - )); - $this->assertEquals($expected[2], $this->phpbb_seo->prepare_topic_url($topic_data)); - } -} diff --git a/tests/core/prepare_url_test.php b/tests/core/prepare_url_test.php deleted file mode 100644 index 0dc05b8..0000000 --- a/tests/core/prepare_url_test.php +++ /dev/null @@ -1,40 +0,0 @@ - 'topic', - 'title' => 'This is the topic Title', - 'id' => 123, - 'expected' => '/this-is-the-topic-title-t123', - ), - array( - 'type' => 'topic', - 'title' => '', - 'id' => 321, - 'expected' => '/topic-t321', - ), - ); - } - - /** - * @dataProvider prepare_url_test_data - */ - function test_prepare_url($type, $title, $id, $expected) - { - $this->configure(); - $this->assertEquals($expected, $this->phpbb_seo->prepare_url($type, $title, $id)); - } -} diff --git a/tests/core/query_string_test.php b/tests/core/query_string_test.php deleted file mode 100644 index 3331ffc..0000000 --- a/tests/core/query_string_test.php +++ /dev/null @@ -1,43 +0,0 @@ - array( - 'var1' => 'bar', - 'var2' => 'foo', - ), - 'expected' => '?var1=bar&var2=foo', - ), - array( - 'case' => array( - 'var3' => 1, - 'var4' => 'foo', - 'var5' => '', - ), - 'expected' => '?var3=1&var4=foo&var5=', - ), - ); - } - - /** - * @dataProvider query_string_test_data - */ - function test_query_string($case, $expected) - { - $this->configure(); - $this->assertEquals($expected, $this->phpbb_seo->query_string($case)); - } -} diff --git a/tests/core/set_user_url_test.php b/tests/core/set_user_url_test.php deleted file mode 100644 index 08224d2..0000000 --- a/tests/core/set_user_url_test.php +++ /dev/null @@ -1,50 +0,0 @@ - 'bar', - 'user_id' => 1, - 'expected' => array( - 'member1', - 'bar-u1', - 'member/bar', - ), - ), - ); - } - - /** - * @dataProvider set_user_url_test_data - */ - function test_set_user_url($username, $user_id, $expected) - { - $this->configure(); - $this->phpbb_seo->set_user_url($username, $user_id); - $this->assertEquals($expected[0], $this->phpbb_seo->seo_url['user'][$user_id]); - - unset($this->phpbb_seo->seo_url['user'][$user_id]); - - $this->configure(array('profile_inj' => true)); - $this->phpbb_seo->set_user_url($username, $user_id); - $this->assertEquals($expected[1], $this->phpbb_seo->seo_url['user'][$user_id]); - - unset($this->phpbb_seo->seo_url['user'][$user_id]); - - $this->configure(array('profile_inj' => true, 'profile_noids' => true)); - $this->phpbb_seo->set_user_url($username, $user_id); - $this->assertEquals($expected[2], $this->phpbb_seo->seo_url['user'][$user_id]); - } -} diff --git a/tests/mock/auth.php b/tests/mock/auth.php deleted file mode 100644 index a559dce..0000000 --- a/tests/mock/auth.php +++ /dev/null @@ -1,68 +0,0 @@ - 'localhost', - 'server_port' => 80, - 'script_path' => '/', - )); - - $request = new \phpbbseo\usu\tests\mock\request(); - $user = new \phpbbseo\usu\tests\mock\user(); - $auth = new \phpbbseo\usu\tests\mock\auth(); - $cache = new \phpbbseo\usu\tests\mock\cache(); - - return $this->configure(); - } - - protected function configure($settings = array(), $forum_urls = array()) - { - global $phpbb_root_path, $phpEx, $config, $request, $user, $auth, $cache; - global $tc_settings, $tc_forum_urls; - - $tc_settings = array(); - $tc_forum_urls = array(); - - $tc_settings = $settings; - $tc_forum_urls = $forum_urls; - - $this->phpbb_seo = new \phpbbseo\usu\tests\core($config, $request, $user, $auth, $phpbb_root_path, $phpEx); - - return $this->phpbb_seo; - } -}