Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af404ec

Browse files
committed
fix tests.
1 parent 9a698c1 commit af404ec

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

pkg/enqueue-bundle/DependencyInjection/EnqueueExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function load(array $configs, ContainerBuilder $container)
7070
$this->factories[$name]->createDriver($container, $transportConfig);
7171
}
7272

73-
if (false == isset($config['transport'][$config['transport']['default']['alias']])) {
73+
if (isset($config['transport']['default']['alias']) && false == isset($config['transport'][$config['transport']['default']['alias']])) {
7474
throw new \LogicException(sprintf('Transport is not enabled: %s', $config['transport']['default']['alias']));
7575
}
7676

@@ -82,7 +82,7 @@ public function load(array $configs, ContainerBuilder $container)
8282
$config['client']['router_queue'],
8383
$config['client']['default_processor_queue'],
8484
$config['client']['router_processor'],
85-
$config['transport'][$config['transport']['default']['alias']],
85+
isset($config['transport']['default']['alias']) ? $config['transport'][$config['transport']['default']['alias']] : [],
8686
]);
8787

8888
$container->setParameter('enqueue.client.router_queue_name', $config['client']['router_queue']);

pkg/enqueue-bundle/Tests/Functional/App/CustomAppKernel.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
66
use Symfony\Component\Config\Loader\LoaderInterface;
77
use Symfony\Component\DependencyInjection\ContainerBuilder;
8+
use Symfony\Component\Filesystem\Filesystem;
89
use Symfony\Component\HttpKernel\Kernel;
910
use Symfony\Component\Routing\RouteCollectionBuilder;
1011

@@ -24,6 +25,10 @@ class CustomAppKernel extends Kernel
2425

2526
public function setEnqueueConfig(array $config)
2627
{
28+
$fs = new Filesystem();
29+
$fs->remove(sys_get_temp_dir().'/EnqueueBundleCustom/cache');
30+
$fs->mkdir(sys_get_temp_dir().'/EnqueueBundleCustom/cache');
31+
2732
$this->enqueueConfig = array_replace_recursive($this->enqueueConfig, $config);
2833
}
2934

pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function provideEnqueueConfigs()
5151

5252
yield 'default_dbal_as_dsn' => [[
5353
'transport' => [
54-
'default' => getenv('DOCTRINE_DSN'),
54+
'default' => getenv('DOCTINE_DSN'),
5555
],
5656
]];
5757

@@ -105,34 +105,36 @@ public function provideEnqueueConfigs()
105105
yield 'fs_dsn' => [[
106106
'transport' => [
107107
'default' => 'fs',
108-
'fs' => 'file:/'.sys_get_temp_dir(),
108+
'fs' => 'file://'.sys_get_temp_dir(),
109109
],
110110
]];
111111

112112
yield 'default_fs_as_dsn' => [[
113113
'transport' => [
114-
'default' => 'file:/'.sys_get_temp_dir(),
114+
'default' => 'file://'.sys_get_temp_dir(),
115115
],
116116
]];
117117

118118
yield 'dbal' => [[
119119
'transport' => [
120120
'default' => 'dbal',
121121
'dbal' => [
122-
'dbname' => getenv('SYMFONY__DB__NAME'),
123-
'user' => getenv('SYMFONY__DB__USER'),
124-
'password' => getenv('SYMFONY__DB__PASSWORD'),
125-
'host' => getenv('SYMFONY__DB__HOST'),
126-
'port' => getenv('SYMFONY__DB__PORT'),
127-
'driver' => getenv('SYMFONY__DB__DRIVER'),
122+
'connection' => [
123+
'dbname' => getenv('SYMFONY__DB__NAME'),
124+
'user' => getenv('SYMFONY__DB__USER'),
125+
'password' => getenv('SYMFONY__DB__PASSWORD'),
126+
'host' => getenv('SYMFONY__DB__HOST'),
127+
'port' => getenv('SYMFONY__DB__PORT'),
128+
'driver' => getenv('SYMFONY__DB__DRIVER'),
129+
],
128130
],
129131
],
130132
]];
131133

132134
yield 'dbal_dsn' => [[
133135
'transport' => [
134136
'default' => 'dbal',
135-
'dbal' => getenv('DOCTRINE_DSN'),
137+
'dbal' => getenv('DOCTINE_DSN'),
136138
],
137139
]];
138140

@@ -231,6 +233,7 @@ protected function customSetUp(array $enqueueConfig)
231233

232234
$this->client = static::createClient(['enqueue_config' => $enqueueConfig]);
233235
$this->client->getKernel()->boot();
236+
static::$kernel = $this->client->getKernel();
234237
$this->container = static::$kernel->getContainer();
235238

236239
/** @var DriverInterface $driver */

pkg/stomp/Symfony/StompTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function addConfiguration(ArrayNodeDefinition $builder)
3434
$builder
3535
->children()
3636
->scalarNode('host')->defaultValue('localhost')->cannotBeEmpty()->end()
37-
->integerNode('port')->min(1)->defaultValue(61613)->end()
37+
->scalarNode('port')->defaultValue(61613)->end()
3838
->scalarNode('login')->defaultValue('guest')->cannotBeEmpty()->end()
3939
->scalarNode('password')->defaultValue('guest')->cannotBeEmpty()->end()
4040
->scalarNode('vhost')->defaultValue('/')->cannotBeEmpty()->end()

0 commit comments

Comments
 (0)