Skip to content

Commit

Permalink
[#272] Update provider to show old and new results
Browse files Browse the repository at this point in the history
  • Loading branch information
Fragonite committed Sep 5, 2023
1 parent 588a52d commit dcc74e5
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions tests/tool_excimer_script_metadata_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,16 @@ public function sampling_limit_provider(): array {
* @dataProvider normalised_relative_script_path_provider
* @covers \tool_excimer\script_metadata::get_request
*/
public function test_get_request(string $pathinfo, string $expected) {
public function test_get_request(string $path, string $oldexpected, string $newexpected) {
script_metadata::init();

global $SCRIPT, $ME;
$globalscript = $SCRIPT ?? null;
$globalme = $ME ?? null;

$SCRIPT = $pathinfo;
$ME = $pathinfo;
$this->assertEquals($expected, script_metadata::get_request());
$SCRIPT = $path;
$ME = $path;
$this->assertEquals($oldexpected, script_metadata::get_request());

$SCRIPT = $globalscript;
$ME = $globalme;
Expand All @@ -216,10 +216,10 @@ public function test_get_request(string $pathinfo, string $expected) {
* @param string $pathinfo
* @param string $expected
*/
public function test_get_normalised_relative_script_path(string $pathinfo, string $expected) {
public function test_get_normalised_relative_script_path(string $path, string $oldexpected, string $newexpected) {
script_metadata::init();
// $this->assertEquals($expected, script_metadata::get_normalised_relative_script_path($pathinfo, null));
$this->assertEquals($expected, script_metadata::get_normalised_relative_script_path(null, $pathinfo));
$this->assertEquals($newexpected, script_metadata::get_normalised_relative_script_path($path, null));
$this->assertEquals($newexpected, script_metadata::get_normalised_relative_script_path(null, $path));
}

/**
Expand All @@ -228,28 +228,28 @@ public function test_get_normalised_relative_script_path(string $pathinfo, strin
*/
public function normalised_relative_script_path_provider(): array {
return [
['', '/'],
['/', '/'],
['//', '/'],
['///', '/'],
['home', 'home'],
['/home', 'home'],
['home/', 'home'],
['/home/', 'home'],
['hello/world', 'hello/world'],
['/hello/world', 'hello/world'],
['/hello/world/', 'hello/world'],
['/////hello////world///', 'hello/world'],
['/////hello////world/index.php', 'hello/world'],
['/////hello////world///index.php', 'hello/world'],
['/////hello////world/index.php///', 'hello/world'],
['/index.php', '/'],
['/my//index.php////', 'my'],
['/my//index.php////index.php', 'my'],
['/my//index.php////index.php/', 'my'],
['/my//index.php////index.php/hello/world?param=value&param2=value', 'my'],
['https://example.com//index.php', 'https:/example.com'],
['https://example.com/index.php/', 'https:/example.com'],
['', '', '/'],
['/', '', '/'],
['//', '', '/'],
['///', '', '/'],
['home', 'home', 'home'],
['/home', 'home', 'home'],
['home/', 'home/', 'home'],
['/home/', 'home/', 'home'],
['hello/world', 'hello/world', 'hello/world'],
['/hello/world', 'hello/world', 'hello/world'],
['/hello/world/', 'hello/world/', 'hello/world'],
['/////hello////world///', 'hello////world///', 'hello/world'],
['/////hello////world/index.php', 'hello////world/index.php', 'hello/world'],
['/////hello////world///index.php', 'hello////world///index.php', 'hello/world'],
['/////hello////world/index.php///', 'hello////world/index.php', 'hello/world'],
['/index.php', 'index.php', '/'],
['/my//index.php////', 'my//index.php', 'my'],
['/my//index.php////index.php', 'my//index.php', 'my'],
['/my//index.php////index.php/', 'my//index.php', 'my'],
['/my//index.php////index.php/hello/world?param=value&param2=value', 'my//index.php', 'my'],
['https://example.com//index.php', 'https://example.com//index.php', 'https:/example.com'],
['https://example.com/index.php/', 'https://example.com/index.php', 'https:/example.com'],
];
}

Expand Down

0 comments on commit dcc74e5

Please sign in to comment.