Passed
Pull Request — master (#10)
by Alice
02:01
created

EventPoolFactoryTest::test_create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 13
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace Wonderland\Thread\Tests\Factory;
4
5
use PHPUnit\Framework\TestCase;
6
use Wonderland\Thread\Event\PoolEvent;
7
use Wonderland\Thread\Factory\EventPoolFactory;
8
use Wonderland\Thread\Factory\ThreadFactory;
0 ignored issues
show
Bug introduced by
The type Wonderland\Thread\Factory\ThreadFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Wonderland\Thread\AbstractThread;
10
use Wonderland\Thread\Tests\Implementation\SuccessThread;
11
use Wonderland\Thread\ThreadPool;
12
13
/**
14
 * Class ThreadFactoryTest
15
 * @package Wonderland\Thread\Tests\Factory
16
 * @author Alice Praud <[email protected]>
17
 */
18
class EventPoolFactoryTest extends TestCase
19
{
20
21
	public function test_create()
22
	{
23
		$pool = new ThreadPool();
24
		$thread = new SuccessThread('unit-test');
25
		$event = new PoolEvent('unit-test');
26
		$factoryEvent = EventPoolFactory::create('unit-test', $pool, $thread);
27
28
		$this->assertSame($event->getEventName(), $factoryEvent->getEventName());
29
		$this->assertSame($event->getThreadLeftNb(), $factoryEvent->getThreadLeftNb());
30
		$this->assertSame($event->getMaxRunningThreadNb(), $factoryEvent->getMaxRunningThreadNb());
31
		$this->assertSame($event->getRunningThreadNb(), $factoryEvent->getRunningThreadNb());
32
		$this->assertSame($event->getThreadDoneNb(), $factoryEvent->getThreadDoneNb());
33
		$this->assertSame($event->getThreadNb(), $factoryEvent->getThreadNb());
34
	}
35
36
}
37