From 54d944efdede28f07e8d988d41ec076453f760ff Mon Sep 17 00:00:00 2001 From: lucaszz Date: Tue, 10 Nov 2015 13:46:58 +0100 Subject: [PATCH 1/4] Launcher moved to bundle. --- .travis.yml | 3 +- composer.json | 4 +- phpunit.xml.dist | 7 +- src/Command/CommandBusLaunchCommand.php | 2 +- src/Launcher/ArgumentsProcessor.php | 43 +++++++++ src/Launcher/CommandCollector.php | 32 +++++++ src/Launcher/CommandDoesNotExist.php | 7 ++ src/Launcher/CommandLauncher.php | 49 ++++++++++ src/Launcher/CommandLauncherException.php | 7 ++ src/Launcher/CommandReflection.php | 86 +++++++++++++++++ src/Launcher/InvalidCommandArgument.php | 7 ++ src/Launcher/MissingCommandArgument.php | 7 ++ src/Launcher/ValueConverter/IntConverter.php | 15 +++ src/Launcher/ValueConverter/UuidConverter.php | 17 ++++ .../ValueConverter/ValueConverter.php | 8 ++ src/Resources/config/services.yml | 10 +- tests/Launcher/ArgumentsProcessorTest.php | 55 +++++++++++ tests/Launcher/CommandCollectorTest.php | 65 +++++++++++++ tests/Launcher/CommandLauncherTest.php | 82 ++++++++++++++++ tests/Launcher/CommandReflectionTest.php | 95 +++++++++++++++++++ tests/Launcher/Mocks/DummyCommand.php | 18 ++++ tests/Launcher/Mocks/DummyCommandWithUuid.php | 20 ++++ .../ValueConverter/IntConverterTest.php | 36 +++++++ .../ValueConverter/UuidConverterTest.php | 38 ++++++++ 24 files changed, 703 insertions(+), 10 deletions(-) create mode 100644 src/Launcher/ArgumentsProcessor.php create mode 100644 src/Launcher/CommandCollector.php create mode 100644 src/Launcher/CommandDoesNotExist.php create mode 100644 src/Launcher/CommandLauncher.php create mode 100644 src/Launcher/CommandLauncherException.php create mode 100644 src/Launcher/CommandReflection.php create mode 100644 src/Launcher/InvalidCommandArgument.php create mode 100644 src/Launcher/MissingCommandArgument.php create mode 100644 src/Launcher/ValueConverter/IntConverter.php create mode 100644 src/Launcher/ValueConverter/UuidConverter.php create mode 100644 src/Launcher/ValueConverter/ValueConverter.php create mode 100644 tests/Launcher/ArgumentsProcessorTest.php create mode 100644 tests/Launcher/CommandCollectorTest.php create mode 100644 tests/Launcher/CommandLauncherTest.php create mode 100644 tests/Launcher/CommandReflectionTest.php create mode 100644 tests/Launcher/Mocks/DummyCommand.php create mode 100644 tests/Launcher/Mocks/DummyCommandWithUuid.php create mode 100644 tests/Launcher/ValueConverter/IntConverterTest.php create mode 100644 tests/Launcher/ValueConverter/UuidConverterTest.php diff --git a/.travis.yml b/.travis.yml index ac469bc..7550af1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,8 @@ install: - composer update --prefer-dist script: - - vendor/bin/phpunit + - vendor/bin/phpunit --testsuite unit + - vendor/bin/phpunit --testsuite command after_script: - vendor/bin/coveralls diff --git a/composer.json b/composer.json index 26b9db9..47ce009 100644 --- a/composer.json +++ b/composer.json @@ -12,12 +12,12 @@ "require": { "php": ">=5.5", "simple-bus/symfony-bridge": "^4.1", - "clearcodehq/command-bus-launcher": "dev-master", "symfony/framework-bundle": "~2.3", "symfony/console": "~2.3", "symfony/dependency-injection": "~2.3", "symfony/http-kernel": "~2.3", - "symfony/config": "~2.3" + "symfony/config": "~2.3", + "ramsey/uuid": "~3.0" }, "require-dev": { "phpunit/phpunit": "~4.0", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7e32b9c..7ec3b3d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,8 +3,13 @@ - + ./tests + ./tests/Command + + + + ./tests/Command diff --git a/src/Command/CommandBusLaunchCommand.php b/src/Command/CommandBusLaunchCommand.php index f959637..27fc08e 100644 --- a/src/Command/CommandBusLaunchCommand.php +++ b/src/Command/CommandBusLaunchCommand.php @@ -2,7 +2,7 @@ namespace ClearcodeHQ\CommandBusLauncherBundle\Command; -use ClearcodeHQ\CommandBusLauncher\CommandLauncherException; +use ClearcodeHQ\CommandBusLauncherBundle\Launcher\CommandLauncherException; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; diff --git a/src/Launcher/ArgumentsProcessor.php b/src/Launcher/ArgumentsProcessor.php new file mode 100644 index 0000000..a922707 --- /dev/null +++ b/src/Launcher/ArgumentsProcessor.php @@ -0,0 +1,43 @@ +valueConverters = $valueConverters; + } + + /** + * @param $arguments + * + * @return mixed + */ + public function process($arguments) + { + foreach ($arguments as $key => $argument) { + $arguments[$key] = $this->convertValue($argument); + } + + return $arguments; + } + + private function convertValue($value) + { + foreach ($this->valueConverters as $valueConverter) { + if (null !== $convertedValue = $valueConverter->convert($value)) { + return $convertedValue; + } + } + + return $value; + } +} diff --git a/src/Launcher/CommandCollector.php b/src/Launcher/CommandCollector.php new file mode 100644 index 0000000..db3a8d4 --- /dev/null +++ b/src/Launcher/CommandCollector.php @@ -0,0 +1,32 @@ +commands[] = CommandReflection::fromClass($service); + } + } + + public function getCommandByName($commandName) + { + foreach ($this->commands as $command) { + if ($command->commandName == $commandName) { + return $command; + } + } + + throw new CommandDoesNotExist(sprintf("Command '%s' does not exists", $commandName)); + } +} diff --git a/src/Launcher/CommandDoesNotExist.php b/src/Launcher/CommandDoesNotExist.php new file mode 100644 index 0000000..6a205bf --- /dev/null +++ b/src/Launcher/CommandDoesNotExist.php @@ -0,0 +1,7 @@ +commandCollector = $commandCollector; + $this->argumentsProcessor = $argumentsProcessor; + } + + /** + * @param $commandName + * + * @return CommandReflection + * + * @throws CommandDoesNotExist + */ + public function getCommandReflection($commandName) + { + return $this->commandCollector->getCommandByName($commandName); + } + + /** + * @param $commandName + * @param $arguments + * + * @return object + * + * @throws CommandDoesNotExist + */ + public function getCommandToLaunch($commandName, $arguments) + { + $commandReflection = $this->commandCollector->getCommandByName($commandName); + + return $commandReflection->createCommand($arguments, $this->argumentsProcessor); + } +} diff --git a/src/Launcher/CommandLauncherException.php b/src/Launcher/CommandLauncherException.php new file mode 100644 index 0000000..3dcf430 --- /dev/null +++ b/src/Launcher/CommandLauncherException.php @@ -0,0 +1,7 @@ +commandName = $commandName; + $this->commandClass = $commandClass; + } + + /** + * @param $className + * + * @return CommandReflection + */ + public static function fromClass($className) + { + $reflection = new \ReflectionClass($className); + + return new self($reflection->getShortName(), $className); + } + + /** + * @return \ReflectionParameter[] + */ + public function parameters() + { + $commandReflection = new \ReflectionClass($this->commandClass); + $commandParameters = $commandReflection->getConstructor()->getParameters(); + + return $commandParameters; + } + + /** + * @param array $arguments + * @param ArgumentsProcessor $argumentsProcessor + * + * @return object + * + * @throws InvalidCommandArgument + * @throws MissingCommandArgument + */ + public function createCommand(array $arguments, ArgumentsProcessor $argumentsProcessor) + { + $classReflection = new \ReflectionClass($this->commandClass); + + $inputArguments = $argumentsProcessor->process($arguments); + + foreach ($this->parameters() as $commandArgument) { + if ($commandArgument->getClass() !== null) { + if (!array_key_exists($commandArgument->getPosition(), $inputArguments)) { + throw new MissingCommandArgument( + sprintf("Missing argument %s for '%s' command", $commandArgument->getPosition() + 1, $this->commandName) + ); + } + + $givenArgument = $inputArguments[$commandArgument->getPosition()]; + $requiredArgumentClass = $commandArgument->getClass()->name; + + if (!is_object($givenArgument) || !$givenArgument instanceof $requiredArgumentClass) { + throw new InvalidCommandArgument( + sprintf( + "Invalid argument for '%s' command. Expected parameter %s to be instance of '%s'", + $this->commandName, + $commandArgument->getPosition() + 1, + $requiredArgumentClass + ) + ); + } + } + } + + return $classReflection->newInstanceArgs($inputArguments); + } +} diff --git a/src/Launcher/InvalidCommandArgument.php b/src/Launcher/InvalidCommandArgument.php new file mode 100644 index 0000000..0cb0f3d --- /dev/null +++ b/src/Launcher/InvalidCommandArgument.php @@ -0,0 +1,7 @@ +sut->process(['first_arg', 'second_arg']); + + \PHPUnit_Framework_Assert::assertEquals('first_arg', $arguments[0]); + \PHPUnit_Framework_Assert::assertEquals('second_arg', $arguments[1]); + } + + /** + * @tests + */ + public function it_converts_numeric_strings_to_integer() + { + $arguments = $this->sut->process(['123', 'string_arg']); + + \PHPUnit_Framework_Assert::assertTrue(123 === $arguments[0]); + \PHPUnit_Framework_Assert::assertEquals('string_arg', $arguments[1]); + } + + /** + * @tests + */ + public function it_converts_uuid_like_strings_to_uuid_object() + { + $arguments = $this->sut->process(['b1b250a0-938a-48f6-b0ca-0aeccff1288e']); + + \PHPUnit_Framework_Assert::assertTrue( + Uuid::fromString('b1b250a0-938a-48f6-b0ca-0aeccff1288e')->equals($arguments[0]) + ); + } + + public function setUp() + { + $this->sut = new ArgumentsProcessor([new IntConverter(), new UuidConverter()]); + } +} diff --git a/tests/Launcher/CommandCollectorTest.php b/tests/Launcher/CommandCollectorTest.php new file mode 100644 index 0000000..22546c1 --- /dev/null +++ b/tests/Launcher/CommandCollectorTest.php @@ -0,0 +1,65 @@ +sut->processCommandServices($this->commands); + + \PHPUnit_Framework_Assert::assertEquals( + 'DummyCommand', + $this->sut->getCommandByName('DummyCommand')->commandName + ); + } + + /** + * @test + */ + public function it_returns_command_reflection_by_command_name() + { + $this->sut->processCommandServices($this->commands); + + $command = $this->sut->getCommandByName('DummyCommand'); + + \PHPUnit_Framework_Assert::assertInstanceOf(CommandReflection::class, $command); + } + + /** + * @test + * @expectedException \ClearcodeHQ\CommandBusLauncherBundle\Launcher\CommandDoesNotExist + */ + public function it_throws_exception_when_command_does_not_exist() + { + $this->sut->processCommandServices($this->commands); + + $this->sut->getCommandByName('UnexistingCommand'); + } + + public function setUp() + { + $this->sut = new CommandCollector(); + + $this->commands = [ + DummyCommand::class, + ]; + } +} diff --git a/tests/Launcher/CommandLauncherTest.php b/tests/Launcher/CommandLauncherTest.php new file mode 100644 index 0000000..6c42393 --- /dev/null +++ b/tests/Launcher/CommandLauncherTest.php @@ -0,0 +1,82 @@ +commandCollector->getCommandByName('DummyCommand')->willReturn( + CommandReflection::fromClass(DummyCommand::class) + ); + + $this->argumentsProcessor->process(['lorem ipsum', '123'])->willReturn( + ['lorem ipsum', 123] + ); + + $command = $this->sut->getCommandToLaunch('DummyCommand', ['lorem ipsum', 123]); + + $this->assertInstanceOf(DummyCommand::class, $command); + $this->assertTrue(123 === $command->argument2); + } + + /** + * @test + */ + public function it_returns_command_with_uuid_to_launch() + { + $this->commandCollector->getCommandByName('DummyCommandWithUuid')->willReturn( + CommandReflection::fromClass(DummyCommandWithUuid::class) + ); + + $this->argumentsProcessor->process(['lorem ipsum', 'a1df6294-bcd9-43c5-8731-e3cd43401974'])->willReturn( + ['lorem ipsum', Uuid::fromString('a1df6294-bcd9-43c5-8731-e3cd43401974')] + ); + + $command = $this->sut->getCommandToLaunch('DummyCommandWithUuid', ['lorem ipsum', 'a1df6294-bcd9-43c5-8731-e3cd43401974']); + + $this->assertInstanceOf(DummyCommandWithUuid::class, $command); + $this->assertTrue(Uuid::fromString('a1df6294-bcd9-43c5-8731-e3cd43401974')->equals($command->argument2)); + } + + /** + * @test + */ + public function it_returns_command_reflection() + { + $this->commandCollector->getCommandByName('DummyCommand')->willReturn( + CommandReflection::fromClass(DummyCommand::class) + ); + + $commandReflection = $this->sut->getCommandReflection('DummyCommand'); + + $this->assertInstanceOf(CommandReflection::class, $commandReflection); + } + + public function setUp() + { + $this->commandCollector = $this->prophesize(CommandCollector::class); + $this->argumentsProcessor = $this->prophesize(ArgumentsProcessor::class); + + $this->sut = new CommandLauncher($this->commandCollector->reveal(), $this->argumentsProcessor->reveal()); + } +} diff --git a/tests/Launcher/CommandReflectionTest.php b/tests/Launcher/CommandReflectionTest.php new file mode 100644 index 0000000..7685ac5 --- /dev/null +++ b/tests/Launcher/CommandReflectionTest.php @@ -0,0 +1,95 @@ +createCommand($commandParameters, $argumentProcessor); + + \PHPUnit_Framework_Assert::assertInstanceOf(DummyCommand::class, $command); + \PHPUnit_Framework_Assert::assertEquals('lorem ipsum', $command->argument1); + \PHPUnit_Framework_Assert::assertTrue(2 === $command->argument2); + } + + /** + * @test + */ + public function it_returns_new_command_with_uuid_instance() + { + $argumentProcessor = new ArgumentsProcessor([new UuidConverter()]); + $commandReflection = CommandReflection::fromClass(DummyCommandWithUuid::class); + + $commandParameters = ['lorem ipsum', '1a67b1de-e3cb-471e-90d3-005341a29b3d']; + $command = $commandReflection->createCommand($commandParameters, $argumentProcessor); + + \PHPUnit_Framework_Assert::assertInstanceOf(DummyCommandWithUuid::class, $command); + \PHPUnit_Framework_Assert::assertEquals('lorem ipsum', $command->argument1); + \PHPUnit_Framework_Assert::assertTrue(Uuid::fromString('1a67b1de-e3cb-471e-90d3-005341a29b3d')->equals($command->argument2)); + } + + /** + * @test + */ + public function it_returns_command_constructor_parameters() + { + $commandReflection = CommandReflection::fromClass(DummyCommand::class); + + $commandParameters = $commandReflection->parameters(); + + \PHPUnit_Framework_Assert::assertEquals('argument1', $commandParameters[0]->name); + \PHPUnit_Framework_Assert::assertEquals('argument2', $commandParameters[1]->name); + } + + /** + * @test + * @expectedException \ClearcodeHQ\CommandBusLauncherBundle\Launcher\MissingCommandArgument + */ + public function it_does_not_returns_command_when_arguments_are_missing() + { + $argumentProcessor = new ArgumentsProcessor([new UuidConverter()]); + $commandReflection = CommandReflection::fromClass(DummyCommandWithUuid::class); + + $commandParameters = []; + $commandReflection->createCommand($commandParameters, $argumentProcessor); + } + + /** + * @test + * @expectedException \ClearcodeHQ\CommandBusLauncherBundle\Launcher\InvalidCommandArgument + */ + public function it_does_not_returns_command_when_invalid_arguments_are_given() + { + $argumentProcessor = new ArgumentsProcessor([new UuidConverter()]); + $commandReflection = CommandReflection::fromClass(DummyCommandWithUuid::class); + + $commandParameters = ['lorem ipsum', 2]; + $commandReflection->createCommand($commandParameters, $argumentProcessor); + } +} diff --git a/tests/Launcher/Mocks/DummyCommand.php b/tests/Launcher/Mocks/DummyCommand.php new file mode 100644 index 0000000..c3c8809 --- /dev/null +++ b/tests/Launcher/Mocks/DummyCommand.php @@ -0,0 +1,18 @@ +argument1 = $argument1; + $this->argument2 = $argument2; + } +} diff --git a/tests/Launcher/Mocks/DummyCommandWithUuid.php b/tests/Launcher/Mocks/DummyCommandWithUuid.php new file mode 100644 index 0000000..947962d --- /dev/null +++ b/tests/Launcher/Mocks/DummyCommandWithUuid.php @@ -0,0 +1,20 @@ +argument1 = $argument1; + $this->argument2 = $argumentUuid; + } +} diff --git a/tests/Launcher/ValueConverter/IntConverterTest.php b/tests/Launcher/ValueConverter/IntConverterTest.php new file mode 100644 index 0000000..4959f09 --- /dev/null +++ b/tests/Launcher/ValueConverter/IntConverterTest.php @@ -0,0 +1,36 @@ +sut->convert('123'); + + $this->assertTrue(123 === $int); + } + + /** + * @test + */ + public function it_does_not_converts_non_numeric_string_to_int() + { + $invalidInt = $this->sut->convert('string'); + + $this->assertTrue($invalidInt === null); + } + + public function setUp() + { + $this->sut = new IntConverter(); + } +} diff --git a/tests/Launcher/ValueConverter/UuidConverterTest.php b/tests/Launcher/ValueConverter/UuidConverterTest.php new file mode 100644 index 0000000..93ba46c --- /dev/null +++ b/tests/Launcher/ValueConverter/UuidConverterTest.php @@ -0,0 +1,38 @@ +sut->convert('9d3e2d0a-f4d0-496d-9a5f-a00fe99b2053'); + + $this->assertInstanceOf(Uuid::class, $uuid); + $this->assertTrue(Uuid::fromString('9d3e2d0a-f4d0-496d-9a5f-a00fe99b2053')->equals($uuid)); + } + + /** + * @test + */ + public function it_does_not_converts_invalid_string_to_uuid() + { + $uuid = $this->sut->convert('9d3efe99b2053'); + + $this->assertTrue($uuid === null); + } + + public function setUp() + { + $this->sut = new UuidConverter(); + } +} From 3cd4966113ec4c3274b1c8c408c7c2d306f00334 Mon Sep 17 00:00:00 2001 From: lucaszz Date: Tue, 10 Nov 2015 16:39:39 +0100 Subject: [PATCH 2/4] Logs should created only by travis --- .travis.yml | 3 +-- phpunit.xml.dist | 3 --- src/Launcher/CommandLauncher.php | 11 +++++------ tests/Launcher/CommandLauncherTest.php | 24 ++++++++++++++---------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7550af1..6b1fe7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,8 +26,7 @@ install: - composer update --prefer-dist script: - - vendor/bin/phpunit --testsuite unit - - vendor/bin/phpunit --testsuite command + - vendor/bin/phpunit --coverage-clover build/logs/clover.xml after_script: - vendor/bin/coveralls diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7ec3b3d..f264dab 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -23,7 +23,4 @@ - - - diff --git a/src/Launcher/CommandLauncher.php b/src/Launcher/CommandLauncher.php index 8b8aa50..1abb283 100644 --- a/src/Launcher/CommandLauncher.php +++ b/src/Launcher/CommandLauncher.php @@ -4,16 +4,15 @@ class CommandLauncher { - /** - * @var CommandCollector - */ + /** @var CommandCollector */ private $commandCollector; + /** @var ArgumentsProcessor */ + private $argumentsProcessor; /** - * @var ArgumentsProcessor + * @param CommandCollector $commandCollector + * @param ArgumentsProcessor $argumentsProcessor */ - private $argumentsProcessor; - public function __construct(CommandCollector $commandCollector, ArgumentsProcessor $argumentsProcessor) { $this->commandCollector = $commandCollector; diff --git a/tests/Launcher/CommandLauncherTest.php b/tests/Launcher/CommandLauncherTest.php index 6c42393..1227477 100644 --- a/tests/Launcher/CommandLauncherTest.php +++ b/tests/Launcher/CommandLauncherTest.php @@ -20,9 +20,7 @@ class CommandLauncherTest extends \PHPUnit_Framework_TestCase /** @var ArgumentsProcessor */ private $argumentsProcessor; - /** - * @test - */ + /** @test */ public function it_returns_command_with_integer_to_launch() { $this->commandCollector->getCommandByName('DummyCommand')->willReturn( @@ -39,9 +37,7 @@ public function it_returns_command_with_integer_to_launch() $this->assertTrue(123 === $command->argument2); } - /** - * @test - */ + /** @test */ public function it_returns_command_with_uuid_to_launch() { $this->commandCollector->getCommandByName('DummyCommandWithUuid')->willReturn( @@ -58,9 +54,7 @@ public function it_returns_command_with_uuid_to_launch() $this->assertTrue(Uuid::fromString('a1df6294-bcd9-43c5-8731-e3cd43401974')->equals($command->argument2)); } - /** - * @test - */ + /** @test */ public function it_returns_command_reflection() { $this->commandCollector->getCommandByName('DummyCommand')->willReturn( @@ -72,11 +66,21 @@ public function it_returns_command_reflection() $this->assertInstanceOf(CommandReflection::class, $commandReflection); } - public function setUp() + /** {@inheritdoc} */ + protected function setUp() { $this->commandCollector = $this->prophesize(CommandCollector::class); $this->argumentsProcessor = $this->prophesize(ArgumentsProcessor::class); $this->sut = new CommandLauncher($this->commandCollector->reveal(), $this->argumentsProcessor->reveal()); } + + /** {@inheritdoc} */ + protected function tearDown() + { + $this->commandCollector = null; + $this->argumentsProcessor = null; + + $this->sut = null; + } } From acbb76636609c74f551da51eddfc7c15426d0879 Mon Sep 17 00:00:00 2001 From: lucaszz Date: Thu, 12 Nov 2015 17:18:33 +0100 Subject: [PATCH 3/4] Rearrange folders --- composer.json | 4 ++-- .../Command/CommandBusLaunchCommand.php | 4 ++-- .../CommandBusLauncherBundle.php | 4 ++-- .../CommandBusLauncherExtension.php | 2 +- .../Compiler/CommandHandlersCompilerPass.php | 2 +- .../DependencyInjection/Configuration.php | 2 +- .../Resources/config/services.yml | 10 +++++----- .../ArgumentsProcessor.php | 4 ++-- .../CommandCollector.php | 2 +- .../CommandDoesNotExist.php | 2 +- .../CommandLauncher.php | 2 +- .../CommandLauncherException.php | 2 +- .../CommandReflection.php | 2 +- .../InvalidCommandArgument.php | 2 +- .../MissingCommandArgument.php | 2 +- .../ValueConverter/IntConverter.php | 2 +- .../ValueConverter/UuidConverter.php | 2 +- .../ValueConverter/ValueConverter.php | 2 +- .../App/TestKernel.php | 4 ++-- .../CommandBusLauncherBundle}/App/config.yml | 4 ++-- .../CommandBusLauncherBundle}/CLITestCase.php | 4 ++-- .../Command/CommandBusLaunchCommandTest.php | 8 ++++---- .../Mocks/DummyCommand.php | 2 +- .../Mocks/DummyCommandHandler.php | 2 +- .../ArgumentsProcessorTest.php | 8 ++++---- .../CommandCollectorTest.php | 10 +++++----- .../CommandLauncherTest.php | 14 +++++++------- .../CommandReflectionTest.php | 18 +++++++++--------- .../Mocks/DummyCommand.php | 2 +- .../Mocks/DummyCommandWithUuid.php | 2 +- .../ValueConverter/IntConverterTest.php | 4 ++-- .../ValueConverter/UuidConverterTest.php | 4 ++-- 32 files changed, 69 insertions(+), 69 deletions(-) rename src/{ => Bundle/CommandBusLauncherBundle}/Command/CommandBusLaunchCommand.php (93%) rename src/{ => Bundle/CommandBusLauncherBundle}/CommandBusLauncherBundle.php (67%) rename src/{ => Bundle/CommandBusLauncherBundle}/DependencyInjection/CommandBusLauncherExtension.php (89%) rename src/{ => Bundle/CommandBusLauncherBundle}/DependencyInjection/Compiler/CommandHandlersCompilerPass.php (90%) rename src/{ => Bundle/CommandBusLauncherBundle}/DependencyInjection/Configuration.php (84%) rename src/{ => Bundle/CommandBusLauncherBundle}/Resources/config/services.yml (54%) rename src/{Launcher => CommandBusLauncher}/ArgumentsProcessor.php (85%) rename src/{Launcher => CommandBusLauncher}/CommandCollector.php (92%) rename src/{Launcher => CommandBusLauncher}/CommandDoesNotExist.php (55%) rename src/{Launcher => CommandBusLauncher}/CommandLauncher.php (95%) rename src/{Launcher => CommandBusLauncher}/CommandLauncherException.php (52%) rename src/{Launcher => CommandBusLauncher}/CommandReflection.php (97%) rename src/{Launcher => CommandBusLauncher}/InvalidCommandArgument.php (56%) rename src/{Launcher => CommandBusLauncher}/MissingCommandArgument.php (56%) rename src/{Launcher => CommandBusLauncher}/ValueConverter/IntConverter.php (74%) rename src/{Launcher => CommandBusLauncher}/ValueConverter/UuidConverter.php (78%) rename src/{Launcher => CommandBusLauncher}/ValueConverter/ValueConverter.php (51%) rename tests/{ => Bundle/CommandBusLauncherBundle}/App/TestKernel.php (87%) rename tests/{ => Bundle/CommandBusLauncherBundle}/App/config.yml (64%) rename tests/{ => Bundle/CommandBusLauncherBundle}/CLITestCase.php (92%) rename tests/{ => Bundle/CommandBusLauncherBundle}/Command/CommandBusLaunchCommandTest.php (86%) rename tests/{ => Bundle/CommandBusLauncherBundle}/Mocks/DummyCommand.php (83%) rename tests/{ => Bundle/CommandBusLauncherBundle}/Mocks/DummyCommandHandler.php (83%) rename tests/{Launcher => CommandBusLauncher}/ArgumentsProcessorTest.php (81%) rename tests/{Launcher => CommandBusLauncher}/CommandCollectorTest.php (77%) rename tests/{Launcher => CommandBusLauncher}/CommandLauncherTest.php (83%) rename tests/{Launcher => CommandBusLauncher}/CommandReflectionTest.php (81%) rename tests/{Launcher => CommandBusLauncher}/Mocks/DummyCommand.php (79%) rename tests/{Launcher => CommandBusLauncher}/Mocks/DummyCommandWithUuid.php (81%) rename tests/{Launcher => CommandBusLauncher}/ValueConverter/IntConverterTest.php (78%) rename tests/{Launcher => CommandBusLauncher}/ValueConverter/UuidConverterTest.php (82%) diff --git a/composer.json b/composer.json index 47ce009..79a07ff 100644 --- a/composer.json +++ b/composer.json @@ -24,9 +24,9 @@ "satooshi/php-coveralls": "^0.6.1" }, "autoload": { - "psr-4" : { "ClearcodeHQ\\CommandBusLauncherBundle\\": "src" } + "psr-4" : { "ClearcodeHQ\\": "src" } }, "autoload-dev": { - "psr-4" : { "tests\\ClearcodeHQ\\CommandBusLauncherBundle\\" : "tests" } + "psr-4" : { "tests\\ClearcodeHQ\\" : "tests" } } } diff --git a/src/Command/CommandBusLaunchCommand.php b/src/Bundle/CommandBusLauncherBundle/Command/CommandBusLaunchCommand.php similarity index 93% rename from src/Command/CommandBusLaunchCommand.php rename to src/Bundle/CommandBusLauncherBundle/Command/CommandBusLaunchCommand.php index 27fc08e..6ffccd4 100644 --- a/src/Command/CommandBusLaunchCommand.php +++ b/src/Bundle/CommandBusLauncherBundle/Command/CommandBusLaunchCommand.php @@ -1,8 +1,8 @@ Date: Thu, 12 Nov 2015 17:20:56 +0100 Subject: [PATCH 4/4] class const used --- tests/Bundle/CommandBusLauncherBundle/CLITestCase.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Bundle/CommandBusLauncherBundle/CLITestCase.php b/tests/Bundle/CommandBusLauncherBundle/CLITestCase.php index 9e9bd67..c87e9fe 100644 --- a/tests/Bundle/CommandBusLauncherBundle/CLITestCase.php +++ b/tests/Bundle/CommandBusLauncherBundle/CLITestCase.php @@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; +use tests\ClearcodeHQ\Bundle\CommandBusLauncherBundle\App\TestKernel; abstract class CLITestCase extends WebTestCase { @@ -19,7 +20,7 @@ public static function getKernelClass() { include_once __DIR__.'/App/TestKernel.php'; - return 'tests\ClearcodeHQ\Bundle\CommandBusLauncherBundle\App\TestKernel'; + return TestKernel::class; } /** {@inheritdoc} */