forked from vyuldashev/laravel-queue-rabbitmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestCase.php
57 lines (48 loc) · 1.58 KB
/
TestCase.php
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
57
<?php
namespace VladimirYuldashev\LaravelQueueRabbitMQ\Tests;
use Illuminate\Support\Facades\Queue;
use Orchestra\Testbench\TestCase as BaseTestCase;
use PhpAmqpLib\Connection\AMQPLazyConnection;
use VladimirYuldashev\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider;
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
abstract class TestCase extends BaseTestCase
{
protected function getPackageProviders($app): array
{
return [
LaravelQueueRabbitMQServiceProvider::class,
];
}
protected function getEnvironmentSetUp($app): void
{
$app['config']->set('queue.default', 'rabbitmq');
$app['config']->set('queue.connections.rabbitmq', [
'driver' => 'rabbitmq',
'queue' => 'default',
'connection' => AMQPLazyConnection::class,
'hosts' => [
[
'host' => getenv('HOST'),
'port' => getenv('PORT'),
'vhost' => '/',
'user' => 'guest',
'password' => 'guest',
],
],
'options' => [
'ssl_options' => [
'cafile' => null,
'local_cert' => null,
'local_key' => null,
'verify_peer' => true,
'passphrase' => null,
],
],
'worker' => 'default',
]);
}
protected function connection(string $name = null): RabbitMQQueue
{
return Queue::connection($name);
}
}