Skip to content

Commit fc08c0a

Browse files
committed
testing @runInSeparateProcess
1 parent d2e60ba commit fc08c0a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/ProcessIsolationTest.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace phpmock\mockery;
4+
5+
/**
6+
* Tests process isolation.
7+
*
8+
* @author Markus Malkusch <[email protected]>
9+
* @link bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK Donations
10+
* @license http://www.wtfpl.net/txt/copying/ WTFPL
11+
*/
12+
class ProcessIsolationTest extends \PHPUnit_Framework_TestCase
13+
{
14+
15+
public static function setUpBeforeClass()
16+
{
17+
// e.g. the autoloader of nikic/php-parser does that.
18+
ini_set('unserialize_callback_func', 'spl_autoload_call');
19+
}
20+
21+
protected function tearDown()
22+
{
23+
parent::tearDown();
24+
25+
\Mockery::close();
26+
}
27+
28+
/**
29+
* Tests deserialization.
30+
*
31+
* @test
32+
* @runInSeparateProcess
33+
*/
34+
public function testDeserializationInNewProcess()
35+
{
36+
PHPMockery::mock(__NAMESPACE__, "time")->andReturn(123);
37+
$this->assertEquals(123, time());
38+
}
39+
}

0 commit comments

Comments
 (0)