Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pjsde committed Sep 28, 2023
1 parent 49fd2c1 commit 7920f52
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/system/CodeIgniterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
use Tests\Support\Filters\Customfilter;

/**
* @runTestsInSeparateProcesses
*
* @backupGlobals enabled
*
* @internal
Expand Down
10 changes: 8 additions & 2 deletions tests/system/Helpers/URLHelper/MiscUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ protected function tearDown(): void
$_SERVER = [];
}

/**
* @runInSeparateProcess
*/
public function testPreviousURLUsesSessionFirst(): void
{
$uri1 = 'http://example.com/one?two';
$uri2 = 'http://example.com/two?foo';

$_SERVER['HTTP_REFERER'] = $uri1;
$_SESSION['_ci_previous_url'] = $uri2;
$_SERVER['HTTP_REFERER'] = $uri1;
session()->set('_ci_previous_url', $uri2);

$this->config->baseURL = 'http://example.com/public';

Expand All @@ -80,6 +83,9 @@ private function createRequest(string $uri): void
Factories::injectMock('config', 'App', $this->config);
}

/**
* @runInSeparateProcess
*/
public function testPreviousURLUsesRefererIfNeeded(): void
{
$uri1 = 'http://example.com/one?two';
Expand Down
5 changes: 4 additions & 1 deletion tests/system/View/ParserPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ public function testCurrentURL(): void
$this->assertSame(current_url(), $this->parser->renderString($template));
}

/**
* @runInSeparateProcess
*/
public function testPreviousURL(): void
{
$template = '{+ previous_url +}';

// Ensure a previous URL exists to work with.
$_SESSION['_ci_previous_url'] = 'http://example.com/foo';
session()->set('_ci_previous_url', 'http://example.com/foo');

$this->assertSame(previous_url(), $this->parser->renderString($template));
}
Expand Down

0 comments on commit 7920f52

Please sign in to comment.