Passed
Push — master ( dc7112...00c568 )
by Alice
02:07
created
src/Event/Event.php 1 patch
Indentation   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -7,186 +7,186 @@
 block discarded – undo
7 7
 
8 8
 class Event implements EventInterface
9 9
 {
10
-	const POOL_RUN_START = 'run_start';
11
-	const POOL_RUN_STOP = 'run_stop';
12
-	const POOL_NEW_THREAD = 'new_thread';
13
-	const POOL_PRE_WAIT_TICK = 'pre_wait_tick';
14
-	const POOL_POST_WAIT_TICK = 'post_wait_tick';
15
-	const POOL_WAIT_TICK_PID = 'wait_tick_pid';
16
-	const POOL_WAIT_TICK_PID_REMOVED = 'wait_tick_pid_removed';
17
-
18
-	const THREAD_PRE_PROCESS = 'pre_process';
19
-	const THREAD_POST_PROCESS = 'post_process';
20
-	const THREAD_EXIT_SUCCESS = 'exist_success';
21
-	const THREAD_EXIT_ERROR = 'exit_error';
22
-	const THREAD_EXIT_UNKNOWN = 'exit_unknown';
23
-
24
-	/** @var string $eventName */
25
-	private $eventName;
26
-
27
-	/** @var int $threadNb */
28
-	private $threadNb;
29
-
30
-	/** @var int $runningThreadNb */
31
-	private $runningThreadNb;
32
-
33
-	/** @var int $threadDoneNb */
34
-	private $threadDoneNb;
35
-
36
-	/** @var int $threadLeftNb */
37
-	private $threadLeftNb;
38
-
39
-	/** @var int $maxRunningThreadNb */
40
-	private $maxRunningThreadNb;
41
-
42
-	/** @var Thread $thread */
43
-	private $thread;
44
-
45
-	/**
46
-	 * ThreadPoolEvent constructor.
47
-	 * @param string $eventName
48
-	 */
49
-	public function __construct($eventName)
50
-	{
51
-		$this->eventName = $eventName;
52
-		$this->threadNb = 0;
53
-		$this->runningThreadNb = 0;
54
-		$this->threadDoneNb = 0;
55
-		$this->threadLeftNb = 0;
56
-		$this->maxRunningThreadNb = 0;
57
-	}
58
-
59
-	/**
60
-	 * @return string
61
-	 */
62
-	public function getEventName(): string
63
-	{
64
-		return $this->eventName;
65
-	}
66
-
67
-	/**
68
-	 * @param string $eventName
69
-	 * @return Event
70
-	 */
71
-	public function setEventName(string $eventName): self
72
-	{
73
-		$this->eventName = $eventName;
74
-
75
-		return $this;
76
-	}
77
-
78
-	/**
79
-	 * @return int
80
-	 */
81
-	public function getThreadNb(): int
82
-	{
83
-		return $this->threadNb;
84
-	}
85
-
86
-	/**
87
-	 * @param int $threadNb
88
-	 * @return Event
89
-	 */
90
-	public function setThreadNb(int $threadNb): self
91
-	{
92
-		$this->threadNb = $threadNb;
93
-
94
-		return $this;
95
-	}
96
-
97
-	/**
98
-	 * @return int
99
-	 */
100
-	public function getThreadDoneNb(): int
101
-	{
102
-		return $this->threadDoneNb;
103
-	}
104
-
105
-	/**
106
-	 * @param int $threadDoneNb
107
-	 * @return Event
108
-	 */
109
-	public function setThreadDoneNb(int $threadDoneNb): self
110
-	{
111
-		$this->threadDoneNb = $threadDoneNb;
112
-
113
-		return $this;
114
-	}
115
-
116
-	/**
117
-	 * @return int
118
-	 */
119
-	public function getThreadLeftNb(): int
120
-	{
121
-		return $this->threadLeftNb;
122
-	}
123
-
124
-	/**
125
-	 * @param int $threadLeftNb
126
-	 * @return Event
127
-	 */
128
-	public function setThreadLeftNb(int $threadLeftNb): self
129
-	{
130
-		$this->threadLeftNb = $threadLeftNb;
131
-
132
-		return $this;
133
-	}
134
-
135
-	/**
136
-	 * @return int
137
-	 */
138
-	public function getMaxRunningThreadNb(): int
139
-	{
140
-		return $this->maxRunningThreadNb;
141
-	}
142
-
143
-	/**
144
-	 * @param int $maxRunningThreadNb
145
-	 * @return Event
146
-	 */
147
-	public function setMaxRunningThreadNb(int $maxRunningThreadNb): self
148
-	{
149
-		$this->maxRunningThreadNb = $maxRunningThreadNb;
150
-
151
-		return $this;
152
-	}
153
-
154
-	/**
155
-	 * @return int
156
-	 */
157
-	public function getRunningThreadNb(): int
158
-	{
159
-		return $this->runningThreadNb;
160
-	}
161
-
162
-	/**
163
-	 * @param int $runningThreadNb
164
-	 * @return Event
165
-	 */
166
-	public function setRunningThreadNb(int $runningThreadNb): self
167
-	{
168
-		$this->runningThreadNb = $runningThreadNb;
169
-
170
-		return $this;
171
-	}
172
-
173
-	/**
174
-	 * @return Thread
175
-	 */
176
-	public function getThread(): ?Thread
177
-	{
178
-		return $this->thread;
179
-	}
180
-
181
-	/**
182
-	 * @param Thread|null $thread
183
-	 * @return $this
184
-	 */
185
-	public function setThread(Thread $thread = null): self
186
-	{
187
-		$this->thread = $thread;
188
-
189
-		return $this;
190
-	}
10
+    const POOL_RUN_START = 'run_start';
11
+    const POOL_RUN_STOP = 'run_stop';
12
+    const POOL_NEW_THREAD = 'new_thread';
13
+    const POOL_PRE_WAIT_TICK = 'pre_wait_tick';
14
+    const POOL_POST_WAIT_TICK = 'post_wait_tick';
15
+    const POOL_WAIT_TICK_PID = 'wait_tick_pid';
16
+    const POOL_WAIT_TICK_PID_REMOVED = 'wait_tick_pid_removed';
17
+
18
+    const THREAD_PRE_PROCESS = 'pre_process';
19
+    const THREAD_POST_PROCESS = 'post_process';
20
+    const THREAD_EXIT_SUCCESS = 'exist_success';
21
+    const THREAD_EXIT_ERROR = 'exit_error';
22
+    const THREAD_EXIT_UNKNOWN = 'exit_unknown';
23
+
24
+    /** @var string $eventName */
25
+    private $eventName;
26
+
27
+    /** @var int $threadNb */
28
+    private $threadNb;
29
+
30
+    /** @var int $runningThreadNb */
31
+    private $runningThreadNb;
32
+
33
+    /** @var int $threadDoneNb */
34
+    private $threadDoneNb;
35
+
36
+    /** @var int $threadLeftNb */
37
+    private $threadLeftNb;
38
+
39
+    /** @var int $maxRunningThreadNb */
40
+    private $maxRunningThreadNb;
41
+
42
+    /** @var Thread $thread */
43
+    private $thread;
44
+
45
+    /**
46
+     * ThreadPoolEvent constructor.
47
+     * @param string $eventName
48
+     */
49
+    public function __construct($eventName)
50
+    {
51
+        $this->eventName = $eventName;
52
+        $this->threadNb = 0;
53
+        $this->runningThreadNb = 0;
54
+        $this->threadDoneNb = 0;
55
+        $this->threadLeftNb = 0;
56
+        $this->maxRunningThreadNb = 0;
57
+    }
58
+
59
+    /**
60
+     * @return string
61
+     */
62
+    public function getEventName(): string
63
+    {
64
+        return $this->eventName;
65
+    }
66
+
67
+    /**
68
+     * @param string $eventName
69
+     * @return Event
70
+     */
71
+    public function setEventName(string $eventName): self
72
+    {
73
+        $this->eventName = $eventName;
74
+
75
+        return $this;
76
+    }
77
+
78
+    /**
79
+     * @return int
80
+     */
81
+    public function getThreadNb(): int
82
+    {
83
+        return $this->threadNb;
84
+    }
85
+
86
+    /**
87
+     * @param int $threadNb
88
+     * @return Event
89
+     */
90
+    public function setThreadNb(int $threadNb): self
91
+    {
92
+        $this->threadNb = $threadNb;
93
+
94
+        return $this;
95
+    }
96
+
97
+    /**
98
+     * @return int
99
+     */
100
+    public function getThreadDoneNb(): int
101
+    {
102
+        return $this->threadDoneNb;
103
+    }
104
+
105
+    /**
106
+     * @param int $threadDoneNb
107
+     * @return Event
108
+     */
109
+    public function setThreadDoneNb(int $threadDoneNb): self
110
+    {
111
+        $this->threadDoneNb = $threadDoneNb;
112
+
113
+        return $this;
114
+    }
115
+
116
+    /**
117
+     * @return int
118
+     */
119
+    public function getThreadLeftNb(): int
120
+    {
121
+        return $this->threadLeftNb;
122
+    }
123
+
124
+    /**
125
+     * @param int $threadLeftNb
126
+     * @return Event
127
+     */
128
+    public function setThreadLeftNb(int $threadLeftNb): self
129
+    {
130
+        $this->threadLeftNb = $threadLeftNb;
131
+
132
+        return $this;
133
+    }
134
+
135
+    /**
136
+     * @return int
137
+     */
138
+    public function getMaxRunningThreadNb(): int
139
+    {
140
+        return $this->maxRunningThreadNb;
141
+    }
142
+
143
+    /**
144
+     * @param int $maxRunningThreadNb
145
+     * @return Event
146
+     */
147
+    public function setMaxRunningThreadNb(int $maxRunningThreadNb): self
148
+    {
149
+        $this->maxRunningThreadNb = $maxRunningThreadNb;
150
+
151
+        return $this;
152
+    }
153
+
154
+    /**
155
+     * @return int
156
+     */
157
+    public function getRunningThreadNb(): int
158
+    {
159
+        return $this->runningThreadNb;
160
+    }
161
+
162
+    /**
163
+     * @param int $runningThreadNb
164
+     * @return Event
165
+     */
166
+    public function setRunningThreadNb(int $runningThreadNb): self
167
+    {
168
+        $this->runningThreadNb = $runningThreadNb;
169
+
170
+        return $this;
171
+    }
172
+
173
+    /**
174
+     * @return Thread
175
+     */
176
+    public function getThread(): ?Thread
177
+    {
178
+        return $this->thread;
179
+    }
180
+
181
+    /**
182
+     * @param Thread|null $thread
183
+     * @return $this
184
+     */
185
+    public function setThread(Thread $thread = null): self
186
+    {
187
+        $this->thread = $thread;
188
+
189
+        return $this;
190
+    }
191 191
 
192 192
 }
