From b7706c15d0c35395a4483a556aac6378dbe4ae3f Mon Sep 17 00:00:00 2001 From: Davide Fedrigo Date: Wed, 29 Jul 2015 18:22:14 +0200 Subject: [PATCH 1/5] Refactor namespace adding vendor name --- composer.json | 4 ++-- examples/data_handler.php | 10 +++++----- .../DependencyInjection/Configuration.php | 2 +- .../PatchManagerCompilerPass.php | 2 +- .../PatchManagerExtension.php | 2 +- .../Bundle/PatchManagerBundle.php | 4 ++-- .../RequestAdapter/RequestStackAdapter.php | 6 +++--- src/PatchManager/Event/PatchManagerEvent.php | 6 +++--- src/PatchManager/Event/PatchManagerEvents.php | 2 +- .../Exception/HandlerNotFoundException.php | 2 +- .../Exception/InvalidJsonRequestContent.php | 2 +- .../Exception/MissingOperationNameRequest.php | 2 +- .../Exception/MissingOperationRequest.php | 2 +- .../NonExistentOperationException.php | 2 +- .../Exception/PatchManagerException.php | 2 +- .../Handler/DataDoctrineHandler.php | 4 ++-- src/PatchManager/Handler/DataHandler.php | 6 +++--- src/PatchManager/Handler/FiniteHandler.php | 6 +++--- src/PatchManager/MatchedPatchOperation.php | 2 +- src/PatchManager/OperationData.php | 4 ++-- src/PatchManager/OperationMatcher.php | 4 ++-- src/PatchManager/PatchManager.php | 8 ++++---- src/PatchManager/PatchOperationHandler.php | 2 +- src/PatchManager/Patchable.php | 2 +- src/PatchManager/Request/Adapter.php | 2 +- src/PatchManager/Request/Operations.php | 8 ++++---- .../PatchManagerCompilerPassTest.php | 4 ++-- .../Bundle/PatchManagerBundleTest.php | 6 +++--- .../RequestStackAdapterTest.php | 6 +++--- .../Handler/DataDoctrineHandlerTest.php | 8 ++++---- .../PatchManager/Handler/DataHandlerTest.php | 8 ++++---- .../Handler/FiniteHandlerTest.php | 8 ++++---- .../MatchedPatchOperationTest.php | 8 ++++---- tests/PatchManager/OperationDataTest.php | 4 ++-- tests/PatchManager/OperationMatcherTest.php | 8 ++++---- tests/PatchManager/PatchManagerTest.php | 19 ++++++++++--------- tests/PatchManager/PatchManagerTestCase.php | 4 ++-- tests/PatchManager/Request/OperationsTest.php | 17 ++++++++++------- 38 files changed, 101 insertions(+), 97 deletions(-) diff --git a/composer.json b/composer.json index 5b8f56f..b834682 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,8 @@ }, "autoload": { "psr-4": { - "PatchManager\\": "src/PatchManager/", - "PatchManager\\Tests\\": "tests/PatchManager/" + "Cypress\\PatchManager\\": "src/PatchManager/", + "Cypress\\PatchManager\\Tests\\": "tests/PatchManager/" } }, "license": "LGPL-3.0+", diff --git a/examples/data_handler.php b/examples/data_handler.php index 56ac2c8..8c2eba4 100644 --- a/examples/data_handler.php +++ b/examples/data_handler.php @@ -2,12 +2,12 @@ require_once __DIR__.'/../vendor/autoload.php'; -use PatchManager\Request\Operations; -use PatchManager\OperationMatcher; -use PatchManager\Handler\DataHandler; -use PatchManager\PatchManager; +use Cypress\PatchManager\Request\Operations; +use Cypress\PatchManager\OperationMatcher; +use Cypress\PatchManager\Handler\DataHandler; +use Cypress\PatchManager\PatchManager; -class Subject implements \PatchManager\Patchable +class Subject implements \Cypress\PatchManager\Patchable { private $a = 1; diff --git a/src/PatchManager/Bundle/DependencyInjection/Configuration.php b/src/PatchManager/Bundle/DependencyInjection/Configuration.php index 5bed766..6a1eb04 100644 --- a/src/PatchManager/Bundle/DependencyInjection/Configuration.php +++ b/src/PatchManager/Bundle/DependencyInjection/Configuration.php @@ -1,6 +1,6 @@ Date: Wed, 29 Jul 2015 21:39:09 +0200 Subject: [PATCH 2/5] fix tests --- .gitignore | 1 + .../PatchManagerCompilerPassTest.php | 1 + tests/PatchManager/Handler/DataDoctrineHandlerTest.php | 2 +- tests/PatchManager/OperationMatcherTest.php | 6 +++--- tests/PatchManager/PatchManagerTest.php | 6 +++--- tests/PatchManager/PatchManagerTestCase.php | 2 +- tests/PatchManager/Request/OperationsTest.php | 10 ++++------ 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 1bfef2a..3d17b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vendor node_modules bin +phpunit.xml \ No newline at end of file diff --git a/tests/PatchManager/Bundle/DependencyInjection/PatchManagerCompilerPassTest.php b/tests/PatchManager/Bundle/DependencyInjection/PatchManagerCompilerPassTest.php index 6846690..0c94972 100644 --- a/tests/PatchManager/Bundle/DependencyInjection/PatchManagerCompilerPassTest.php +++ b/tests/PatchManager/Bundle/DependencyInjection/PatchManagerCompilerPassTest.php @@ -2,6 +2,7 @@ namespace Cypress\PatchManager\Tests\Bundle\DependencyInjection; +use Cypress\PatchManager\Bundle\DependencyInjection\PatchManagerCompilerPass; use Cypress\PatchManager\Tests\PatchManagerTestCase; use Mockery as m; use Symfony\Component\DependencyInjection\Reference; diff --git a/tests/PatchManager/Handler/DataDoctrineHandlerTest.php b/tests/PatchManager/Handler/DataDoctrineHandlerTest.php index 934cf12..93860d0 100644 --- a/tests/PatchManager/Handler/DataDoctrineHandlerTest.php +++ b/tests/PatchManager/Handler/DataDoctrineHandlerTest.php @@ -34,7 +34,7 @@ public function setUp() $this->metadata->shouldReceive('getAssociationTargetClass')->andReturn('TestClass'); $this->metadata->shouldReceive('getTypeOfField')->andReturnNull()->byDefault(); $this->em->shouldReceive('getMetadataFactory->getMetadataFor') - ->with('PatchManager\Handler\DataDoctrineSubject') + ->with('Cypress\PatchManager\Handler\DataDoctrineSubject') ->andReturn($this->metadata); $this->handler = new DataDoctrineHandler($this->em); } diff --git a/tests/PatchManager/OperationMatcherTest.php b/tests/PatchManager/OperationMatcherTest.php index 2d89fca..e96d404 100644 --- a/tests/PatchManager/OperationMatcherTest.php +++ b/tests/PatchManager/OperationMatcherTest.php @@ -23,7 +23,7 @@ class OperationMatcherTest extends PatchManagerTestCase public function setUp() { parent::setUp(); - $operations = m::mock('PatchManager\Request\Operations'); + $operations = m::mock('Cypress\PatchManager\Request\Operations'); $this->ops = new Sequence(); $this->ops->add(array('op' => 'data')); $operations->shouldReceive('all')->andReturn($this->ops)->byDefault(); @@ -49,7 +49,7 @@ public function test_getMatchedOperations_with_matching_handler() $this->assertCount(1, $this->matcher->getMatchedOperations()); $mpos = $this->matcher->getMatchedOperations(); $this->assertInstanceOf( - 'PatchManager\MatchedPatchOperation', + 'Cypress\PatchManager\MatchedPatchOperation', $mpos->find($this->handlerNameMatcher('data'))->get() ); } @@ -72,7 +72,7 @@ public function test_getMatchedOperations_with_multiple_operations_matching_mult $this->assertCount(2, $this->matcher->getMatchedOperations()); $mpos = $this->matcher->getMatchedOperations(); $this->assertInstanceOf( - 'PatchManager\MatchedPatchOperation', + 'Cypress\PatchManager\MatchedPatchOperation', $mpos->find($this->handlerNameMatcher('data'))->get() ); } diff --git a/tests/PatchManager/PatchManagerTest.php b/tests/PatchManager/PatchManagerTest.php index 5e3f768..5082d11 100644 --- a/tests/PatchManager/PatchManagerTest.php +++ b/tests/PatchManager/PatchManagerTest.php @@ -32,7 +32,7 @@ class PatchManagerTest extends PatchManagerTestCase public function setUp() { parent::setUp(); - $this->operationMatcher = m::mock('PatchManager\OperationMatcher'); + $this->operationMatcher = m::mock('Cypress\PatchManager\OperationMatcher'); $this->operationMatcher->shouldReceive('getMatchedOperations') ->andReturn(new Sequence())->byDefault(); $this->operationMatcher->shouldReceive('getUnmatchedOperations') @@ -55,7 +55,7 @@ public function test_handle_without_required_keys() } /** - * @expectedException HandlerNotFoundException + * @expectedException \Cypress\PatchManager\Exception\HandlerNotFoundException * @expectedExceptionMessage 'test' */ public function test_strict_mode() @@ -66,7 +66,7 @@ public function test_strict_mode() } /** - * @expectedException HandlerNotFoundException + * @expectedException \Cypress\PatchManager\Exception\HandlerNotFoundException * @expectedExceptionMessage 'test, test2' */ public function test_strict_mode_multiple_ops() diff --git a/tests/PatchManager/PatchManagerTestCase.php b/tests/PatchManager/PatchManagerTestCase.php index 74bfab5..ff10840 100644 --- a/tests/PatchManager/PatchManagerTestCase.php +++ b/tests/PatchManager/PatchManagerTestCase.php @@ -10,7 +10,7 @@ abstract class PatchManagerTestCase extends ProphecyTestCase { protected function mockHandler($name = null) { - $handler = m::mock('PatchManager\PatchOperationHandler'); + $handler = m::mock('Cypress\PatchManager\PatchOperationHandler'); if (! is_null($name)) { $handler->shouldReceive('getName')->andReturn($name)->byDefault(); } diff --git a/tests/PatchManager/Request/OperationsTest.php b/tests/PatchManager/Request/OperationsTest.php index 9bc81bc..0212416 100644 --- a/tests/PatchManager/Request/OperationsTest.php +++ b/tests/PatchManager/Request/OperationsTest.php @@ -2,9 +2,7 @@ namespace Cypress\PatchManager\Tests\Request; -use Cypress\PatchManager\Exception\InvalidJsonRequestContent; use Cypress\PatchManager\Exception\MissingOperationNameRequest; -use Cypress\PatchManager\Exception\MissingOperationRequest; use Cypress\PatchManager\Tests\PatchManagerTestCase; use Cypress\PatchManager\Request\Operations; use Mockery as m; @@ -12,7 +10,7 @@ class OperationsTest extends PatchManagerTestCase { /** - * @expectedException InvalidJsonRequestContent + * @expectedException \Cypress\PatchManager\Exception\InvalidJsonRequestContent */ public function test_request_with_invalid_json() { @@ -42,7 +40,7 @@ public function test_correct_operations_number_with_multiple_operation() } /** - * @expectedException MissingOperationRequest + * @expectedException \Cypress\PatchManager\Exception\MissingOperationRequest */ public function test_exeception_with_empty_request() { @@ -52,7 +50,7 @@ public function test_exeception_with_empty_request() } /** - * @expectedException MissingOperationNameRequest + * @expectedException \Cypress\PatchManager\Exception\MissingOperationNameRequest */ public function test_exeception_with_operation_without_op() { @@ -62,7 +60,7 @@ public function test_exeception_with_operation_without_op() } /** - * @expectedException MissingOperationNameRequest + * @expectedException \Cypress\PatchManager\Exception\MissingOperationNameRequest */ public function test_exeception_with_multiple_operation_without_op() { From 58259dc1bb5e18ac2883c4918356839b88bd177f Mon Sep 17 00:00:00 2001 From: Matteo Giachino Date: Wed, 29 Jul 2015 21:46:25 +0200 Subject: [PATCH 3/5] added notice in the readme for namespace change --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 01229e5..e44b5e4 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,12 @@ Patch Manager A php library to manage PATCH requests in a standardized (and elegant) way +### Be careful!!! + +*From version 0.3 namespace will change from PatchManager\\... to Cypress\\PatchManager\\...* + +## Install + Install with composer ``` json From 9246660f83ee842e2c439b2348ddb08960a5f58a Mon Sep 17 00:00:00 2001 From: Matteo Giachino Date: Wed, 29 Jul 2015 22:28:21 +0200 Subject: [PATCH 4/5] tests and setup for handler that responds to canHandle --- src/PatchManager/Handler/DataHandler.php | 11 ++++++ src/PatchManager/Handler/FiniteHandler.php | 11 ++++++ src/PatchManager/OperationMatcher.php | 24 +++++++++--- src/PatchManager/PatchManager.php | 11 +++--- src/PatchManager/PatchOperationHandler.php | 8 ++++ tests/PatchManager/OperationMatcherTest.php | 41 +++++++++++++-------- tests/PatchManager/PatchManagerTestCase.php | 14 ++++++- 7 files changed, 94 insertions(+), 26 deletions(-) diff --git a/src/PatchManager/Handler/DataHandler.php b/src/PatchManager/Handler/DataHandler.php index b125612..cabd143 100644 --- a/src/PatchManager/Handler/DataHandler.php +++ b/src/PatchManager/Handler/DataHandler.php @@ -54,4 +54,15 @@ public function configureOptions(OptionsResolver $optionsResolver) { $optionsResolver->setRequired(array('property', 'value')); } + + /** + * wether the handler is able to handle the given subject + * + * @param $subject + * @return bool + */ + public function canHandle($subject) + { + return true; + } } diff --git a/src/PatchManager/Handler/FiniteHandler.php b/src/PatchManager/Handler/FiniteHandler.php index d739e89..2e7e342 100644 --- a/src/PatchManager/Handler/FiniteHandler.php +++ b/src/PatchManager/Handler/FiniteHandler.php @@ -60,4 +60,15 @@ public function configureOptions(OptionsResolver $optionsResolver) ->setDefined(array('check')) ->setDefaults(array('check' => false)); } + + /** + * wether the handler is able to handle the given subject + * + * @param $subject + * @return bool + */ + public function canHandle($subject) + { + return true; + } } diff --git a/src/PatchManager/OperationMatcher.php b/src/PatchManager/OperationMatcher.php index 1f0c826..9b74230 100644 --- a/src/PatchManager/OperationMatcher.php +++ b/src/PatchManager/OperationMatcher.php @@ -4,6 +4,7 @@ use Cypress\PatchManager\Request\Operations; use PhpCollection\Sequence; +use PhpOption\Option; /** * Match the correct handlers based on actual operations @@ -38,21 +39,31 @@ public function addHandler(PatchOperationHandler $handler) } /** + * @param $subject + * * @return Sequence + * + * @throws Exception\MissingOperationNameRequest + * @throws Exception\MissingOperationRequest */ - public function getMatchedOperations() + public function getMatchedOperations($subject) { $handlers = $this->handlers; return $this->operations ->all() ->foldLeft( new Sequence(), - function (Sequence $matchedOperations, array $operationData) use ($handlers) { + function (Sequence $matchedOperations, array $operationData) use ($handlers, $subject) { + /** @var Option $handler */ $handler = $handlers->find(function (PatchOperationHandler $handler) use ($operationData) { return $operationData[Operations::OP_KEY_NAME] === $handler->getName(); }); if ($handler->isDefined()) { - $matchedOperations->add(MatchedPatchOperation::create($operationData, $handler->get())); + /** @var PatchOperationHandler $patchOperationHandler */ + $patchOperationHandler = $handler->get(); + if ($patchOperationHandler->canHandle($subject)) { + $matchedOperations->add(MatchedPatchOperation::create($operationData, $handler->get())); + } } return $matchedOperations; } @@ -60,13 +71,16 @@ function (Sequence $matchedOperations, array $operationData) use ($handlers) { } /** + * @param $subject + * * @return Sequence + * * @throws Exception\MissingOperationNameRequest * @throws Exception\MissingOperationRequest */ - public function getUnmatchedOperations() + public function getUnmatchedOperations($subject) { - $matchedOperations = $this->getMatchedOperations(); + $matchedOperations = $this->getMatchedOperations($subject); return $this->operations ->all() ->filter(function (array $operationData) use ($matchedOperations) { diff --git a/src/PatchManager/PatchManager.php b/src/PatchManager/PatchManager.php index 30d75dd..6cfe0fd 100644 --- a/src/PatchManager/PatchManager.php +++ b/src/PatchManager/PatchManager.php @@ -52,13 +52,14 @@ public function setEventDispatcherInterface($eventDispatcherInterface) */ public function handle($subject) { - if ($this->strictMode && $this->operationMatcher->getMatchedOperations()->isEmpty()) { - throw new HandlerNotFoundException($this->operationMatcher->getUnmatchedOperations()); + $matchedOperations = $this->operationMatcher->getMatchedOperations($subject); + if ($this->strictMode && $matchedOperations->isEmpty()) { + throw new HandlerNotFoundException($this->operationMatcher->getUnmatchedOperations($subject)); } if (is_array($subject) || $subject instanceof \Traversable) { $this->handleMany($subject); } else { - foreach ($this->operationMatcher->getMatchedOperations() as $matchedPatchOperation) { + foreach ($matchedOperations as $matchedPatchOperation) { $this->doHandle($matchedPatchOperation, $subject); } } @@ -70,8 +71,8 @@ public function handle($subject) */ private function handleMany($subjects) { - foreach ($this->operationMatcher->getMatchedOperations() as $matchedPatchOperation) { - foreach ($subjects as $subject) { + foreach ($subjects as $subject) { + foreach ($this->operationMatcher->getMatchedOperations($subject) as $matchedPatchOperation) { $this->doHandle($matchedPatchOperation, $subject); } } diff --git a/src/PatchManager/PatchOperationHandler.php b/src/PatchManager/PatchOperationHandler.php index 79355a5..10d90d1 100644 --- a/src/PatchManager/PatchOperationHandler.php +++ b/src/PatchManager/PatchOperationHandler.php @@ -31,4 +31,12 @@ public function getName(); * @return void */ public function configureOptions(OptionsResolver $optionsResolver); + + /** + * wether the handler is able to handle the given subject + * + * @param $subject + * @return bool + */ + public function canHandle($subject); } diff --git a/tests/PatchManager/OperationMatcherTest.php b/tests/PatchManager/OperationMatcherTest.php index e96d404..a69569e 100644 --- a/tests/PatchManager/OperationMatcherTest.php +++ b/tests/PatchManager/OperationMatcherTest.php @@ -32,22 +32,22 @@ public function setUp() public function test_getMatchedOperations_without_handlers() { - $this->assertEquals(new Sequence(), $this->matcher->getMatchedOperations()); + $this->assertEquals(new Sequence(), $this->matcher->getMatchedOperations('test')); } public function test_getMatchedOperations_with_handler_not_matching() { $this->matcher->addHandler($this->mockHandler('method')); - $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations()); - $this->assertCount(0, $this->matcher->getMatchedOperations()); + $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations('test')); + $this->assertCount(0, $this->matcher->getMatchedOperations('test')); } public function test_getMatchedOperations_with_matching_handler() { $this->matcher->addHandler($this->mockHandler('data')); - $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations()); - $this->assertCount(1, $this->matcher->getMatchedOperations()); - $mpos = $this->matcher->getMatchedOperations(); + $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations('test')); + $this->assertCount(1, $this->matcher->getMatchedOperations('test')); + $mpos = $this->matcher->getMatchedOperations('test'); $this->assertInstanceOf( 'Cypress\PatchManager\MatchedPatchOperation', $mpos->find($this->handlerNameMatcher('data'))->get() @@ -58,8 +58,8 @@ public function test_getMatchedOperations_with_multiple_operations_matching() { $this->ops->add(array('op' => 'data')); $this->matcher->addHandler($this->mockHandler('data')); - $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations()); - $mpos = $this->matcher->getMatchedOperations(); + $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations('test')); + $mpos = $this->matcher->getMatchedOperations('test'); $this->assertCount(2, $mpos->filter($this->handlerNameMatcher('data'))); } @@ -68,9 +68,9 @@ public function test_getMatchedOperations_with_multiple_operations_matching_mult $this->ops->add(array('op' => 'method')); $this->matcher->addHandler($this->mockHandler('data')); $this->matcher->addHandler($this->mockHandler('method')); - $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations()); - $this->assertCount(2, $this->matcher->getMatchedOperations()); - $mpos = $this->matcher->getMatchedOperations(); + $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations('test')); + $this->assertCount(2, $this->matcher->getMatchedOperations('test')); + $mpos = $this->matcher->getMatchedOperations('test'); $this->assertInstanceOf( 'Cypress\PatchManager\MatchedPatchOperation', $mpos->find($this->handlerNameMatcher('data'))->get() @@ -80,10 +80,21 @@ public function test_getMatchedOperations_with_multiple_operations_matching_mult public function test_getUnmatchedOperations_with_handler_not_matching() { $this->matcher->addHandler($this->mockHandler('method')); - $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations()); - $this->assertCount(1, $this->matcher->getUnmatchedOperations()); - $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getUnmatchedOperations()); - $this->assertEquals(new Sequence(array('data')), $this->matcher->getUnmatchedOperations()); + $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations('test')); + $this->assertCount(1, $this->matcher->getUnmatchedOperations('test')); + $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getUnmatchedOperations('test')); + $this->assertEquals(new Sequence(array('data')), $this->matcher->getUnmatchedOperations('test')); + } + + public function test_handler_that_responds_false_to_canHandle() + { + $this->matcher->addHandler($this->mockHandler('data', false)); + $this->assertCount(0, $this->matcher->getMatchedOperations('test')); + $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getMatchedOperations('test')); + $this->assertEquals(new Sequence(), $this->matcher->getMatchedOperations('test')); + $this->assertCount(1, $this->matcher->getUnmatchedOperations('test')); + $this->assertInstanceOf('PhpCollection\Sequence', $this->matcher->getUnmatchedOperations('test')); + $this->assertEquals(new Sequence(array('data')), $this->matcher->getUnmatchedOperations('test')); } private function handlerNameMatcher($name) diff --git a/tests/PatchManager/PatchManagerTestCase.php b/tests/PatchManager/PatchManagerTestCase.php index ff10840..a96156c 100644 --- a/tests/PatchManager/PatchManagerTestCase.php +++ b/tests/PatchManager/PatchManagerTestCase.php @@ -3,12 +3,19 @@ namespace Cypress\PatchManager\Tests; use Cypress\PatchManager\MatchedPatchOperation; +use Cypress\PatchManager\PatchOperationHandler; use Mockery as m; use Prophecy\PhpUnit\ProphecyTestCase; abstract class PatchManagerTestCase extends ProphecyTestCase { - protected function mockHandler($name = null) + /** + * @param null $name + * @param bool $canHandle + * + * @return PatchOperationHandler|m\MockInterface + */ + protected function mockHandler($name = null, $canHandle = true) { $handler = m::mock('Cypress\PatchManager\PatchOperationHandler'); if (! is_null($name)) { @@ -16,9 +23,14 @@ protected function mockHandler($name = null) } $handler->shouldReceive('getRequiredKeys')->andReturn(array())->byDefault(); $handler->shouldReceive('configureOptions')->andReturn(array())->byDefault(); + $handler->shouldReceive('canHandle')->andReturn($canHandle); return $handler; } + /** + * @param null $handlerName + * @return MatchedPatchOperation + */ protected function getMatchedPatchOperation($handlerName = null) { return MatchedPatchOperation::create(array(), $this->mockHandler($handlerName)); From d48bcd0049c109f804c62500ca278b8392412754 Mon Sep 17 00:00:00 2001 From: Davide Fedrigo Date: Thu, 30 Jul 2015 16:25:01 +0200 Subject: [PATCH 5/5] Fix namespace --- .../Bundle/Resources/config/handlers/data.xml | 2 +- .../Bundle/Resources/config/handlers/data_doctrine.xml | 2 +- .../Bundle/Resources/config/handlers/state_machine.xml | 2 +- src/PatchManager/Bundle/Resources/config/services.xml | 8 ++++---- src/PatchManager/PatchOperationHandler.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/PatchManager/Bundle/Resources/config/handlers/data.xml b/src/PatchManager/Bundle/Resources/config/handlers/data.xml index 5c1789d..2727059 100644 --- a/src/PatchManager/Bundle/Resources/config/handlers/data.xml +++ b/src/PatchManager/Bundle/Resources/config/handlers/data.xml @@ -5,6 +5,6 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + diff --git a/src/PatchManager/Bundle/Resources/config/handlers/data_doctrine.xml b/src/PatchManager/Bundle/Resources/config/handlers/data_doctrine.xml index 8c06e9e..4555068 100644 --- a/src/PatchManager/Bundle/Resources/config/handlers/data_doctrine.xml +++ b/src/PatchManager/Bundle/Resources/config/handlers/data_doctrine.xml @@ -5,6 +5,6 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + diff --git a/src/PatchManager/Bundle/Resources/config/handlers/state_machine.xml b/src/PatchManager/Bundle/Resources/config/handlers/state_machine.xml index 43b9b43..3bb96df 100644 --- a/src/PatchManager/Bundle/Resources/config/handlers/state_machine.xml +++ b/src/PatchManager/Bundle/Resources/config/handlers/state_machine.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + diff --git a/src/PatchManager/Bundle/Resources/config/services.xml b/src/PatchManager/Bundle/Resources/config/services.xml index 4ebdc80..c43aa27 100644 --- a/src/PatchManager/Bundle/Resources/config/services.xml +++ b/src/PatchManager/Bundle/Resources/config/services.xml @@ -5,16 +5,16 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + - + - + - + %patch_manager.strict_mode% diff --git a/src/PatchManager/PatchOperationHandler.php b/src/PatchManager/PatchOperationHandler.php index 10d90d1..e1447c4 100644 --- a/src/PatchManager/PatchOperationHandler.php +++ b/src/PatchManager/PatchOperationHandler.php @@ -33,7 +33,7 @@ public function getName(); public function configureOptions(OptionsResolver $optionsResolver); /** - * wether the handler is able to handle the given subject + * whether the handler is able to handle the given subject * * @param $subject * @return bool