Пример #1
0
 /**
  * Test case
  */
 public function testFormShouldBePersisted()
 {
     $form = new Form();
     $form->fromArray($this->testData);
     $this->em->persist($form);
     $this->em->flush();
     $formId = $form->getId();
     // remove form from entity manager
     $this->em->detach($form);
     unset($form);
     $form = $this->repo->find($formId);
     foreach ($this->testData as $fieldname => $value) {
         $getMethod = 'get' . ucfirst($fieldname);
         $this->assertEquals($form->{$getMethod}(), $value);
     }
 }
Пример #2
0
 /**
  * Test case
  */
 public function testShouldBePersisted()
 {
     $snippet = new Snippet();
     $snippet->fromArray($this->testData);
     $this->em->persist($snippet);
     $this->em->flush();
     $snippetId = $snippet->getId();
     // remove from entity manager
     $this->em->detach($snippet);
     unset($snippet);
     $snippet = $this->repo->find($snippetId);
     foreach ($this->testData as $fieldname => $value) {
         $getMethod = 'get' . ucfirst($fieldname);
         $this->assertEquals($snippet->{$getMethod}(), $value);
     }
     $this->assertInstanceOf('\\DateTime', $snippet->getCreated());
     $this->assertInstanceOf('\\DateTime', $snippet->getUpdated());
 }
Пример #3
0
 public function testEsdShouldBePersisted()
 {
     $esd = new Esd();
     $articleDetail = Shopware()->Models()->getRepository('Shopware\\Models\\Article\\Detail')->findOneBy(array('active' => true));
     $esd->setArticleDetail($articleDetail);
     $esd->fromArray($this->testData);
     $this->em->persist($esd);
     $this->em->flush();
     $esdId = $esd->getId();
     // remove esd from entity manager
     $this->em->detach($esd);
     unset($esd);
     $esd = $this->repo->find($esdId);
     foreach ($this->testData as $fieldname => $value) {
         $getMethod = 'get' . ucfirst($fieldname);
         $this->assertEquals($esd->{$getMethod}(), $value);
     }
     $this->assertInstanceOf('\\DateTime', $esd->getDate());
 }
Пример #4
0
 /**
  * Testcase
  */
 public function testMailShouldBePersisted()
 {
     $mail = new Mail();
     $mail->fromArray($this->testData);
     $this->em->persist($mail);
     $this->em->flush();
     $mailId = $mail->getId();
     // remove mail from entity manager
     $this->em->detach($mail);
     unset($mail);
     $mail = $this->repo->find($mailId);
     foreach ($this->testData as $fieldname => $value) {
         if (substr($fieldname, 0, 2) == 'is') {
             $getMethod = $fieldname;
         } else {
             $getMethod = 'get' . ucfirst($fieldname);
         }
         $this->assertEquals($mail->{$getMethod}(), $value);
     }
 }