Please login to merge, or discard this patch.
tests/unit/Mediator/Listener/ListenerTest.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,26 +13,26 @@
 block discarded – undo
13 13
  */
14 14
 class ListenerTest extends TestCase
15 15
 {
16
-	/** @var Listener */
17
-	private $listener;
16
+    /** @var Listener */
17
+    private $listener;
18 18
 
19
-	/** @var callable */
20
-	private $callback;
19
+    /** @var callable */
20
+    private $callback;
21 21
 
22
-	public function setUp()
23
-	{
24
-		$this->callback = function(){
25
-  };
26
-		$this->listener = new Listener(Event::POOL_NEW_THREAD, $this->callback);
27
-	}
22
+    public function setUp()
23
+    {
24
+        $this->callback = function(){
25
+    };
26
+        $this->listener = new Listener(Event::POOL_NEW_THREAD, $this->callback);
27
+    }
28 28
 
29
-	public function test_listener()
30
-	{
31
-		$this->assertSame(Event::POOL_NEW_THREAD, $this->listener->getEventName());
32
-		$this->assertSame($this->listener, $this->listener->setEventName(Event::POOL_POST_WAIT_TICK));
33
-		$this->assertSame(Event::POOL_POST_WAIT_TICK, $this->listener->getEventName());
34
-		$this->assertSame($this->listener, $this->listener->setCallback($this->callback));
35
-		$this->listener->notify(new Event('test'));
36
-	}
29
+    public function test_listener()
30
+    {
31
+        $this->assertSame(Event::POOL_NEW_THREAD, $this->listener->getEventName());
32
+        $this->assertSame($this->listener, $this->listener->setEventName(Event::POOL_POST_WAIT_TICK));
33
+        $this->assertSame(Event::POOL_POST_WAIT_TICK, $this->listener->getEventName());
34
+        $this->assertSame($this->listener, $this->listener->setCallback($this->callback));
35
+        $this->listener->notify(new Event('test'));
36
+    }
37 37
 
38 38
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
 	public function setUp()
23 23
 	{
24
-		$this->callback = function(){
24
+		$this->callback = function() {
25 25
   };
26 26
 		$this->listener = new Listener(Event::POOL_NEW_THREAD, $this->callback);
27 27
 	}
Please login to merge, or discard this patch.
tests/unit/Mediator/MediatorTest.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,25 +14,25 @@
 block discarded – undo
14 14
  */
15 15
 class MediatorTest extends TestCase
16 16
 {
17
-	/** @var Mediator */
18
-	private $mediator;
17
+    /** @var Mediator */
18
+    private $mediator;
19 19
 
20
-	public function setUp()
21
-	{
22
-		$this->mediator = new Mediator();
23
-	}
20
+    public function setUp()
21
+    {
22
+        $this->mediator = new Mediator();
23
+    }
24 24
 
25
-	public function test_listeners()
26
-	{
27
-		$listener = new Listener(Event::POOL_NEW_THREAD, function() {
28
-  });
29
-		$this->assertSame([], $this->mediator->getListeners());
30
-		$this->assertSame($this->mediator, $this->mediator->addListener($listener));
31
-		$this->assertSame([Event::POOL_NEW_THREAD => [$listener]], $this->mediator->getListeners());
32
-		$this->assertSame($this->mediator, $this->mediator->removeListener(new Listener('fake', function(){
33
-  })));
34
-		$this->mediator->notify(Event::POOL_NEW_THREAD, new Event('unit-event'));
35
-		$this->assertSame($this->mediator, $this->mediator->removeListener($listener));
36
-	}
25
+    public function test_listeners()
26
+    {
27
+        $listener = new Listener(Event::POOL_NEW_THREAD, function() {
28
+    });
29
+        $this->assertSame([], $this->mediator->getListeners());
30
+        $this->assertSame($this->mediator, $this->mediator->addListener($listener));
31
+        $this->assertSame([Event::POOL_NEW_THREAD => [$listener]], $this->mediator->getListeners());
32
+        $this->assertSame($this->mediator, $this->mediator->removeListener(new Listener('fake', function(){
33
+    })));
34
+        $this->mediator->notify(Event::POOL_NEW_THREAD, new Event('unit-event'));
35
+        $this->assertSame($this->mediator, $this->mediator->removeListener($listener));
36
+    }
37 37
 
38 38
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 		$this->assertSame([], $this->mediator->getListeners());
30 30
 		$this->assertSame($this->mediator, $this->mediator->addListener($listener));
31 31
 		$this->assertSame([Event::POOL_NEW_THREAD => [$listener]], $this->mediator->getListeners());
32
-		$this->assertSame($this->mediator, $this->mediator->removeListener(new Listener('fake', function(){
32
+		$this->assertSame($this->mediator, $this->mediator->removeListener(new Listener('fake', function() {
33 33
   })));
34 34
 		$this->mediator->notify(Event::POOL_NEW_THREAD, new Event('unit-event'));
35 35
 		$this->assertSame($this->mediator, $this->mediator->removeListener($listener));
Please login to merge, or discard this patch.
tests/unit/ThreadPoolTest.php 2 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -17,96 +17,96 @@
 block discarded – undo
17 17
  */
18 18
 class ThreadPoolTest extends TestCase
19 19
 {
20
-	/** @var ThreadPool */
21
-	private $threadPool;
22
-
23
-	protected function setUp()
24
-	{
25
-		$this->threadPool = new ThreadPool();
26
-	}
27
-
28
-	public function test_constructor_destructor()
29
-	{
30
-		$this->assertAttributeEquals([], 'threads', $this->threadPool);
31
-		$this->assertAttributeEquals([], 'runningThreads', $this->threadPool);
32
-		$this->assertAttributeEquals([], 'toRunThreads', $this->threadPool);
33
-		$this->assertAttributeEquals(false, 'isRunning', $this->threadPool);
34
-		$this->assertAttributeEquals(0, 'maxRunningThreadNb', $this->threadPool);
35
-		$this->assertSame(Mediator::class, get_class($this->threadPool->getMediator()));
36
-
37
-		unset($this->threadPool);
38
-	}
39
-
40
-	public function test_getThreads()
41
-	{
42
-		$threads = [new Thread()];
43
-		$this->assertSame($this->threadPool, $this->threadPool->setThreads($threads));
44
-		$this->assertSame($threads, $this->threadPool->getThreads());
45
-	}
46
-
47
-	public function test_addThread()
48
-	{
49
-		$thread = new Thread();
50
-		$this->assertSame($this->threadPool, $this->threadPool->addThread($thread));
51
-		$this->assertContains($thread, $this->threadPool->getThreads());
52
-	}
53
-
54
-	public function test_getMaxRunningThreadNb()
55
-	{
56
-		$this->assertSame(0, $this->threadPool->getMaxRunningThreadNb());
57
-	}
58
-
59
-	public function test_setMaxRunningThreadNb()
60
-	{
61
-		$this->assertSame($this->threadPool, $this->threadPool->setMaxRunningThreadNb(10));
62
-		$this->assertSame(10, $this->threadPool->getMaxRunningThreadNb());
63
-	}
64
-
65
-	public function test_getToRunThreads()
66
-	{
67
-		$this->assertSame([], $this->threadPool->getToRunThreads());
68
-	}
69
-
70
-	public function test_getRunningThreads()
71
-	{
72
-		$this->assertSame([], $this->threadPool->getRunningThreads());
73
-	}
74
-
75
-	/**
76
-	 * @throws \Wonderland\Thread\Exception\ThreadException
77
-	 */
78
-	public function test_run()
79
-	{
80
-		$thread = new Thread();
81
-		$thread->setCallback(function (){ return 0;
82
-
83
-  });
84
-		$thread->setProcessName('unitTest');
85
-		$threads = [];
86
-		$listener = new Listener(Event::POOL_NEW_THREAD, function (){
87
-  });
88
-
89
-		$this->threadPool->setMaxRunningThreadNb(10);
90
-		$this->assertSame($this->threadPool, $this->threadPool->addListener($listener));
91
-		for ($i = 0; $i < 20;
20
+    /** @var ThreadPool */
21
+    private $threadPool;
22
+
23
+    protected function setUp()
24
+    {
25
+        $this->threadPool = new ThreadPool();
26
+    }
27
+
28
+    public function test_constructor_destructor()
29
+    {
30
+        $this->assertAttributeEquals([], 'threads', $this->threadPool);
31
+        $this->assertAttributeEquals([], 'runningThreads', $this->threadPool);
32
+        $this->assertAttributeEquals([], 'toRunThreads', $this->threadPool);
33
+        $this->assertAttributeEquals(false, 'isRunning', $this->threadPool);
34
+        $this->assertAttributeEquals(0, 'maxRunningThreadNb', $this->threadPool);
35
+        $this->assertSame(Mediator::class, get_class($this->threadPool->getMediator()));
36
+
37
+        unset($this->threadPool);
38
+    }
39
+
40
+    public function test_getThreads()
41
+    {
42
+        $threads = [new Thread()];
43
+        $this->assertSame($this->threadPool, $this->threadPool->setThreads($threads));
44
+        $this->assertSame($threads, $this->threadPool->getThreads());
45
+    }
46
+
47
+    public function test_addThread()
48
+    {
49
+        $thread = new Thread();
50
+        $this->assertSame($this->threadPool, $this->threadPool->addThread($thread));
51
+        $this->assertContains($thread, $this->threadPool->getThreads());
52
+    }
53
+
54
+    public function test_getMaxRunningThreadNb()
55
+    {
56
+        $this->assertSame(0, $this->threadPool->getMaxRunningThreadNb());
57
+    }
58
+
59
+    public function test_setMaxRunningThreadNb()
60
+    {
61
+        $this->assertSame($this->threadPool, $this->threadPool->setMaxRunningThreadNb(10));
62
+        $this->assertSame(10, $this->threadPool->getMaxRunningThreadNb());
63
+    }
64
+
65
+    public function test_getToRunThreads()
66
+    {
67
+        $this->assertSame([], $this->threadPool->getToRunThreads());
68
+    }
69
+
70
+    public function test_getRunningThreads()
71
+    {
72
+        $this->assertSame([], $this->threadPool->getRunningThreads());
73
+    }
74
+
75
+    /**
76
+     * @throws \Wonderland\Thread\Exception\ThreadException
77
+     */
78
+    public function test_run()
79
+    {
80
+        $thread = new Thread();
81
+        $thread->setCallback(function (){ return 0;
82
+
83
+    });
84
+        $thread->setProcessName('unitTest');
85
+        $threads = [];
86
+        $listener = new Listener(Event::POOL_NEW_THREAD, function (){
87
+    });
88
+
89
+        $this->threadPool->setMaxRunningThreadNb(10);
90
+        $this->assertSame($this->threadPool, $this->threadPool->addListener($listener));
91
+        for ($i = 0; $i < 20;
92 92
 $i++) { $threads[] = clone $thread;
93
-		}
94
-		$this->assertSame($this->threadPool, $this->threadPool->addThread($thread));
95
-		$this->assertSame($this->threadPool, $this->threadPool->setThreads($threads));
93
+        }
94
+        $this->assertSame($this->threadPool, $this->threadPool->addThread($thread));
95
+        $this->assertSame($this->threadPool, $this->threadPool->setThreads($threads));
96 96
 
97
-		$this->threadPool->run();
97
+        $this->threadPool->run();
98 98
 
99
-		$this->assertSame($this->threadPool, $this->threadPool->removeListener($listener));
100
-	}
99
+        $this->assertSame($this->threadPool, $this->threadPool->removeListener($listener));
100
+    }
101 101
 
102
-	/**
103
-	 * @throws ThreadException
104
-	 */
105
-	public function test_run_exception()
106
-	{
107
-		$this->expectException(ThreadException::class);
108
-		$this->threadPool->run();
102
+    /**
103
+     * @throws ThreadException
104
+     */
105
+    public function test_run_exception()
106
+    {
107
+        $this->expectException(ThreadException::class);
108
+        $this->threadPool->run();
109 109
 
110
-	}
110
+    }
111 111
 
112 112
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,12 +78,12 @@
 block discarded – undo
78 78
 	public function test_run()
79 79
 	{
80 80
 		$thread = new Thread();
81
-		$thread->setCallback(function (){ return 0;
81
+		$thread->setCallback(function() { return 0;
82 82
 
83 83
   });
84 84
 		$thread->setProcessName('unitTest');
85 85
 		$threads = [];
86
-		$listener = new Listener(Event::POOL_NEW_THREAD, function (){
86
+		$listener = new Listener(Event::POOL_NEW_THREAD, function() {
87 87
   });
88 88
 
89 89
 		$this->threadPool->setMaxRunningThreadNb(10);
Please login to merge, or discard this patch.
tests/unit/Factory/ThreadFactoryTest.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
 class ThreadFactoryTest extends TestCase
15 15
 {
16 16
 
17
-	public function test_create()
18
-	{
19
-		$callback = function(){
20
-  };
21
-		$thread = new Thread();
22
-		$thread->setProcessName('unit-test');
23
-		$thread->setCallback($callback);
17
+    public function test_create()
18
+    {
19
+        $callback = function(){
20
+    };
21
+        $thread = new Thread();
22
+        $thread->setProcessName('unit-test');
23
+        $thread->setCallback($callback);
24 24
 
25
-		$this->assertSame($thread->getCallback(), ThreadFactory::create('unit-test', $callback)->getCallback());
26
-		$this->assertSame($thread->getProcessName(), ThreadFactory::create('unit-test', $callback)->getProcessName());
27
-	}
25
+        $this->assertSame($thread->getCallback(), ThreadFactory::create('unit-test', $callback)->getCallback());
26
+        $this->assertSame($thread->getProcessName(), ThreadFactory::create('unit-test', $callback)->getProcessName());
27
+    }
28 28
 
29 29
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 
17 17
 	public function test_create()
18 18
 	{
19
-		$callback = function(){
19
+		$callback = function() {
20 20
   };
21 21
 		$thread = new Thread();
22 22
 		$thread->setProcessName('unit-test');
Please login to merge, or discard this patch.
tests/unit/ThreadTest.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -13,78 +13,78 @@
 block discarded – undo
13 13
  */
14 14
 class ThreadTest extends TestCase
15 15
 {
16
-	/** @var Thread */
17
-	private $thread;
18
-
19
-	private $callback;
20
-
21
-	public function setUp()
22
-	{
23
-		$this->callback = function (){ return 0;
24
-
25
-  };
26
-
27
-		$this->thread = new Thread();
28
-		$this->thread->setPid(1);
29
-		$this->thread->setProcessName('unit-test');
30
-		$this->thread->setCallback($this->callback);
31
-	}
32
-
33
-	public function test_pid()
34
-	{
35
-		$this->assertSame(1, $this->thread->getPid());
36
-		$this->assertSame($this->thread, $this->thread->setPid(100));
37
-		$this->assertSame(100, $this->thread->getPid());
38
-	}
39
-
40
-	public function test_processName()
41
-	{
42
-		$this->assertSame('unit-test', $this->thread->getProcessName());
43
-		$this->assertSame($this->thread, $this->thread->setProcessName('unit'));
44
-		$this->assertSame('unit', $this->thread->getProcessName());
45
-	}
46
-
47
-	public function test_callback()
48
-	{
49
-		$callback = function(){ return 1;
50
-
51
-  };
52
-
53
-		$this->assertSame($this->callback, $this->thread->getCallback());
54
-		$this->assertSame($this->thread, $this->thread->setCallback($callback));
55
-		$this->assertSame($callback, $this->thread->getCallback());
56
-	}
57
-
58
-	/**
59
-	 * @throws ThreadException
60
-	 */
61
-	public function test_run()
62
-	{
63
-		$this->assertSame(0, $this->thread->run('unit-test'));
64
-	}
65
-
66
-	/**
67
-	 * @throws ThreadException
68
-	 */
69
-	public function test_run_exception()
70
-	{
71
-		$this->expectException(ThreadException::class);
72
-		$thread = new Thread();
73
-		$thread->run('unit-test');
74
-
75
-	}
76
-
77
-	/**
78
-	 * @throws ThreadException
79
-	 */
80
-	public function test_run_exception_status()
81
-	{
82
-		$this->expectException(ThreadException::class);
83
-		$thread = new Thread();
84
-		$thread->setCallback(function() { return null;
85
-
86
-  });
87
-		$thread->run('unit-test');
88
-	}
16
+    /** @var Thread */
17
+    private $thread;
18
+
19
+    private $callback;
20
+
21
+    public function setUp()
22
+    {
23
+        $this->callback = function (){ return 0;
24
+
25
+    };
26
+
27
+        $this->thread = new Thread();
28
+        $this->thread->setPid(1);
29
+        $this->thread->setProcessName('unit-test');
30
+        $this->thread->setCallback($this->callback);
31
+    }
32
+
33
+    public function test_pid()
34
+    {
35
+        $this->assertSame(1, $this->thread->getPid());
36
+        $this->assertSame($this->thread, $this->thread->setPid(100));
37
+        $this->assertSame(100, $this->thread->getPid());
38
+    }
39
+
40
+    public function test_processName()
41
+    {
42
+        $this->assertSame('unit-test', $this->thread->getProcessName());
43
+        $this->assertSame($this->thread, $this->thread->setProcessName('unit'));
44
+        $this->assertSame('unit', $this->thread->getProcessName());
45
+    }
46
+
47
+    public function test_callback()
48
+    {
49
+        $callback = function(){ return 1;
50
+
51
+    };
52
+
53
+        $this->assertSame($this->callback, $this->thread->getCallback());
54
+        $this->assertSame($this->thread, $this->thread->setCallback($callback));
55
+        $this->assertSame($callback, $this->thread->getCallback());
56
+    }
57
+
58
+    /**
59
+     * @throws ThreadException
60
+     */
61
+    public function test_run()
62
+    {
63
+        $this->assertSame(0, $this->thread->run('unit-test'));
64
+    }
65
+
66
+    /**
67
+     * @throws ThreadException
68
+     */
69
+    public function test_run_exception()
70
+    {
71
+        $this->expectException(ThreadException::class);
72
+        $thread = new Thread();
73
+        $thread->run('unit-test');
74
+
75
+    }
76
+
77
+    /**
78
+     * @throws ThreadException
79
+     */
80
+    public function test_run_exception_status()
81
+    {
82
+        $this->expectException(ThreadException::class);
83
+        $thread = new Thread();
84
+        $thread->setCallback(function() { return null;
85
+
86
+    });
87
+        $thread->run('unit-test');
88
+    }
89 89
 
90 90
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function setUp()
22 22
 	{
23
-		$this->callback = function (){ return 0;
23
+		$this->callback = function() { return 0;
24 24
 
25 25
   };
26 26
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 	public function test_callback()
48 48
 	{
49
-		$callback = function(){ return 1;
49
+		$callback = function() { return 1;
50 50
 
51 51
   };
52 52
 
Please login to merge, or discard this patch.
tests/unit/Event/EventTest.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -13,43 +13,43 @@
 block discarded – undo
13 13
  */
14 14
 class EventTest extends TestCase
15 15
 {
16
-	/** @var Event */
17
-	private $event;
18
-
19
-	/** @var Thread */
20
-	private $thread;
21
-
22
-	public function setUp()
23
-	{
24
-		$this->thread = new Thread();
25
-		$this->event = new Event('unit-test');
26
-		$this->event->setThread($this->thread);
27
-	}
28
-
29
-	public function test_event()
30
-	{
31
-		$this->assertSame('unit-test', $this->event->getEventName());
32
-		$this->assertSame(0, $this->event->getMaxRunningThreadNb());
33
-		$this->assertSame(0, $this->event->getRunningThreadNb());
34
-		$this->assertSame(0, $this->event->getThreadDoneNb());
35
-		$this->assertSame(0, $this->event->getThreadLeftNb());
36
-		$this->assertSame(0, $this->event->getThreadNb());
37
-		$this->assertSame($this->thread, $this->event->getThread());
38
-
39
-		$this->assertSame($this->event, $this->event->setThread($this->thread));
40
-		$this->assertSame($this->event, $this->event->setMaxRunningThreadNb(100));
41
-		$this->assertSame($this->event, $this->event->setEventName('fake'));
42
-		$this->assertSame($this->event, $this->event->setRunningThreadNb(10));
43
-		$this->assertSame($this->event, $this->event->setThreadDoneNb(90));
44
-		$this->assertSame($this->event, $this->event->setThreadLeftNb(10));
45
-		$this->assertSame($this->event, $this->event->setThreadNb(10));
46
-
47
-		$this->assertSame('fake', $this->event->getEventName());
48
-		$this->assertSame(100, $this->event->getMaxRunningThreadNb());
49
-		$this->assertSame(10, $this->event->getRunningThreadNb());
50
-		$this->assertSame(90, $this->event->getThreadDoneNb());
51
-		$this->assertSame(10, $this->event->getThreadLeftNb());
52
-		$this->assertSame(10, $this->event->getThreadNb());
53
-	}
16
+    /** @var Event */
17
+    private $event;
18
+
19
+    /** @var Thread */
20
+    private $thread;
21
+
22
+    public function setUp()
23
+    {
24
+        $this->thread = new Thread();
25
+        $this->event = new Event('unit-test');
26
+        $this->event->setThread($this->thread);
27
+    }
28
+
29
+    public function test_event()
30
+    {
31
+        $this->assertSame('unit-test', $this->event->getEventName());
32
+        $this->assertSame(0, $this->event->getMaxRunningThreadNb());
33
+        $this->assertSame(0, $this->event->getRunningThreadNb());
34
+        $this->assertSame(0, $this->event->getThreadDoneNb());
35
+        $this->assertSame(0, $this->event->getThreadLeftNb());
36
+        $this->assertSame(0, $this->event->getThreadNb());
37
+        $this->assertSame($this->thread, $this->event->getThread());
38
+
39
+        $this->assertSame($this->event, $this->event->setThread($this->thread));
40
+        $this->assertSame($this->event, $this->event->setMaxRunningThreadNb(100));
41
+        $this->assertSame($this->event, $this->event->setEventName('fake'));
42
+        $this->assertSame($this->event, $this->event->setRunningThreadNb(10));
43
+        $this->assertSame($this->event, $this->event->setThreadDoneNb(90));
44
+        $this->assertSame($this->event, $this->event->setThreadLeftNb(10));
45
+        $this->assertSame($this->event, $this->event->setThreadNb(10));
46
+
47
+        $this->assertSame('fake', $this->event->getEventName());
48
+        $this->assertSame(100, $this->event->getMaxRunningThreadNb());
49
+        $this->assertSame(10, $this->event->getRunningThreadNb());
50
+        $this->assertSame(90, $this->event->getThreadDoneNb());
51
+        $this->assertSame(10, $this->event->getThreadLeftNb());
52
+        $this->assertSame(10, $this->event->getThreadNb());
53
+    }
54 54
 
55 55
 }
Please login to merge, or discard this patch.
tests/bootstrap.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 declare( strict_types = 1 );
3 3
 
4 4
 if ( PHP_SAPI !== 'cli' ) {
5
-	die( 'Not an entry point' );
5
+    die( 'Not an entry point' );
6 6
 }
7 7
 
8 8
 error_reporting( -1 );
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 ini_set( 'display_errors', '1' );
11 11
 
12 12
 if ( !is_readable( __DIR__ . '/../vendor/autoload.php' ) ) {
13
-	die( 'You need to install this package with Composer before you can run the tests' );
13
+    die( 'You need to install this package with Composer before you can run the tests' );
14 14
 }
15 15
 
16 16
 require_once __DIR__ . '/../vendor/autoload.php';
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2
-declare( strict_types = 1 );
2
+declare(strict_types=1);
3 3
 
4
-if ( PHP_SAPI !== 'cli' ) {
5
-	die( 'Not an entry point' );
4
+if (PHP_SAPI !== 'cli') {
5
+	die('Not an entry point');
6 6
 }
7 7
 
8 8
 error_reporting( -1 );
9 9
 
10
-ini_set( 'display_errors', '1' );
10
+ini_set('display_errors', '1');
11 11
 
12
-if ( !is_readable( __DIR__ . '/../vendor/autoload.php' ) ) {
13
-	die( 'You need to install this package with Composer before you can run the tests' );
12
+if (!is_readable(__DIR__ . '/../vendor/autoload.php')) {
13
+	die('You need to install this package with Composer before you can run the tests');
14 14
 }
15 15
 
16 16
 require_once __DIR__ . '/../vendor/autoload.php';
Please login to merge, or discard this patch.