logInAs('admin'); $client = $this->getClient(); $em = $client->getContainer() ->get('doctrine.orm.entity_manager'); $notification = new Notification($this->getLoggedInUser()); $notification->setType(Notification::TYPE_USER) ->setTitle('fooTitle') ->setDescription('barDescription'); $em->persist($notification); $em->flush(); $crawler = $client->request('GET', '/'); $this->assertCount(1, $notificationArea = $crawler->filter('.notifications-area .collection')); $this->assertContains('fooTitle', $notificationArea->text()); $this->assertContains('barDescription', $notificationArea->text()); } }