Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauricio@fauth.dev>2022-08-06 21:02:49 +0300
committerMaurício Meneghini Fauth <mauricio@fauth.dev>2022-08-06 21:02:49 +0300
commit75cf045fa3ec32d2a82b086d5516315b8fc38afe (patch)
tree1c54d81edc312230d357b01c78d85a64d43a6a47 /test
parent31511720730dba86476f7fff3fb2c3ef443c17f7 (diff)
Extract url.php entry point into a route
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r--test/classes/Advisory/AdvisorTest.php12
-rw-r--r--test/classes/Config/FormDisplayTest.php3
-rw-r--r--test/classes/CoreTest.php6
-rw-r--r--test/classes/Html/GeneratorTest.php17
-rw-r--r--test/classes/Html/MySQLDocumentationTest.php2
-rw-r--r--test/classes/MessageTest.php10
-rw-r--r--test/classes/Plugins/Auth/AuthenticationConfigTest.php2
-rw-r--r--test/classes/SanitizeTest.php10
8 files changed, 32 insertions, 30 deletions
diff --git a/test/classes/Advisory/AdvisorTest.php b/test/classes/Advisory/AdvisorTest.php
index 468f425c51..25f849be6a 100644
--- a/test/classes/Advisory/AdvisorTest.php
+++ b/test/classes/Advisory/AdvisorTest.php
@@ -227,7 +227,7 @@ class AdvisorTest extends AbstractTestCase
'justification_formula' => 'value',
'name' => 'Distribution',
'issue' => 'official MySQL binaries.',
- 'recommendation' => 'See <a href="./url.php?url=https%3A%2F%2F' .
+ 'recommendation' => 'See <a href="index.php?route=/url&url=https%3A%2F%2F' .
'example.com%2F" target="_blank" rel="noopener noreferrer">web</a>',
'id' => 'Distribution',
],
@@ -247,7 +247,7 @@ class AdvisorTest extends AbstractTestCase
'justification_formula' => 'ADVISOR_timespanFormat(1377027)',
'name' => 'Distribution',
'issue' => 'official MySQL binaries.',
- 'recommendation' => 'See <a href="./url.php?url=https%3A%2F%2F' .
+ 'recommendation' => 'See <a href="index.php?route=/url&url=https%3A%2F%2F' .
'example.com%2F" target="_blank" rel="noopener noreferrer">web</a>',
'id' => 'Distribution',
],
@@ -268,9 +268,9 @@ class AdvisorTest extends AbstractTestCase
'justification_formula' => 'ADVISOR_formatByteDown(1000000, 2, 2)',
'name' => 'Distribution',
'issue' => 'official MySQL binaries.',
- 'recommendation' => 'See <a href="./url.php?url=https%3A%2F%2F'
+ 'recommendation' => 'See <a href="index.php?route=/url&url=https%3A%2F%2F'
. 'example.com%2F" target="_blank" rel="noopener noreferrer">web</a>'
- . ' and <a href="./url.php?url=https%3A%2F%2Fexample.com%2F" target="_blank"'
+ . ' and <a href="index.php?route=/url&url=https%3A%2F%2Fexample.com%2F" target="_blank"'
. ' rel="noopener noreferrer">web2</a>',
'id' => 'Distribution',
],
@@ -292,9 +292,9 @@ class AdvisorTest extends AbstractTestCase
'name' => 'Distribution',
'issue' => '<a href="index.php?route=/server/variables&filter=long_query_time&lang=en">'
. 'long_query_time</a> is set to 10 seconds or more',
- 'recommendation' => 'See <a href="./url.php?url=https%3A%2F%2F'
+ 'recommendation' => 'See <a href="index.php?route=/url&url=https%3A%2F%2F'
. 'example.com%2F" target="_blank" rel="noopener noreferrer">web</a>'
- . ' and <a href="./url.php?url=https%3A%2F%2Fexample.com%2F" target="_blank"'
+ . ' and <a href="index.php?route=/url&url=https%3A%2F%2Fexample.com%2F" target="_blank"'
. ' rel="noopener noreferrer">web2</a>',
'id' => 'Distribution',
],
diff --git a/test/classes/Config/FormDisplayTest.php b/test/classes/Config/FormDisplayTest.php
index 7c0e4b2442..e89974f994 100644
--- a/test/classes/Config/FormDisplayTest.php
+++ b/test/classes/Config/FormDisplayTest.php
@@ -312,7 +312,8 @@ class FormDisplayTest extends AbstractTestCase
public function testGetDocLink(): void
{
$this->assertEquals(
- './url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fconfig.html%23cfg_Servers_3_test_2_',
+ 'index.php?route=/url&url='
+ . 'https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fconfig.html%23cfg_Servers_3_test_2_',
$this->object->getDocLink('Servers/3/test/2/')
);
diff --git a/test/classes/CoreTest.php b/test/classes/CoreTest.php
index e0bcd4531e..d61c6533df 100644
--- a/test/classes/CoreTest.php
+++ b/test/classes/CoreTest.php
@@ -484,7 +484,7 @@ class CoreTest extends AbstractNetworkTestCase
$lang = _pgettext('PHP documentation language', 'en');
$this->assertEquals(
Core::getPHPDocLink('function'),
- './url.php?url=https%3A%2F%2Fwww.php.net%2Fmanual%2F'
+ 'index.php?route=/url&url=https%3A%2F%2Fwww.php.net%2Fmanual%2F'
. $lang . '%2Ffunction'
);
}
@@ -512,11 +512,11 @@ class CoreTest extends AbstractNetworkTestCase
return [
[
'https://wiki.phpmyadmin.net',
- './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net',
+ 'index.php?route=/url&url=https%3A%2F%2Fwiki.phpmyadmin.net',
],
[
'https://wiki.phpmyadmin.net',
- './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net',
+ 'index.php?route=/url&url=https%3A%2F%2Fwiki.phpmyadmin.net',
],
[
'wiki.phpmyadmin.net',
diff --git a/test/classes/Html/GeneratorTest.php b/test/classes/Html/GeneratorTest.php
index d05fc57571..39f3ee6b8a 100644
--- a/test/classes/Html/GeneratorTest.php
+++ b/test/classes/Html/GeneratorTest.php
@@ -177,7 +177,7 @@ class GeneratorTest extends AbstractTestCase
$target = 'docu';
$lang = _pgettext('PHP documentation language', 'en');
- $expected = '<a href="./url.php?url=https%3A%2F%2Fwww.php.net%2Fmanual%2F' . $lang
+ $expected = '<a href="index.php?route=/url&url=https%3A%2F%2Fwww.php.net%2Fmanual%2F' . $lang
. '%2F' . $target . '" target="documentation">'
. '<img src="themes/dot.gif" title="' . __('Documentation') . '" alt="'
. __('Documentation') . '" class="icon ic_b_help"></a>';
@@ -282,14 +282,15 @@ class GeneratorTest extends AbstractTestCase
],
[
[
- 'url.php?url=http://phpmyadmin.net/',
+ 'index.php?route=/url&url=http://phpmyadmin.net/',
null,
'text',
[],
'_blank',
],
1000,
- '<a href="url.php?url=http://phpmyadmin.net/" target="_blank" rel="noopener noreferrer">text</a>',
+ '<a href="index.php?route=/url&url=http://phpmyadmin.net/" target="_blank"'
+ . ' rel="noopener noreferrer">text</a>',
],
[
[
@@ -355,12 +356,12 @@ class GeneratorTest extends AbstractTestCase
public function testGetServerSSL(): void
{
$sslNotUsed = '<span class="">SSL is not being used</span>'
- . ' <a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
+ . ' <a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
. ' target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation"'
. ' class="icon ic_b_help"></a>';
$sslNotUsedCaution = '<span class="text-danger">SSL is not being used</span>'
- . ' <a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
+ . ' <a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
. ' target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation"'
. ' class="icon ic_b_help"></a>';
@@ -414,7 +415,7 @@ class GeneratorTest extends AbstractTestCase
$this->assertEquals(
'<span class="text-danger">SSL is used with disabled verification</span>'
- . ' <a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
+ . ' <a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
. ' target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation"'
. ' class="icon ic_b_help"></a>',
Generator::getServerSSL()
@@ -428,7 +429,7 @@ class GeneratorTest extends AbstractTestCase
$this->assertEquals(
'<span class="text-danger">SSL is used without certification authority</span>'
- . ' <a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
+ . ' <a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
. ' target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation"'
. ' class="icon ic_b_help"></a>',
Generator::getServerSSL()
@@ -443,7 +444,7 @@ class GeneratorTest extends AbstractTestCase
$this->assertEquals(
'<span class="">SSL is used</span>'
- . ' <a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
+ . ' <a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2Fsetup.html%23ssl"'
. ' target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation"'
. ' class="icon ic_b_help"></a>',
Generator::getServerSSL()
diff --git a/test/classes/Html/MySQLDocumentationTest.php b/test/classes/Html/MySQLDocumentationTest.php
index 9057667c5c..7e84e66501 100644
--- a/test/classes/Html/MySQLDocumentationTest.php
+++ b/test/classes/Html/MySQLDocumentationTest.php
@@ -18,7 +18,7 @@ class MySQLDocumentationTest extends AbstractTestCase
$GLOBALS['cfg']['ServerDefault'] = 1;
$this->assertEquals(
- '<a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen'
+ '<a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen'
. '%2Flatest%2Fpage.html%23anchor" target="documentation"><img src="themes/dot.gif"'
. ' title="Documentation" alt="Documentation" class="icon ic_b_help"></a>',
MySQLDocumentation::showDocumentation('page', 'anchor')
diff --git a/test/classes/MessageTest.php b/test/classes/MessageTest.php
index d9b9b9f7ed..d3073e6278 100644
--- a/test/classes/MessageTest.php
+++ b/test/classes/MessageTest.php
@@ -352,7 +352,7 @@ class MessageTest extends AbstractTestCase
],
[
'[a@https://example.com/@Documentation]link[/a]',
- '<a href="./url.php?url=https%3A%2F%2Fexample.com%2F" target="Documentation">link</a>',
+ '<a href="index.php?route=/url&url=https%3A%2F%2Fexample.com%2F" target="Documentation">link</a>',
],
[
'[a@./non-existing@Documentation]link[/a]',
@@ -360,19 +360,19 @@ class MessageTest extends AbstractTestCase
],
[
'[doc@foo]link[/doc]',
- '<a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2F'
+ '<a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2F'
. 'latest%2Fsetup.html%23foo" '
. 'target="documentation">link</a>',
],
[
'[doc@page@anchor]link[/doc]',
- '<a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2F'
+ '<a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2F'
. 'latest%2Fpage.html%23anchor" '
. 'target="documentation">link</a>',
],
[
'[doc@faqmysql]link[/doc]',
- '<a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2F'
+ '<a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2F'
. 'latest%2Ffaq.html%23faqmysql" '
. 'target="documentation">link</a>',
],
@@ -463,7 +463,7 @@ class MessageTest extends AbstractTestCase
{
$this->object->setMessage('[kbd]test[/kbd] [doc@cfg_Example]test[/doc]');
$this->assertEquals(
- '<kbd>test</kbd> <a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.'
+ '<kbd>test</kbd> <a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.'
. 'net%2Fen%2Flatest%2Fconfig.html%23cfg_Example"'
. ' target="documentation">test</a>',
$this->object->getMessage()
diff --git a/test/classes/Plugins/Auth/AuthenticationConfigTest.php b/test/classes/Plugins/Auth/AuthenticationConfigTest.php
index 833351b9ea..6187b54850 100644
--- a/test/classes/Plugins/Auth/AuthenticationConfigTest.php
+++ b/test/classes/Plugins/Auth/AuthenticationConfigTest.php
@@ -97,7 +97,7 @@ class AuthenticationConfigTest extends AbstractTestCase
);
$this->assertStringContainsString(
- '<strong>MySQL said: </strong><a href="./url.php?url=https%3A%2F%2F' .
+ '<strong>MySQL said: </strong><a href="index.php?route=/url&url=https%3A%2F%2F' .
'dev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Fserver-error-reference.html"' .
' target="mysql_doc">' .
'<img src="themes/dot.gif" title="Documentation" alt="Documentation" ' .
diff --git a/test/classes/SanitizeTest.php b/test/classes/SanitizeTest.php
index 8242733b7b..3c4fe6b5a5 100644
--- a/test/classes/SanitizeTest.php
+++ b/test/classes/SanitizeTest.php
@@ -42,7 +42,7 @@ class SanitizeTest extends AbstractTestCase
unset($GLOBALS['server']);
unset($GLOBALS['lang']);
$this->assertEquals(
- '<a href="./url.php?url=https%3A%2F%2Fwww.phpmyadmin.net%2F" target="target">link</a>',
+ '<a href="index.php?route=/url&url=https%3A%2F%2Fwww.phpmyadmin.net%2F" target="target">link</a>',
Sanitize::sanitizeMessage('[a@https://www.phpmyadmin.net/@target]link[/a]')
);
@@ -60,7 +60,7 @@ class SanitizeTest extends AbstractTestCase
public function testDoc(string $link, string $expected): void
{
$this->assertEquals(
- '<a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2F'
+ '<a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2Flatest%2F'
. $expected . '" target="documentation">doclink</a>',
Sanitize::sanitizeMessage('[doc@' . $link . ']doclink[/doc]')
);
@@ -121,7 +121,7 @@ class SanitizeTest extends AbstractTestCase
public function testLinkAndXssInHref(): void
{
$this->assertEquals(
- '<a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2F">doc</a>'
+ '<a href="index.php?route=/url&url=https%3A%2F%2Fdocs.phpmyadmin.net%2F">doc</a>'
. '[a@javascript:alert(\'XSS\');@target]link</a>',
Sanitize::sanitizeMessage(
'[a@https://docs.phpmyadmin.net/]doc[/a][a@javascript:alert(\'XSS\');@target]link[/a]'
@@ -402,13 +402,13 @@ class SanitizeTest extends AbstractTestCase
],
[
false,
- './url.php?url=https://example.com',
+ 'index.php?route=/url&url=https://example.com',
false,
false,
],
[
true,
- './url.php?url=https%3a%2f%2fexample.com',
+ 'index.php?route=/url&url=https%3a%2f%2fexample.com',
false,
false,
],