Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected static function createClient(array $options = array(), array $server = array())
 {
     $client = parent::createClient($options, $server);
     $homepage = new Page();
     $homepage->setHomepage(true)->setEnabled(true)->setSlug('home')->setTitle('My homepage')->setContent('Hello world!');
     /** @var EntityManager $em */
     $em = $client->getKernel()->getContainer()->get('doctrine')->getManager();
     $em->persist($homepage);
     $em->flush();
     return $client;
 }
Ejemplo n.º 2
0
 public function testCategory()
 {
     $homepage = new Page();
     $homepage->setHomepage(true)->setEnabled(false)->setSlug('home')->setTitle('My homepage')->setHost('localhost')->setContent('Hello world!');
     $category = new Category();
     $category->setName('Default category')->setSlug('default');
     $homepage->setCategory($category);
     $kernel = static::getKernel();
     /** @var EntityManager $em */
     $em = $kernel->getContainer()->get('doctrine')->getManager();
     $em->persist($homepage);
     $em->persist($category);
     $em->flush();
     /** @var Page $homepage */
     $homepage = $em->getRepository(get_class($homepage))->find($homepage->getId());
     $this->assertEquals($homepage->getCategory(), $category);
     $this->assertEquals($category->getName(), (string) $category);
     $this->assertFalse($category->isEnabled());
     // Base value
 }
Ejemplo n.º 3
0
 public function getDummyPage()
 {
     $page = new Page();
     return $page->setHomepage(true)->setSlug('home')->setTitle('My homepage')->setHost('localhost')->setContent('Hello world!');
 }