Skip to content

Commit

Permalink
Merge pull request #205 from lepiaf/support-php8
Browse files Browse the repository at this point in the history
Add support for PHP 8
  • Loading branch information
Olivier Dolbeau authored Dec 16, 2020
2 parents 46e70ac + a2952ff commit 33a0a46
Show file tree
Hide file tree
Showing 22 changed files with 82 additions and 80 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
matrix:
fast_finish: true
include:
- php: 8.0
- php: 7.3
- php: 7.2
env: COMPOSER_FLAGS="--prefer-lowest --prefer-stable" PHPUNIT_FLAGS="--exclude-group legacy" # See https://github.com/symfony/symfony/issues/22515
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/SwarrotExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function buildCommand(ContainerBuilder $container, string $name, array $c
->addTag('console.command', [
'command' => 'swarrot:consume:'.$name,
])
->setPublic(true)
;

return $id;
Expand Down
8 changes: 4 additions & 4 deletions Tests/Broker/AmqpLibFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ public function getConnectionData(string $name): array
};
}

public function test_get_publisher_with_unknown_connection()
public function testGetPublisherWithUnknownConnection()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unknown connection "connection". Available: []');

$this->factory->getMessagePublisher('exchange', 'connection');
}

public function test_a_connection_can_be_added()
public function testAConnectionCanBeAdded()
{
$connectionData = [
'host' => 'rabbitmq_host',
Expand All @@ -50,7 +50,7 @@ public function test_a_connection_can_be_added()
$this->assertSame($connectionData, $this->factory->getConnectionData('connection'));
}

public function test_a_connection_can_be_added_using_an_url()
public function testAConnectionCanBeAddedUsingAnUrl()
{
$url = 'amqp://rabbitmq_login:rabbitmq_password@rabbitmq_host:5672/swarrot';

Expand All @@ -68,7 +68,7 @@ public function test_a_connection_can_be_added_using_an_url()
], $this->factory->getConnectionData('connection'));
}

public function test_it_throws_an_exception_if_the_url_is_invalid()
public function testItThrowsAnExceptionIfTheUrlIsInvalid()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid connection URL given: "bloup"');
Expand Down
10 changes: 5 additions & 5 deletions Tests/Broker/PeclFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ protected function setUp(): void
}
}

public function test_it_is_initializable()
public function testItIsInitializable()
{
$factory = new PeclFactory();
$this->assertInstanceOf('Swarrot\SwarrotBundle\Broker\PeclFactory', $factory);
}

public function test_get_publisher_with_unknown_connection()
public function testGetPublisherWithUnknownConnection()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unknown connection "connection". Available: []');
Expand All @@ -31,7 +31,7 @@ public function test_get_publisher_with_unknown_connection()
$factory->getMessagePublisher('exchange', 'connection');
}

public function test_get_publisher_with_known_connection()
public function testGetPublisherWithKnownConnection()
{
$logger = $this->prophesize('Psr\Log\LoggerInterface');
$factory = new PeclFactory($logger->reveal());
Expand All @@ -41,7 +41,7 @@ public function test_get_publisher_with_known_connection()
$this->assertInstanceOf('Swarrot\Broker\MessagePublisher\PeclPackageMessagePublisher', $publisher);
}

public function test_get_publisher_with_connection_build_from_url()
public function testGetPublisherWithConnectionBuildFromUrl()
{
$url = 'amqp://localhost:5672/swarrot';

Expand All @@ -54,7 +54,7 @@ public function test_get_publisher_with_connection_build_from_url()
$this->assertInstanceOf('Swarrot\Broker\MessagePublisher\PeclPackageMessagePublisher', $publisher);
}

