diff --git a/Manager/RedirectRouteManager.php b/Manager/RedirectRouteManager.php index 29b4aa8..8a3ba7e 100644 --- a/Manager/RedirectRouteManager.php +++ b/Manager/RedirectRouteManager.php @@ -58,7 +58,6 @@ public function saveByData($data) $redirectRoute->setSource($data['source']); $redirectRoute->setSourceHost($data['sourceHost']); $redirectRoute->setTarget($data['target']); - $redirectRoute->setEnabled($data['enabled']); $redirectRoute->setStatusCode($data['statusCode']); if (410 === $redirectRoute->getStatusCode()) { diff --git a/Tests/Functional/Controller/RedirectRouteControllerTest.php b/Tests/Functional/Controller/RedirectRouteControllerTest.php index 2cdf589..2c73d05 100644 --- a/Tests/Functional/Controller/RedirectRouteControllerTest.php +++ b/Tests/Functional/Controller/RedirectRouteControllerTest.php @@ -40,8 +40,8 @@ protected function setUp(): void $this->client = $this->createAuthenticatedClient(); $this->purgeDatabase(); - $this->defaultData = ['source' => '/test1', 'sourceHost' => null, 'target' => '/test2', 'enabled' => true, 'statusCode' => 301]; - $this->status410Data = ['source' => '/test410', 'sourceHost' => null, 'enabled' => true, 'statusCode' => 410, 'target' => null]; + $this->defaultData = ['source' => '/test1', 'sourceHost' => null, 'target' => '/test2', 'statusCode' => 301]; + $this->status410Data = ['source' => '/test410', 'sourceHost' => null, 'statusCode' => 410, 'target' => null]; } public function testPost() @@ -177,7 +177,7 @@ public function testPut() $response = $this->post($this->defaultData); $data = json_decode($response->getContent(), true); - $newData = ['source' => '/test3', 'sourceHost' => null, 'target' => '/test4', 'enabled' => false, 'statusCode' => 302]; + $newData = ['source' => '/test3', 'sourceHost' => null, 'target' => '/test4', 'statusCode' => 302]; $response = $this->put($data['id'], $newData); $this->assertHttpStatusCode(200, $response); @@ -223,7 +223,7 @@ public function testCDelete() $response = $this->post($this->defaultData); $data1 = json_decode($response->getContent(), true); - $response = $this->post(['source' => '/test2', 'sourceHost' => null, 'target' => '/test3', 'enabled' => true, 'statusCode' => 301]); + $response = $this->post(['source' => '/test2', 'sourceHost' => null, 'target' => '/test3', 'statusCode' => 301]); $data2 = json_decode($response->getContent(), true); $this->client->request('DELETE', self::BASE_URL . '?ids=' . $data1['id'] . ',' . $data2['id']); diff --git a/Tests/Unit/GoneSubscriber/GoneEntitySubscriberTest.php b/Tests/Unit/GoneSubscriber/GoneEntitySubscriberTest.php index 87090cf..fc2b2a1 100644 --- a/Tests/Unit/GoneSubscriber/GoneEntitySubscriberTest.php +++ b/Tests/Unit/GoneSubscriber/GoneEntitySubscriberTest.php @@ -56,7 +56,7 @@ protected function setUp(): void $this->event->getObject()->willReturn($this->object->reveal()); $this->redirectRouteManager = $this->prophesize(RedirectRouteManager::class); - $this->redirectRouteManager->save(Argument::that(function($object) { + $this->redirectRouteManager->save(Argument::that(function ($object) { $this->assertEquals($object->getSource(), '/test/123'); return true; diff --git a/Tests/Unit/Import/Converter/ConverterFacadeTest.php b/Tests/Unit/Import/Converter/ConverterFacadeTest.php index a1e4acd..b5082d5 100644 --- a/Tests/Unit/Import/Converter/ConverterFacadeTest.php +++ b/Tests/Unit/Import/Converter/ConverterFacadeTest.php @@ -33,7 +33,7 @@ public function testSupports() $converterFacade = new ConverterFacade( array_map( - function(ObjectProphecy $converter) { + function (ObjectProphecy $converter) { return $converter->reveal(); }, $converters @@ -57,7 +57,7 @@ public function testSupportsNoSupportedConverter() $converterFacade = new ConverterFacade( array_map( - function(ObjectProphecy $converter) { + function (ObjectProphecy $converter) { return $converter->reveal(); }, $converters @@ -94,7 +94,7 @@ public function testConvert() $converterFacade = new ConverterFacade( array_map( - function(ObjectProphecy $converter) { + function (ObjectProphecy $converter) { return $converter->reveal(); }, $converters @@ -120,7 +120,7 @@ public function testConvertNotSupported() $converterFacade = new ConverterFacade( array_map( - function(ObjectProphecy $converter) { + function (ObjectProphecy $converter) { return $converter->reveal(); }, $converters diff --git a/Tests/Unit/Import/Reader/ReaderFacadeTest.php b/Tests/Unit/Import/Reader/ReaderFacadeTest.php index 203c6a6..3ef0247 100644 --- a/Tests/Unit/Import/Reader/ReaderFacadeTest.php +++ b/Tests/Unit/Import/Reader/ReaderFacadeTest.php @@ -44,7 +44,7 @@ public function testSupports() $readerFacade = new ReaderFacade( array_map( - function(ObjectProphecy $converter) { + function (ObjectProphecy $converter) { return $converter->reveal(); }, $converters @@ -66,7 +66,7 @@ public function testSupportsNoSupportedConverter() $readerFacade = new ReaderFacade( array_map( - function(ObjectProphecy $converter) { + function (ObjectProphecy $converter) { return $converter->reveal(); }, $converters @@ -101,7 +101,7 @@ public function testRead() $readerFacade = new ReaderFacade( array_map( - function(ObjectProphecy $converter) { + function (ObjectProphecy $converter) { return $converter->reveal(); }, $converters @@ -127,7 +127,7 @@ public function testConvertNotSupported() $readerFacade = new ReaderFacade( array_map( - function(ObjectProphecy $converter) { + function (ObjectProphecy $converter) { return $converter->reveal(); }, $converters diff --git a/Tests/Unit/Manager/RedirectRouteManagerTest.php b/Tests/Unit/Manager/RedirectRouteManagerTest.php index 6eb4fa0..4d964ae 100644 --- a/Tests/Unit/Manager/RedirectRouteManagerTest.php +++ b/Tests/Unit/Manager/RedirectRouteManagerTest.php @@ -44,7 +44,7 @@ public function testSave() $redirectRoute->setId(Argument::any())->shouldBeCalled(); $redirectRoute->setSource('/test')->shouldBeCalled(); $redirectRoute->setSourceHost(null)->shouldBeCalled(); - $redirectRoute->setEnabled(true)->shouldBeCalled(); + $redirectRoute->setEnabled(Argument::any())->shouldNotBeCalled(); $redirectRoute->setTarget('/test2')->shouldBeCalled(); $redirectRoute->setStatusCode(301)->shouldBeCalled(); $redirectRoute->getStatusCode()->willReturn(301); @@ -53,7 +53,7 @@ public function testSave() $this->repository->createNew()->willReturn($redirectRoute->reveal()); $this->repository->persist($redirectRoute->reveal())->shouldBeCalled(); - $this->manager->saveByData(['source' => '/test', 'sourceHost' => null, 'target' => '/test2', 'enabled' => true, 'statusCode' => 301]); + $this->manager->saveByData(['source' => '/test', 'sourceHost' => null, 'target' => '/test2', 'statusCode' => 301]); } public function testSave410() @@ -63,7 +63,7 @@ public function testSave410() $redirectRoute->setSource('/test410')->shouldBeCalled(); $redirectRoute->setSourceHost(null)->shouldBeCalled(); $redirectRoute->setId(Argument::any())->shouldBeCalled(); - $redirectRoute->setEnabled(true)->shouldBeCalled(); + $redirectRoute->setEnabled(Argument::any())->shouldNotBeCalled(); $redirectRoute->setStatusCode(410)->shouldBeCalled(); $redirectRoute->getStatusCode()->willReturn(410); @@ -71,7 +71,7 @@ public function testSave410() $this->repository->createNew()->willReturn($redirectRoute->reveal()); $this->repository->persist($redirectRoute->reveal())->shouldBeCalled(); - $this->manager->saveByData(['source' => '/test410', 'sourceHost' => null, 'target' => '', 'enabled' => true, 'statusCode' => 410]); + $this->manager->saveByData(['source' => '/test410', 'sourceHost' => null, 'target' => '', 'statusCode' => 410]); } public function testSaveAlreadyExists() @@ -86,7 +86,7 @@ public function testSaveAlreadyExists() $redirectRoute->setId(Argument::any())->shouldBeCalled(); $redirectRoute->setSource('/test')->shouldBeCalled(); $redirectRoute->setSourceHost('www.example.com')->shouldBeCalled(); - $redirectRoute->setEnabled(true)->shouldBeCalled(); + $redirectRoute->setEnabled(Argument::any())->shouldNotBeCalled(); $redirectRoute->setTarget('/test2')->shouldBeCalled(); $redirectRoute->setStatusCode(301)->shouldBeCalled(); $redirectRoute->getStatusCode()->willReturn(301); @@ -97,7 +97,7 @@ public function testSaveAlreadyExists() $this->repository->findBySource('/test', 'www.example.com')->willReturn($otherRoute->reveal()); $this->repository->createNew()->willReturn($redirectRoute->reveal()); - $this->manager->saveByData(['source' => '/test', 'sourceHost' => 'www.example.com', 'target' => '/test2', 'enabled' => true, 'statusCode' => 301]); + $this->manager->saveByData(['source' => '/test', 'sourceHost' => 'www.example.com', 'target' => '/test2', 'statusCode' => 301]); $this->repository->persist($redirectRoute->reveal())->shouldNotBeCalled(); } @@ -111,7 +111,7 @@ public function testSaveSameEntity() $redirectRoute->getId()->willReturn('123-123-123'); $redirectRoute->setSource('/test')->shouldBeCalled(); $redirectRoute->setSourceHost('www.example.com')->shouldBeCalled(); - $redirectRoute->setEnabled(true)->shouldBeCalled(); + $redirectRoute->setEnabled(Argument::any())->shouldNotBeCalled(); $redirectRoute->setTarget('/test2')->shouldBeCalled(); $redirectRoute->setStatusCode(301)->shouldBeCalled(); $redirectRoute->getStatusCode()->willReturn(301); @@ -120,7 +120,7 @@ public function testSaveSameEntity() $this->repository->findBySource('/test', 'www.example.com')->willReturn($otherRoute->reveal()); $this->repository->persist($redirectRoute->reveal())->shouldBeCalled(); - $this->manager->saveByData(['source' => '/test', 'sourceHost' => 'www.example.com', 'target' => '/test2', 'enabled' => true, 'statusCode' => 301, 'id' => '123-123-123']); + $this->manager->saveByData(['source' => '/test', 'sourceHost' => 'www.example.com', 'target' => '/test2', 'statusCode' => 301, 'id' => '123-123-123']); } public function testDelete()