/** * @param int $tagId * @param string $tagName * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException * * @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse */ public function viewAction(int $tagId, string $tagName) { $tag = $this->tagRepository->loadById($tagId); if ($tag->name !== $tagName) { return $this->responseFactory->redirectToRoute('tag.view', ['id' => $tag->id, $tag->name]); } return $this->viewFactory->make('customer.tag.view', compact('tag')); }
/** * Should be able to load a tag by id. */ public function testLoadById() { $this->tagModel->shouldReceive('where->with->firstOrFail')->andReturnSelf(); $this->tagRepository->loadById(5); }