Пример #1
0
 /**
  * newReview
  *
  * @return Page $page
  */
 public function newReview()
 {
     $user = $this->em->getRepository('Aisel\\UserBundle\\Entity\\User')->findOneBy(['email' => '*****@*****.**']);
     $page = $this->newPage();
     $review = new Review();
     $review->setLocale('en');
     $review->setName($this->faker->sentence(1));
     $review->setContent($this->faker->sentence(10));
     $review->setStatus(true);
     $review->setSubject($page);
     $review->setUser($user);
     $this->em->persist($review);
     $this->em->flush();
     return $review;
 }
Пример #2
0
 public function testPageReview()
 {
     $this->logInFrontend();
     $page = $this->newPage();
     $review = new Review();
     $review->setLocale('en');
     $review->setName($this->faker->sentence(1));
     $review->setContent($this->faker->sentence(10));
     $review->setSubject($page);
     $this->em->persist($review);
     $this->em->flush();
     $review = $this->em->getRepository('Aisel\\PageBundle\\Entity\\Review')->findOneBy(['id' => $review->getId()]);
     $this->assertNotNull($review);
 }
Пример #3
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     foreach ($this->fixtureFiles as $file) {
         if (file_exists($file)) {
             $contents = file_get_contents($file);
             $XML = simplexml_load_string($contents);
             foreach ($XML->database->table as $table) {
                 $user = $this->getReference('user_' . $table->column[5]);
                 $page = $this->getReference('page_' . $table->column[6]);
                 $review = new Review();
                 $review->setLocale($table->column[1]);
                 $review->setName($table->column[2]);
                 $review->setContent($table->column[3]);
                 $review->setStatus($table->column[4]);
                 $review->setUser($user);
                 $review->setSubject($page);
                 $manager->persist($review);
                 $manager->flush();
                 $this->addReference('page_review_' . $table->column[0], $review);
             }
         }
     }
 }