Example #1
0
 /**
  * newReview
  *
  * @return Review $review
  */
 public function newReview()
 {
     $user = $this->em->getRepository('Aisel\\FrontendUserBundle\\Entity\\FrontendUser')->findOneBy(['username' => 'frontenduser']);
     $review = new Review();
     $review->setLocale('en');
     $review->setName($this->faker->sentence(1));
     $review->setContent($this->faker->sentence(10));
     $review->setStatus(true);
     $review->setFrontenduser($user);
     $this->em->persist($review);
     $this->em->flush();
     return $review;
 }
Example #2
0
 public function testProductReview()
 {
     $this->logInFrontend();
     $product = $this->newProduct();
     $review = new Review();
     $review->setLocale('en');
     $review->setName($this->faker->sentence(1));
     $review->setContent($this->faker->sentence(10));
     $review->setSubject($product);
     $this->em->persist($review);
     $this->em->flush();
     $review = $this->em->getRepository('Aisel\\ProductBundle\\Entity\\Review')->findOneBy(['id' => $review->getId()]);
     $this->assertNotNull($review);
 }
Example #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) {
                 $frontendUser = $this->getReference('frontenduser_' . $table->column[5]);
                 $product = $this->getReference('product_' . $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->setSubject($product);
                 $review->setFrontenduser($frontendUser);
                 $manager->persist($review);
                 $manager->flush();
                 $this->addReference('product_review_' . $table->column[0], $review);
             }
         }
     }
 }