From 563e654b998acb4133f24cc2dd47fc3e213e4f43 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 15 Jul 2017 09:10:09 +0200 Subject: [PATCH] Created DeleteTagsActionTest --- .../test/Action/Tag/DeleteTagsActionTest.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 module/Rest/test/Action/Tag/DeleteTagsActionTest.php diff --git a/module/Rest/test/Action/Tag/DeleteTagsActionTest.php b/module/Rest/test/Action/Tag/DeleteTagsActionTest.php new file mode 100644 index 00000000..0a0657bf --- /dev/null +++ b/module/Rest/test/Action/Tag/DeleteTagsActionTest.php @@ -0,0 +1,57 @@ +tagService = $this->prophesize(TagServiceInterface::class); + $this->action = new DeleteTagsAction($this->tagService->reveal()); + } + + /** + * @test + * @dataProvider provideTags + * @param array|null $tags + */ + public function processDelegatesIntoService($tags) + { + $request = ServerRequestFactory::fromGlobals()->withQueryParams(['tags' => $tags]); + /** @var MethodProphecy $deleteTags */ + $deleteTags = $this->tagService->deleteTags($tags ?: []); + + $response = $this->action->process($request, $this->prophesize(DelegateInterface::class)->reveal()); + + $this->assertEquals(204, $response->getStatusCode()); + $deleteTags->shouldHaveBeenCalled(); + } + + public function provideTags() + { + return [ + [['foo', 'bar', 'baz']], + [['some', 'thing']], + [null], + [[]], + ]; + } +}