-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathPluginTest.php
More file actions
56 lines (52 loc) · 1.56 KB
/
PluginTest.php
File metadata and controls
56 lines (52 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
declare(strict_types=1);
namespace Cake\Queue\Test\TestCase;
use Cake\Core\Configure;
use Cake\Queue\QueueManager;
use Cake\Queue\QueuePlugin;
use Cake\TestSuite\TestCase;
use InvalidArgumentException;
use TestApp\Application;
class PluginTest extends TestCase
{
/**
* Test Plugin bootstrap with no config
*
* @return void
*/
public function testBootstrapNoConfig()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Missing `Queue` configuration key, please check the CakePHP Queue documentation to complete the plugin setup');
Configure::delete('Queue');
$plugin = new QueuePlugin();
$app = $this->createStub(Application::class);
$plugin->bootstrap($app);
}
/**
* Test Plugin bootstrap with config
*
* @return void
*/
public function testBootstrapWithConfig()
{
$queueConfig = [
'url' => 'null:',
'queue' => 'default',
'logger' => 'stdout',
];
Configure::write('Queue', ['default' => $queueConfig]);
$plugin = new QueuePlugin();
$app = $this->createStub(Application::class);
$plugin->bootstrap($app);
$queueConfig['url'] = [
'transport' => 'null:',
'client' => [
'router_topic' => 'default',
'router_queue' => 'default',
'default_queue' => 'default',
],
];
$this->assertEquals($queueConfig, QueueManager::getConfig('default'));
}
}