Skip to content

Commit

Permalink
Run these tests in separate processes.
Browse files Browse the repository at this point in the history
This should hopefully fix behaviour change in PHP 7.2 which broke unit tests.
  • Loading branch information
yunosh committed Nov 14, 2017
1 parent dcd9fec commit d1a72d2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Expand Up @@ -10,4 +10,4 @@ colors="true">
<directory suffix=".php">lib</directory>
</whitelist>
</filter>
</phpunit>
</phpunit>
35 changes: 24 additions & 11 deletions test/Horde/SessionHandler/Storage/BuiltinTest.php
Expand Up @@ -15,29 +15,29 @@
*/
class Horde_SessionHandler_Storage_BuiltinTest extends Horde_SessionHandler_Storage_Base
{
/**
* @runInSeparateProcess
*/
public function testWrite()
{
session_name('sessionname');
session_id('sessionid');
session_start();
$this->assertEmpty($_SESSION);
$_SESSION['sessiondata'] = 'foo';
session_write_close();
$this->_write();
}

/**
* @depends testWrite
* @runInSeparateProcess
*/
public function testRead()
{
$this->_write();
$this->assertEquals('sessiondata|s:3:"foo";', self::$handler->read('sessionid'));
}

/**
* @depends testWrite
* @runInSeparateProcess
*/
public function testReopen()
{
$this->_write();
session_write_close();
session_name('sessionname');
session_id('sessionid');
Expand All @@ -47,10 +47,11 @@ public function testReopen()
}

/**
* @depends testWrite
* @runInSeparateProcess
*/
public function testList()
{
$this->_write();
session_write_close();
session_name('sessionname');
session_id('sessionid2');
Expand All @@ -69,10 +70,11 @@ public function testList()
}

/**
* @depends testList
* @runInSeparateProcess
*/
public function testDestroy()
{
$this->testList();
session_name('sessionname');
session_id('sessionid2');
session_start();
Expand All @@ -86,10 +88,11 @@ public function testDestroy()
}

/**
* @depends testDestroy
* @runInSeparateProcess
*/
public function testGc()
{
$this->testDestroy();
$this->probability = ini_get('session.gc_probability');
$this->divisor = ini_get('session.gc_divisor');
$this->maxlifetime = ini_get('session.gc_maxlifetime');
Expand All @@ -102,6 +105,16 @@ public function testGc()
self::$handler->getSessionIDs());
}

protected function _write()
{
session_name('sessionname');
session_id('sessionid');
session_start();
$this->assertEmpty($_SESSION);
$_SESSION['sessiondata'] = 'foo';
session_write_close();
}

public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
Expand Down

0 comments on commit d1a72d2

Please sign in to comment.