mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
mark all tests that use session to run as separate processes and not share global state
This commit is contained in:
parent
0d16b33326
commit
ee5f6a5355
@ -19,7 +19,7 @@ ini_set('display_errors', 1);
|
||||
| backtraces along with the other error information. If you would
|
||||
| prefer to not see this, set this value to false.
|
||||
*/
|
||||
defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', true);
|
||||
define('SHOW_DEBUG_BACKTRACE', true);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -30,4 +30,4 @@ defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', true);
|
||||
| release of the framework.
|
||||
*/
|
||||
|
||||
defined('CI_DEBUG') or define('CI_DEBUG', 1);
|
||||
define('CI_DEBUG', 1);
|
||||
|
@ -156,17 +156,29 @@ class CommomFunctionsTest extends \CIUnitTestCase
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testSessionInstance()
|
||||
{
|
||||
$this->assertInstanceOf(CodeIgniter\Session\Session::class, session());
|
||||
}
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testSessionVariable()
|
||||
{
|
||||
$_SESSION['notbogus'] = 'Hi there';
|
||||
$this->assertEquals('Hi there', session('notbogus'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testSessionVariableNotThere()
|
||||
{
|
||||
$_SESSION['bogus'] = 'Hi there';
|
||||
|
@ -129,18 +129,30 @@ class ServicesTest extends \CIUnitTestCase
|
||||
$this->assertInstanceOf(\CodeIgniter\View\Cell::class, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testNewSession()
|
||||
{
|
||||
$actual = Services::session($this->config);
|
||||
$this->assertInstanceOf(\CodeIgniter\Session\Session::class, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testNewSessionWithNullConfig()
|
||||
{
|
||||
$actual = Services::session(null, false);
|
||||
$this->assertInstanceOf(\CodeIgniter\Session\Session::class, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testCallStatic()
|
||||
{
|
||||
// __callStatic should kick in for this but fail
|
||||
|
@ -52,6 +52,10 @@ class RedirectResponseTest extends \CIUnitTestCase
|
||||
$this->assertEquals('http://example.com/foo', $response->getHeaderLine('Location'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testWithInput()
|
||||
{
|
||||
$_SESSION = [];
|
||||
@ -68,6 +72,10 @@ class RedirectResponseTest extends \CIUnitTestCase
|
||||
$this->assertEquals('baz', $_SESSION['_ci_old_input']['post']['bar']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testWithValidationErrors()
|
||||
{
|
||||
$_SESSION = [];
|
||||
@ -85,6 +93,10 @@ class RedirectResponseTest extends \CIUnitTestCase
|
||||
$this->assertArrayHasKey('_ci_validation_errors', $_SESSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testWith()
|
||||
{
|
||||
$_SESSION = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user