Update README.md, consistent use of spaces instead of tabs, better examples
This commit is contained in:
@@ -7,55 +7,55 @@ use Toalett\Multiprocessing\ProcessControl\Fork;
|
||||
|
||||
class ForkTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @param int $pid
|
||||
* @dataProvider positiveIntegerProvider
|
||||
*/
|
||||
public function testItSaysItIsAParentProcessWhenAPositivePidIsProvided(int $pid): void
|
||||
{
|
||||
$fork = new Fork($pid);
|
||||
self::assertTrue($fork->isParent());
|
||||
self::assertFalse($fork->isChild());
|
||||
self::assertFalse($fork->failed());
|
||||
}
|
||||
/**
|
||||
* @param int $pid
|
||||
* @dataProvider positiveIntegerProvider
|
||||
*/
|
||||
public function testItSaysItIsAParentProcessWhenAPositivePidIsProvided(int $pid): void
|
||||
{
|
||||
$fork = new Fork($pid);
|
||||
self::assertTrue($fork->isParent());
|
||||
self::assertFalse($fork->isChild());
|
||||
self::assertFalse($fork->failed());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $pid
|
||||
* @dataProvider negativeIntegerProvider
|
||||
*/
|
||||
public function testItSaysItFailedWhenANegativePidIsProvided(int $pid): void
|
||||
{
|
||||
$fork = new Fork($pid);
|
||||
self::assertTrue($fork->isParent());
|
||||
self::assertFalse($fork->isChild());
|
||||
self::assertTrue($fork->failed());
|
||||
}
|
||||
/**
|
||||
* @param int $pid
|
||||
* @dataProvider negativeIntegerProvider
|
||||
*/
|
||||
public function testItSaysItFailedWhenANegativePidIsProvided(int $pid): void
|
||||
{
|
||||
$fork = new Fork($pid);
|
||||
self::assertTrue($fork->isParent());
|
||||
self::assertFalse($fork->isChild());
|
||||
self::assertTrue($fork->failed());
|
||||
}
|
||||
|
||||
public function testItSaysItIsAChildProcessWhenPidZeroIsProvided(): void
|
||||
{
|
||||
$fork = new Fork(0);
|
||||
self::assertFalse($fork->isParent());
|
||||
self::assertTrue($fork->isChild());
|
||||
self::assertFalse($fork->failed());
|
||||
}
|
||||
public function testItSaysItIsAChildProcessWhenPidZeroIsProvided(): void
|
||||
{
|
||||
$fork = new Fork(0);
|
||||
self::assertFalse($fork->isParent());
|
||||
self::assertTrue($fork->isChild());
|
||||
self::assertFalse($fork->failed());
|
||||
}
|
||||
|
||||
public function positiveIntegerProvider(): array
|
||||
{
|
||||
return [
|
||||
[1],
|
||||
[10],
|
||||
[1000],
|
||||
[PHP_INT_MAX],
|
||||
];
|
||||
}
|
||||
public function positiveIntegerProvider(): array
|
||||
{
|
||||
return [
|
||||
[1],
|
||||
[10],
|
||||
[1000],
|
||||
[PHP_INT_MAX],
|
||||
];
|
||||
}
|
||||
|
||||
public function negativeIntegerProvider(): array
|
||||
{
|
||||
return [
|
||||
[-1],
|
||||
[-10],
|
||||
[-1000],
|
||||
[PHP_INT_MIN],
|
||||
];
|
||||
}
|
||||
public function negativeIntegerProvider(): array
|
||||
{
|
||||
return [
|
||||
[-1],
|
||||
[-10],
|
||||
[-1000],
|
||||
[PHP_INT_MIN],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,45 +7,45 @@ use Toalett\Multiprocessing\ProcessControl\Wait;
|
||||
|
||||
class WaitTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @param int $pid
|
||||
* @dataProvider positiveIntegerProvider
|
||||
*/
|
||||
public function testItSaysAChildStoppedWhenAPositivePidIsProvided(int $pid): void
|
||||
{
|
||||
$wait = new Wait($pid, 0);
|
||||
self::assertTrue($wait->childStopped());
|
||||
self::assertFalse($wait->failed());
|
||||
}
|
||||
/**
|
||||
* @param int $pid
|
||||
* @dataProvider positiveIntegerProvider
|
||||
*/
|
||||
public function testItSaysAChildStoppedWhenAPositivePidIsProvided(int $pid): void
|
||||
{
|
||||
$wait = new Wait($pid, 0);
|
||||
self::assertTrue($wait->childStopped());
|
||||
self::assertFalse($wait->failed());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $pid
|
||||
* @dataProvider negativeIntegerProvider
|
||||
*/
|
||||
public function testItSaysItFailedWhenANegativePidIsProvided(int $pid): void
|
||||
{
|
||||
$wait = new Wait($pid, 0);
|
||||
self::assertFalse($wait->childStopped());
|
||||
self::assertTrue($wait->failed());
|
||||
}
|
||||
/**
|
||||
* @param int $pid
|
||||
* @dataProvider negativeIntegerProvider
|
||||
*/
|
||||
public function testItSaysItFailedWhenANegativePidIsProvided(int $pid): void
|
||||
{
|
||||
$wait = new Wait($pid, 0);
|
||||
self::assertFalse($wait->childStopped());
|
||||
self::assertTrue($wait->failed());
|
||||
}
|
||||
|
||||
public function positiveIntegerProvider(): array
|
||||
{
|
||||
return [
|
||||
[1],
|
||||
[10],
|
||||
[1000],
|
||||
[PHP_INT_MAX],
|
||||
];
|
||||
}
|
||||
public function positiveIntegerProvider(): array
|
||||
{
|
||||
return [
|
||||
[1],
|
||||
[10],
|
||||
[1000],
|
||||
[PHP_INT_MAX],
|
||||
];
|
||||
}
|
||||
|
||||
public function negativeIntegerProvider(): array
|
||||
{
|
||||
return [
|
||||
[-1],
|
||||
[-10],
|
||||
[-1000],
|
||||
[PHP_INT_MIN],
|
||||
];
|
||||
}
|
||||
public function negativeIntegerProvider(): array
|
||||
{
|
||||
return [
|
||||
[-1],
|
||||
[-10],
|
||||
[-1000],
|
||||
[PHP_INT_MIN],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user