Esempio n. 1
0
 /**
  * Helper method to create the dummy object
  *
  * @param bool $individualMode
  * @return \Shopware\Models\Voucher\Voucher
  */
 private function createDummy($individualMode = true)
 {
     $voucher = $this->getDummyVoucher($individualMode);
     $this->manager->persist($voucher);
     $this->manager->flush();
     return $voucher;
 }
Esempio n. 2
0
 /**
  * helper method to create the dummy object
  *
  * @return \Shopware\Models\Category\Category
  */
 private function createDummy()
 {
     $dummyData = $this->getDummyData();
     $this->manager->persist($dummyData);
     $this->manager->flush();
     return $dummyData;
 }
 /**
  * helper method to create the dummy object
  *
  * @return \Shopware\Models\ProductFeed\ProductFeed
  */
 private function createDummy()
 {
     $feed = $this->getDummyFeed();
     $this->manager->persist($feed);
     $this->manager->flush();
     return $feed;
 }
Esempio n. 4
0
 /**
  * Test saveAction controller action - change payment mean
  *
  * Get a random customer. Change payment method to debit
  */
 public function testChangeCustomerPaymentMean()
 {
     $dummyData = new \Shopware\Models\Customer\Customer();
     $dummyData->setEmail('*****@*****.**');
     $this->manager->persist($dummyData);
     $this->manager->flush();
     $this->assertEquals(0, $dummyData->getPaymentId());
     $debit = $this->manager->getRepository('Shopware\\Models\\Payment\\Payment')->findOneBy(array('name' => 'debit'));
     $params = array('id' => $dummyData->getId(), 'paymentId' => $debit->getId());
     $this->Request()->setMethod('POST')->setPost($params);
     $this->dispatch('/backend/Customer/save');
     $jsonBody = $this->View()->getAssign();
     $this->assertTrue($this->View()->success);
     $this->assertEquals($debit->getId(), $jsonBody['data']['paymentId']);
     $this->manager->refresh($dummyData);
     $this->assertEquals($debit->getId(), $dummyData->getPaymentId());
     $this->manager->remove($dummyData);
     $this->manager->flush();
 }
Esempio n. 5
0
 public function createOrder()
 {
     $paymentStatusOpen = $this->em->getReference('\\Shopware\\Models\\Order\\Status', 17);
     $orderStatusOpen = $this->em->getReference('\\Shopware\\Models\\Order\\Status', 0);
     $paymentDebit = $this->em->getReference('\\Shopware\\Models\\Payment\\Payment', 2);
     $dispatchDefault = $this->em->getReference('\\Shopware\\Models\\Dispatch\\Dispatch', 9);
     $defaultShop = $this->em->getReference('\\Shopware\\Models\\Shop\\Shop', 1);
     $partner = new \Shopware\Models\Partner\Partner();
     $partner->setCompany("Dummy");
     $partner->setIdCode("Dummy");
     $partner->setDate(new \DateTime());
     $partner->setContact('Dummy');
     $partner->setStreet('Dummy');
     $partner->setStreetNumber('Dummy');
     $partner->setZipCode('Dummy');
     $partner->setCity('Dummy');
     $partner->setPhone('Dummy');
     $partner->setFax('Dummy');
     $partner->setCountryName('Dummy');
     $partner->setEmail('Dummy');
     $partner->setWeb('Dummy');
     $partner->setProfile('Dummy');
     $this->em->persist($partner);
     $order = new \Shopware\Models\Order\Order();
     $order->setNumber('abc');
     $order->setPaymentStatus($paymentStatusOpen);
     $order->setOrderStatus($orderStatusOpen);
     $order->setPayment($paymentDebit);
     $order->setDispatch($dispatchDefault);
     $order->setPartner($partner);
     $order->setShop($defaultShop);
     $order->setInvoiceAmount(5);
     $order->setInvoiceAmountNet(5);
     $order->setInvoiceShipping(5);
     $order->setInvoiceShippingNet(5);
     $order->setTransactionId(5);
     $order->setComment('Dummy');
     $order->setCustomerComment('Dummy');
     $order->setInternalComment('Dummy');
     $order->setNet(true);
     $order->setTaxFree(false);
     $order->setTemporaryId(5);
     $order->setReferer('Dummy');
     $order->setTrackingCode("Dummy");
     $order->setLanguageIso("Dummy");
     $order->setCurrency("EUR");
     $order->setCurrencyFactor(5);
     $order->setRemoteAddress("127.0.0.1");
     return $order;
 }
Esempio n. 6
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);
     }
 }
Esempio n. 7
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());
 }
Esempio n. 8
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());
 }
Esempio n. 9
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);
     }
 }