spec\Newscoop\NewscoopBundle\Controller\TopicsControllerSpec::its_detachTopicAction_should_detach_topic_from_the_article PHP Method

its_detachTopicAction_should_detach_topic_from_the_article() public method

public its_detachTopicAction_should_detach_topic_from_the_article ( $request, $topicService, $topic, $query, $user, $topicRepository, $entityManager, $repository, $article, $cacheService )
    public function its_detachTopicAction_should_detach_topic_from_the_article($request, $topicService, $topic, $query, $user, $topicRepository, $entityManager, $repository, $article, $cacheService)
    {
        $user->hasPermission('AttachTopicToArticle')->willReturn(true);
        $entityManager->getRepository('Newscoop\\Entity\\Article')->willReturn($repository);
        $request->get('articleNumber')->willReturn('64');
        $request->get('topicId')->willReturn('1');
        $request->get('language')->willReturn('1');
        $repository->findOneBy(array('number' => '64', 'language' => '1'))->willReturn($article);
        $topic->getTitle()->willReturn('test topic');
        $entityManager->getRepository('Newscoop\\NewscoopBundle\\Entity\\Topic')->willReturn($topicRepository);
        $topicRepository->getSingleTopicQuery('1')->willReturn($query);
        $query->getOneOrNullResult()->willReturn($topic);
        $topicService->removeTopicFromArticle($topic, $article)->willReturn(true);
        $cacheService->clearNamespace('topic')->shouldBeCalled();
        $response = $this->detachTopicAction($request);
        $response->getStatusCode()->shouldReturn(200);
        $response->shouldBeAnInstanceOf('Symfony\\Component\\HttpFoundation\\JsonResponse');
    }