mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 15:34:12 +01:00
N°6658 - Boost PHPUnit tests execution
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest;
|
||||
|
||||
/**
|
||||
* Shows that
|
||||
* 1) the option runClassInSeparateProcess is equivalent to runTestsInSeparateProcesses
|
||||
* 2) setUpBeforeClass is called within each spawned process (the main one, then in eventuel subprocesses)
|
||||
* 3) setUp behaves as expected, i.e. called one within the same process as the test itself
|
||||
*
|
||||
* @preserveGlobalState disabled
|
||||
* @runClassInSeparateProcess
|
||||
*/
|
||||
class runClassInSeparateProcessTest extends ItopDataTestCase
|
||||
{
|
||||
static public function setUpBeforeClass(): void
|
||||
{
|
||||
parent::setUpBeforeClass(); // TODO: Change the autogenerated stub
|
||||
|
||||
file_put_contents(
|
||||
dirname(__FILE__).'/pid.txt',
|
||||
getmypid().';'.static::class.';'.__METHOD__."\n",
|
||||
FILE_APPEND);
|
||||
}
|
||||
|
||||
protected function LogPid()
|
||||
{
|
||||
file_put_contents(
|
||||
dirname(__FILE__).'/pid.txt',
|
||||
getmypid().';'.static::class.';'.$this->getName()."\n",
|
||||
FILE_APPEND);
|
||||
}
|
||||
|
||||
function testA()
|
||||
{
|
||||
$this->LogPid();
|
||||
static::assertTrue(true);
|
||||
}
|
||||
|
||||
function testB()
|
||||
{
|
||||
$this->LogPid();
|
||||
static::assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider CProvider
|
||||
*/
|
||||
function testC($i)
|
||||
{
|
||||
$this->LogPid();
|
||||
static::assertTrue(true);
|
||||
}
|
||||
|
||||
function CProvider()
|
||||
{
|
||||
return [
|
||||
[1],
|
||||
[1],
|
||||
[1],
|
||||
[1],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user