/** * @inheritdoc */ public function deleteRelation(Repository $repository, Event $event = null) { $repository->deleteRelation($this->relational->table(), $this->relational->relationIds(), $this->relational->itemColumn(), $this->relational->itemIds(), $event); return $this->factory->makeRepresentationCreator()->make([], 204); }
function it_deletes_relations(Repository $repository, Response $response, Factory $factory, RepresentationCreator $representationCreator, Relational $relational) { $table = 'image_product_site'; $relationIds = ['site_id' => 2, 'product_id' => 7]; $itemColumn = 'image_id'; $itemIds = [6, 7, 10]; $relational->table()->shouldBeCalled()->willReturn($table); $relational->relationIds()->shouldBeCalled()->willReturn($relationIds); $relational->itemColumn()->shouldBeCalled()->willReturn($itemColumn); $relational->itemIds()->shouldBeCalled()->willReturn($itemIds); $repository->deleteRelation($table, $relationIds, $itemColumn, $itemIds, null)->shouldBeCalled(); $factory->makeRepresentationCreator()->shouldBeCalled()->willReturn($representationCreator); $representationCreator->make([], 204)->shouldBeCalled()->willReturn($response); $this->deleteRelation($repository)->shouldReturn($response); }