/** * @inheritdoc */ public function execute(Request $request, DataSourceInterface $resource, $identifier) { if (!$resource->delete(intval($identifier))) { throw new NotFoundHttpException(); } return ActionResult::simple(200, ['status' => 'success']); }
function it_should_throw_if_instance_not_found(DataSourceInterface $dataSource) { $request = Request::create('/user/1', 'DELETE'); $dataSource->delete(1)->willReturn(false); $this->shouldThrow('Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException')->during('execute', [$request, $dataSource, 1]); }