Skip to content

Commit 5204cab

Browse files
authored
Merge pull request #69 from cakephp/fix-67
Don't set Queue configuration multiple times
2 parents ec319f4 + 289a63f commit 5204cab

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

phpunit.xml.dist

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,15 @@
55
bootstrap="tests/bootstrap.php"
66
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
77
<!-- Only collect coverage for src/ -->
8-
<coverage>
9-
<include>
10-
<directory suffix=".php">src/</directory>
11-
</include>
12-
</coverage>
8+
<filter>
9+
<whitelist>
10+
<directory suffix=".php">./src/</directory>
11+
</whitelist>
12+
</filter>
13+
1314
<testsuites>
1415
<testsuite name="queue">
1516
<directory>tests/TestCase</directory>
1617
</testsuite>
1718
</testsuites>
18-
<!-- Setup a listener for fixtures -->
19-
<listeners>
20-
<listener class="Cake\TestSuite\Fixture\FixtureInjector">
21-
<arguments>
22-
<object class="Cake\TestSuite\Fixture\FixtureManager"/>
23-
</arguments>
24-
</listener>
25-
</listeners>
2619
</phpunit>

src/Plugin.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ class Plugin extends BasePlugin
4949
*/
5050
public function bootstrap(PluginApplicationInterface $app): void
5151
{
52-
QueueManager::setConfig(Configure::read('Queue'));
52+
foreach (Configure::read('Queue') as $key => $data) {
53+
if (QueueManager::getConfig($key) === null) {
54+
QueueManager::setConfig($key, $data);
55+
}
56+
}
5357
}
5458

5559
/**

tests/TestCase/Command/WorkerCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function testQueueProcessesWithLogger()
136136
'Queue' => [
137137
'default' => [
138138
'queue' => 'default',
139-
'url' => 'null:',
139+
'url' => 'file:///' . TMP . DS . 'queue',
140140
],
141141
],
142142
]);
@@ -146,7 +146,7 @@ public function testQueueProcessesWithLogger()
146146
]);
147147

148148
$this->exec('worker --max-runtime=1 --logger=debug --verbose');
149-
$this->assertDebugLogContains('debug Max Iterations: 0');
149+
$this->assertDebugLogContains('Max Iterations: 0');
150150
}
151151

152152
/**

0 commit comments

Comments
 (0)