public function test_it_throws_an_exception_if_the_url_is_invalid()
public function testItThrowsAnExceptionIfTheUrlIsInvalid()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid connection URL given: "bloup"');
Expand Down
6 changes: 3 additions & 3 deletions Tests/Broker/PublisherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class PublisherTest extends TestCase
{
public function test_it_is_initializable()
public function testItIsInitializable()
{
$publisher = new Publisher(
$this->prophesize('Swarrot\SwarrotBundle\Broker\FactoryInterface')->reveal(),
Expand All @@ -20,7 +20,7 @@ public function test_it_is_initializable()
$this->assertInstanceOf('Swarrot\SwarrotBundle\Broker\Publisher', $publisher);
}

public function test_publish_with_unknown_message_type()
public function testPublishWithUnknownMessageType()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unknown message type "message_type". Available are [].');
Expand All @@ -34,7 +34,7 @@ public function test_publish_with_unknown_message_type()
$publisher->publish('message_type', $message);
}

public function test_publish_with_valid_message_type()
public function testPublishWithValidMessageType()
{
if (!class_exists('Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy')) {
$this->markTestSkipped('The LegacyEventDispatcherProxy class is not available');
Expand Down
4 changes: 2 additions & 2 deletions Tests/Command/SwarrotCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class SwarrotCommandTest extends TestCase
{
public function test_it_add_options_from_processor_configurators()
public function testItAddOptionsFromProcessorConfigurators()
{
$processor = $this->prophesize('Swarrot\Processor\ProcessorInterface');
$factory = $this->prophesize('Swarrot\SwarrotBundle\Broker\FactoryInterface');
Expand All @@ -39,7 +39,7 @@ public function test_it_add_options_from_processor_configurators()
/**
* @dataProvider it_merges_arguments_from_config_and_command_line_dataprovider
*/
public function test_it_merges_arguments_from_config_and_command_line($commandOptions, $extras, $expectedResolvedOptions)
public function testItMergesArgumentsFromConfigAndCommandLine($commandOptions, $extras, $expectedResolvedOptions)
{
$factory = $this->prophesize('Swarrot\SwarrotBundle\Broker\FactoryInterface');
$messageProvider = $this->prophesize('Swarrot\Broker\MessageProvider\MessageProviderInterface');
Expand Down
14 changes: 7 additions & 7 deletions Tests/DependencyInjection/Compiler/ProviderCompilerPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

class ProviderCompilerPassTest extends TestCase
{
public function test_it_is_initializable()
public function testItIsInitializable()
{
$this->assertInstanceOf(
'Swarrot\\SwarrotBundle\\DependencyInjection\\Compiler\\ProviderCompilerPass',
new ProviderCompilerPass()
);
}

public function test_should_not_run_if_already_declared()
public function testShouldNotRunIfAlreadyDeclared()
{
$container = $this->prophesize('Symfony\\Component\\DependencyInjection\\ContainerBuilder');

Expand All @@ -32,7 +32,7 @@ public function test_should_not_run_if_already_declared()
$compiler->process($container->reveal());
}

public function test_should_not_run_if_not_configured()
public function testShouldNotRunIfNotConfigured()
{
$container = $this->prophesize('Symfony\\Component\\DependencyInjection\\ContainerBuilder');

Expand All @@ -48,7 +48,7 @@ public function test_should_not_run_if_not_configured()
$compiler->process($container->reveal());
}

public function test_missing_alias()
public function testMissingAlias()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The provider\'s alias is no defined for the service "foo"');
Expand All @@ -71,7 +71,7 @@ public function test_missing_alias()
$compiler->process($container->reveal());
}

public function test_unexistant_provider()
public function testUnexistantProvider()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid provider "foo"');
Expand Down Expand Up @@ -104,7 +104,7 @@ public function test_unexistant_provider()
$compiler->process($container->reveal());
}

public function test_invalid_provider()
public function testInvalidProvider()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The provider "foo.bar" is not valid');
Expand Down Expand Up @@ -147,7 +147,7 @@ public function test_invalid_provider()
$compiler->process($container->reveal());
}

public function test_successful_provider()
public function testSuccessfulProvider()
{
$container = $this->prophesize('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
$definition = $this->prophesize('Symfony\\Component\\DependencyInjection\\Definition');
Expand Down
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ConfigurationTest extends TestCase
{
public function test_with_default_configuration()
public function testWithDefaultConfiguration()
{
$parser = new Parser();
$config = $parser->parse(file_get_contents(__DIR__.'/../fixtures/default_configuration.yml'));
Expand Down
16 changes: 8 additions & 8 deletions Tests/DependencyInjection/SwarrotExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class SwarrotExtensionTest extends TestCase
{
public function test_it_uses_the_default_connection_for_message_types()
public function testItUsesTheDefaultConnectionForMessageTypes()
{
$container = $this->createContainer();
$config = [
Expand All @@ -33,7 +33,7 @@ public function test_it_uses_the_default_connection_for_message_types()
$this->assertEquals($expectedMessageType, $messagesTypes['test']);
}

public function test_it_registers_commands()
public function testItRegistersCommands()
{
$container = $this->createContainer();
$config = [
Expand Down Expand Up @@ -77,7 +77,7 @@ public function test_it_registers_commands()
$this->assertEquals(['foo' => 'bar'], $method[1][0]);
}

public function test_it_registers_the_collector_by_default_in_debug_mode()
public function testItRegistersTheCollectorByDefaultInDebugMode()
{
$container = $this->createContainer();

Expand All @@ -86,7 +86,7 @@ public function test_it_registers_the_collector_by_default_in_debug_mode()
$this->assertHasService($container, 'swarrot.data_collector');
}

public function test_it_does_not_register_the_collector_by_default_in_non_debug_mode()
public function testItDoesNotRegisterTheCollectorByDefaultInNonDebugMode()
{
$container = $this->createContainer(false);

Expand All @@ -95,7 +95,7 @@ public function test_it_does_not_register_the_collector_by_default_in_non_debug_
$this->assertNotHasService($container, 'swarrot.data_collector');
}

public function test_it_does_not_register_the_collector_when_explicitly_disabled()
public function testItDoesNotRegisterTheCollectorWhenExplicitlyDisabled()
{
$container = $this->createContainer();

Expand All @@ -104,7 +104,7 @@ public function test_it_does_not_register_the_collector_when_explicitly_disabled
$this->assertNotHasService($container, 'swarrot.data_collector');
}

public function test_it_registers_the_collector_when_explicitly_enabled()
public function testItRegistersTheCollectorWhenExplicitlyEnabled()
{
$container = $this->createContainer(false);

Expand All @@ -113,7 +113,7 @@ public function test_it_registers_the_collector_when_explicitly_enabled()
$this->assertHasService($container, 'swarrot.data_collector');
}

public function test_it_use_the_asked_logger_with_new_key()
public function testItUseTheAskedLoggerWithNewKey()
{
$container = $this->createContainer(false);

Expand All @@ -125,7 +125,7 @@ public function test_it_use_the_asked_logger_with_new_key()
$this->assertEquals('my_awesome_logger', (string) $alias);
}

public function test_it_exposes_the_publisher_service()
public function testItExposesThePublisherService()
{
$container = $this->createContainer(false);
$this->loadConfig($container);
Expand Down
12 changes: 6 additions & 6 deletions Tests/Processor/Ack/AckProcessorConfiguratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class AckProcessorConfiguratorTest extends ProcessorConfiguratorTestCase
{
public function test_it_is_initializable()
public function testItIsInitializable()
{
$configurator = new AckProcessorConfigurator(
'Swarrot\Processor\Ack\AckProcessor',
Expand All @@ -17,7 +17,7 @@ public function test_it_is_initializable()
$this->assertInstanceOf('Swarrot\SwarrotBundle\Processor\Ack\AckProcessorConfigurator', $configurator);
}

public function test_it_used_default_extra()
public function testItUsedDefaultExtra()
{
$configurator = new AckProcessorConfigurator(
'Swarrot\Processor\Ack\AckProcessor',
Expand All @@ -30,7 +30,7 @@ public function test_it_used_default_extra()
$this->assertSame(['requeue_on_error' => true], $configurator->resolveOptions($input));
}

public function test_it_used_user_input()
public function testItUsedUserInput()
{
$configurator = new AckProcessorConfigurator(
'Swarrot\Processor\Ack\AckProcessor',
Expand All @@ -44,7 +44,7 @@ public function test_it_used_user_input()
$this->assertSame(['requeue_on_error' => true], $configurator->resolveOptions($input));
}

public function test_it_used_default_value()
public function testItUsedDefaultValue()
{
$configurator = new AckProcessorConfigurator(
'Swarrot\Processor\Ack\AckProcessor',
Expand All @@ -58,7 +58,7 @@ public function test_it_used_default_value()
$this->assertSame(['requeue_on_error' => false], $configurator->resolveOptions($input));
}

public function test_it_is_disablable()
public function testItIsDisablable()
{
$configurator = new AckProcessorConfigurator(
'Swarrot\Processor\Ack\AckProcessor',
Expand All @@ -71,7 +71,7 @@ public function test_it_is_disablable()
$this->assertFalse($configurator->isEnabled());
}

public function test_it_can_returns_a_valid_processor()
public function testItCanReturnsAValidProcessor()
{
$stubLogger = $this->prophesize('Psr\Log\LoggerInterface')->reveal();
$stubMessageProvider = $this->prophesize('Swarrot\Broker\MessageProvider\MessageProviderInterface')->reveal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class ConnectionProcessorConfiguratorTest extends ProcessorConfiguratorTestCase
{
public function test_it_is_initializable()
public function testItIsInitializable()
{
$configurator = new ConnectionProcessorConfigurator(
'Swarrot\Processor\Doctrine\ConnectionProcessor',
Expand All @@ -19,7 +19,7 @@ public function test_it_is_initializable()
);
}

public function test_it_resolves_options()
public function testItResolvesOptions()
{
$configurator = new ConnectionProcessorConfigurator(
'Swarrot\Processor\Doctrine\ConnectionProcessor',
Expand All @@ -31,7 +31,7 @@ public function test_it_resolves_options()
$this->assertSame([], $configurator->resolveOptions($input));
}

public function test_it_can_returns_a_valid_processor()
public function testItCanReturnsAValidProcessor()
{
$dummyConnection = [$this->prophesize('Doctrine\DBAL\Connection')->reveal()];

Expand Down
Loading

0 comments on commit 33a0a46

Please sign in to comment.