public function testDelete() { $client = static::createClient(); $em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager'); $channel = $em->getRepository('UniversiboCoreBundle:Channel')->find(3); $news = new News(); $news->setTitle('Delete me title'); $news->setContent('Delete me content'); $news->setCreatedAt(new \DateTime()); $news->setUpdatedAt(new \DateTime()); $news->getChannels()->add($channel); $em->persist($news); $em->flush(); $this->login($client); $crawler = $client->request('GET', '/news/' . $news->getId() . '/show'); $form = $crawler->selectButton('Delete')->form(); $crawler = $client->submit($form); $this->assertTrue($client->getResponse()->isRedirect(), 'Expecting redirect response'); }