|
15 | 15 | use PHPUnit\Framework\TestCase;
|
16 | 16 | use Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration;
|
17 | 17 | use Symfony\Bundle\FullStack;
|
18 |
| -use Symfony\Component\Cache\Adapter\DoctrineAdapter; |
19 | 18 | use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
|
20 | 19 | use Symfony\Component\Config\Definition\Processor;
|
21 | 20 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
@@ -265,6 +264,91 @@ public function testLockMergeConfigs()
|
265 | 264 | );
|
266 | 265 | }
|
267 | 266 |
|
| 267 | + public function testMessengerWithoutPcntl() |
| 268 | + { |
| 269 | + $this->expectException(InvalidConfigurationException::class); |
| 270 | + $this->expectExceptionMessage('You must install pcntl extension in order to use stop_signals.'); |
| 271 | + $processor = new Processor(); |
| 272 | + $configuration = new Configuration(true); |
| 273 | + |
| 274 | + $processor->processConfiguration($configuration, [ |
| 275 | + 'framework' => [ |
| 276 | + 'messenger' => [ |
| 277 | + 'stop_signals' => \SIGTERM |
| 278 | + ], |
| 279 | + ], |
| 280 | + ]); |
| 281 | + } |
| 282 | + |
| 283 | + public function testMessengerWithoutPcntlWithoutStopSignals() |
| 284 | + { |
| 285 | + $processor = new Processor(); |
| 286 | + $configuration = new Configuration(true); |
| 287 | + |
| 288 | + $processor->processConfiguration($configuration, [ |
| 289 | + 'framework' => [ |
| 290 | + 'messenger' => [ |
| 291 | + ], |
| 292 | + ], |
| 293 | + ]); |
| 294 | + |
| 295 | + $this->expectNotToPerformAssertions(); |
| 296 | + } |
| 297 | + |
| 298 | + public function testMessengerWithInvalidSignal() |
| 299 | + { |
| 300 | + $this->expectException(InvalidConfigurationException::class); |
| 301 | + $this->expectExceptionMessage('Invalid signal passed to stop_signals'); |
| 302 | + $processor = new Processor(); |
| 303 | + $configuration = new Configuration(true); |
| 304 | + |
| 305 | + $processor->processConfiguration($configuration, [ |
| 306 | + 'framework' => [ |
| 307 | + 'messenger' => [ |
| 308 | + 'stop_signals' => \SIG_IGN |
| 309 | + ], |
| 310 | + ], |
| 311 | + ]); |
| 312 | + } |
| 313 | + |
| 314 | + public function testMessengerWithMultipleStopSignals() |
| 315 | + { |
| 316 | + $processor = new Processor(); |
| 317 | + $configuration = new Configuration(true); |
| 318 | + |
| 319 | + $config = $processor->processConfiguration($configuration, [ |
| 320 | + 'framework' => [ |
| 321 | + 'messenger' => [ |
| 322 | + 'stop_signals' => [\SIGTERM, \SIGQUIT] |
| 323 | + ], |
| 324 | + ], |
| 325 | + ]); |
| 326 | + |
| 327 | + static::assertEquals( |
| 328 | + [\SIGTERM, \SIGQUIT], |
| 329 | + $config['messenger']['stop_signals'] |
| 330 | + ); |
| 331 | + } |
| 332 | + |
| 333 | + public function testMessengerWithStringStopSignal() |
| 334 | + { |
| 335 | + $processor = new Processor(); |
| 336 | + $configuration = new Configuration(true); |
| 337 | + |
| 338 | + $config = $processor->processConfiguration($configuration, [ |
| 339 | + 'framework' => [ |
| 340 | + 'messenger' => [ |
| 341 | + 'stop_signals' => ['SIGTERM', 'SIGQUIT'] |
| 342 | + ], |
| 343 | + ], |
| 344 | + ]); |
| 345 | + |
| 346 | + static::assertEquals( |
| 347 | + [\SIGTERM, \SIGQUIT], |
| 348 | + $config['messenger']['stop_signals'] |
| 349 | + ); |
| 350 | + } |
| 351 | + |
268 | 352 | public function testItShowANiceMessageIfTwoMessengerBusesAreConfiguredButNoDefaultBus()
|
269 | 353 | {
|
270 | 354 | $expectedMessage = 'You must specify the "default_bus" if you define more than one bus.';
|
@@ -502,7 +586,7 @@ protected static function getBundleDefaultConfig()
|
502 | 586 | 'default_redis_provider' => 'redis://localhost',
|
503 | 587 | 'default_memcached_provider' => 'memcached://localhost',
|
504 | 588 | 'default_doctrine_dbal_provider' => 'database_connection',
|
505 |
| - 'default_pdo_provider' => ContainerBuilder::willBeAvailable('doctrine/dbal', Connection::class, ['symfony/framework-bundle']) && class_exists(DoctrineAdapter::class) ? 'database_connection' : null, |
| 589 | + 'default_pdo_provider' => ContainerBuilder::willBeAvailable('doctrine/dbal', Connection::class, ['symfony/framework-bundle']) ? 'database_connection' : null, |
506 | 590 | 'prefix_seed' => '_%kernel.project_dir%.%kernel.container_class%',
|
507 | 591 | ],
|
508 | 592 | 'workflows' => [
|
|
0 commit comments