/** * Test user can submit the comment form * * @depends testShow * @param sting slug */ public function testSubmitComment($slug) { $url = self::$router->generate('site_service_show', ['slug' => $slug]); $crawler = self::$client->request('GET', $url); $this->assertEquals(Response::HTTP_OK, self::$client->getResponse()->getStatusCode()); $form = $crawler->filter('form[name=koopa_app_comment]'); $this->assertTrue($form->count() > 0); $form = $form->form(); $form['koopa_app_comment[content]'] = 'I like this service'; self::$client->submit($form); $crawler = self::$client->followRedirect(); $this->assertRegExp('/I like this service/', self::$client->getResponse()->getContent()); }
/** * @param $id * @depends testEdit */ public function testDelete($id) { $url = self::$router->generate('service_edit', ['id' => $id]); $crawler = self::$client->request('GET', $url); $form = $crawler->filter('form[id=form_delete]')->form(); self::$client->submit($form); self::$client->followRedirect(); $this->assertEquals(Response::HTTP_OK, self::$client->getResponse()->getStatusCode()); $this->assertNotRegExp('/BarTEST/', self::$client->getResponse()->getContent()); }