Skip to content

Commit e87bbbb

Browse files
authored
Merge pull request #12 from reactphp-parallel/quote-fix-quote-infection-issues
"fix" infection issues
2 parents 2af0d85 + be88f8f commit e87bbbb

File tree

3 files changed

+60
-7
lines changed

3 files changed

+60
-7
lines changed

infection.json.dist

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,43 @@
1010
},
1111
"mutators": {
1212
"@default": true,
13+
"FunctionCallRemoval": {
14+
"ignore": [
15+
"ReactParallel\\Pool\\Worker\\Worker::perform::76"
16+
]
17+
},
18+
"GreaterThan": {
19+
"ignore": [
20+
"ReactParallel\\Pool\\Worker\\Thread::close::85"
21+
]
22+
},
23+
"GreaterThanNegotiation": {
24+
"ignore": [
25+
"ReactParallel\\Pool\\Worker\\Thread::close::85"
26+
]
27+
},
28+
"Identical": {
29+
"ignore": [
30+
"ReactParallel\\Pool\\Worker\\Thread::__construct::43",
31+
"ReactParallel\\Pool\\Worker\\Thread::close::85",
32+
"ReactParallel\\Pool\\Worker\\Worker::getIdleThread::137"
33+
]
34+
},
1335
"MethodCallRemoval": {
1436
"ignore": [
15-
"ReactParallel\\Pool\\Infinite\\Infinite::startTtlTimer::189"
37+
"ReactParallel\\Pool\\Worker\\Infinite::startTtlTimer::189",
38+
"ReactParallel\\Pool\\Worker\\Thread::__construct::44",
39+
"ReactParallel\\Pool\\Worker\\Thread::close::89",
40+
"ReactParallel\\Pool\\Worker\\Worker::perform::87",
41+
"ReactParallel\\Pool\\Worker\\Worker::kill::111",
42+
"ReactParallel\\Pool\\Worker\\Worker::getIdleThread::138",
43+
"ReactParallel\\Pool\\Worker\\Worker::startTtlTimer::164"
44+
]
45+
},
46+
"NotIdentical": {
47+
"ignore": [
48+
"ReactParallel\\Pool\\Worker\\Thread::close::85"
1649
]
1750
}
1851
}
19-
}
52+
}

tests/WorkerTest.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,16 @@ public function close(): void
143143
$poolProperty->setAccessible(true);
144144
$poolProperty->setValue($parallelFactory, $pool->reveal());
145145

146-
$pool = new Worker($parallelFactory, $workerFactory, 1);
147-
$pool->close();
146+
$workerPool = new Worker($parallelFactory, $workerFactory, 1);
147+
$workerPool->close();
148+
149+
self::assertSame([
150+
Info::TOTAL => 0,
151+
Info::BUSY => 0,
152+
Info::CALLS => 0,
153+
Info::IDLE => 0,
154+
Info::SIZE => 0,
155+
], iterator_to_array($workerPool->info()));
148156
}
149157

150158
/**
@@ -166,7 +174,16 @@ public function kill(): void
166174
$poolProperty->setAccessible(true);
167175
$poolProperty->setValue($parallelFactory, $pool->reveal());
168176

169-
$pool = new Worker($parallelFactory, $workerFactory, 1);
170-
$pool->kill();
177+
$workerPool = new Worker($parallelFactory, $workerFactory, 1);
178+
// $workerPool->
179+
$workerPool->kill();
180+
181+
self::assertSame([
182+
Info::TOTAL => 0,
183+
Info::BUSY => 0,
184+
Info::CALLS => 0,
185+
Info::IDLE => 0,
186+
Info::SIZE => 0,
187+
], iterator_to_array($workerPool->info()));
171188
}
172189
}

tests/Workers/ThrowingReturnTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ final class ThrowingReturnTest extends AsyncTestCase
1818
*/
1919
public function thrown(): void
2020
{
21-
$money = null;
21+
$money = null;
22+
$thrownWork = null;
2223
try {
2324
(new ThrowingReturnWorkerFactory())->construct()->perform(new Work(Money::EUR(512)));
2425
} catch (ThrownWork $thrownWork) {
@@ -27,6 +28,8 @@ public function thrown(): void
2728
throw $throwable;
2829
}
2930

31+
self::assertNotNull($thrownWork);
32+
self::assertSame('Throwing work', $thrownWork->getMessage());
3033
self::assertNotNull($money);
3134
self::assertInstanceOf(Money::class, $money);
3235
self::assertSame('512', $money->getAmount());

0 commit comments

Comments
 (0)