예제 #1
0
 public function testProcessOK()
 {
     $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $baseManager = \Aimeos\MShop\Order\Manager\Factory::createManager($this->context)->getSubManager('base');
     $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
     $search = $serviceManager->createSearch();
     $search->setConditions($search->compare('==', 'service.code', 'unitpaymentcode'));
     $result = $serviceManager->searchItems($search);
     if (($serviceItem = reset($result)) === false) {
         throw new \RuntimeException('No service item found');
     }
     $controller->setService('payment', $serviceItem->getId());
     $controller->setAddress('payment', array('order.base.address.languageid' => 'en'));
     $this->context->setUserId('-1');
     $view = \TestHelperHtml::getView();
     $param = array('cs_order' => 1);
     $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
     $view->addHelper('param', $helper);
     $this->object->setView($view);
     $this->object->process();
     $search = $baseManager->createSearch();
     $search->setConditions($search->compare('==', 'order.base.customerid', '-1'));
     $result = $baseManager->searchItems($search);
     if (($item = reset($result)) === false) {
         throw new \RuntimeException('No order placed');
     }
     $baseManager->deleteItem($item->getId());
     $this->assertInstanceOf('\\Aimeos\\MShop\\Order\\Item\\Iface', $view->orderItem);
     $this->assertEquals($item->getId(), $view->orderItem->getBaseId());
 }
예제 #2
0
 public function testGetBodyNoCatId()
 {
     $this->object->setView(\TestHelperHtml::getView());
     $output = $this->object->getBody();
     $this->assertRegExp('#Your search result#smU', $output);
     $this->assertStringStartsWith('<div class="catalog-stage-breadcrumb">', $output);
 }
예제 #3
0
 public function testGetBodyException()
 {
     $object = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Catalog\\Count\\Standard')->setConstructorArgs(array($this->context, array()))->setMethods(array('setViewParams'))->getMock();
     $object->expects($this->once())->method('setViewParams')->will($this->throwException(new \RuntimeException()));
     $object->setView(\TestHelperHtml::getView());
     $this->assertEquals(null, $object->getBody());
 }
예제 #4
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Checkout\Standard\Summary\Option\Terms\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
예제 #5
0
 public function testGetBodyException()
 {
     $object = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Checkout\\Confirm\\Standard')->setConstructorArgs(array($this->context, array()))->setMethods(array('setViewParams'))->getMock();
     $object->expects($this->once())->method('setViewParams')->will($this->throwException(new \RuntimeException()));
     $object->setView(\TestHelperHtml::getView());
     $this->assertContains('A non-recoverable error occured', $object->getBody());
 }
예제 #6
0
 public function testProcess()
 {
     $type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT;
     $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
     $search = $manager->createSearch();
     $search->setSlice(0, 1);
     $result = $manager->searchItems($search);
     if (($customerItem = reset($result)) === false) {
         throw new \RuntimeException('No customer item found');
     }
     $addrItem = $customerItem->getPaymentAddress();
     $addrItem->setEmail('*****@*****.**');
     $basketCntl = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $basketCntl->setAddress($type, $addrItem);
     $view = \TestHelperHtml::getView();
     $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, array('cs_option_account' => 1));
     $view->addHelper('param', $helper);
     $view->orderBasket = $basketCntl->get();
     $this->context->setView($view);
     $this->object->setView($view);
     $orderBaseStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
     $customerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Customer\\Manager\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
     $orderBaseStub->expects($this->once())->method('saveItem');
     $customerStub->expects($this->once())->method('saveItem');
     \Aimeos\MShop\Factory::injectManager($this->context, 'customer', $customerStub);
     \Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $orderBaseStub);
     $this->object->process();
 }
예제 #7
0
 public function testGetBodyMShopException()
 {
     $object = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Account\\Watch\\Standard')->setConstructorArgs(array($this->context, array()))->setMethods(array('setViewParams'))->getMock();
     $object->expects($this->once())->method('setViewParams')->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
     $object->setView(\TestHelperHtml::getView());
     $this->assertContains('test exception', $object->getBody());
 }
예제 #8
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $context = \TestHelperHtml::getContext();
     $this->client = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Catalog\\Filter\\Standard')->setMethods(array('getHeader', 'getBody', 'testMethod'))->setConstructorArgs(array($context, array()))->getMock();
     $this->object = new \Aimeos\Client\Html\Common\Decorator\Example($this->client, $context, array());
     $this->object->setView(\TestHelperHtml::getView());
 }
예제 #9
0
 public function testProcess()
 {
     $type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT;
     $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
     $search = $manager->createSearch();
     $search->setSlice(0, 1);
     $result = $manager->searchItems($search);
     if (($customerItem = reset($result)) === false) {
         throw new \Exception('No customer item found');
     }
     $addrItem = $customerItem->getPaymentAddress();
     $addrItem->setEmail('*****@*****.**');
     $mailStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\None')->disableOriginalConstructor()->getMock();
     $mailMsgStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\Message\\None')->disableOriginalConstructor()->disableOriginalClone()->getMock();
     $mailStub->expects($this->once())->method('createMessage')->will($this->returnValue($mailMsgStub));
     $mailStub->expects($this->once())->method('send');
     $this->context->setMail($mailStub);
     $basketCntl = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $basketCntl->setAddress($type, $addrItem);
     $view = \TestHelperHtml::getView();
     $view->orderBasket = $basketCntl->get();
     $this->context->setView($view);
     $this->object->setView($view);
     $orderBaseStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
     $customerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Customer\\Manager\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
     $orderBaseStub->expects($this->once())->method('saveItem');
     $customerStub->expects($this->once())->method('saveItem');
     \Aimeos\MShop\Factory::injectManager($this->context, 'customer', $customerStub);
     \Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $orderBaseStub);
     $this->object->process();
 }
예제 #10
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->context = clone \TestHelperHtml::getContext();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Account\History\Lists\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
예제 #11
0
 protected function setUp()
 {
     $this->context = clone \TestHelperHtml::getContext();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Checkout\Confirm\Order\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
예제 #12
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $context = \TestHelperHtml::getContext();
     $config = $context->getConfig();
     $config->set('client/html/catalog/lists/basket-add', true);
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Catalog\Lists\Items\Standard($context, $paths);
     $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($context);
     $search = $catalogManager->createSearch();
     $search->setConditions($search->compare('==', 'catalog.code', 'cafe'));
     $catItems = $catalogManager->searchItems($search);
     if (($catItem = reset($catItems)) === false) {
         throw new \RuntimeException('No catalog item found');
     }
     $domains = array('media', 'price', 'text', 'attribute', 'product');
     $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', array('CNE', 'U:TEST', 'U:BUNDLE')));
     $total = 0;
     $view = \TestHelperHtml::getView('unittest', $config);
     $view->listProductItems = $productManager->searchItems($search, $domains, $total);
     $view->listProductTotal = $total;
     $view->listPageSize = 100;
     $view->listPageCurr = 1;
     $view->listParams = array();
     $view->listCatPath = array($catalogManager->createItem(), $catItem);
     $this->object->setView($view);
 }
예제 #13
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Catalog\Session\Pinned\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
예제 #14
0
 public function testProcess()
 {
     $type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY;
     $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
     $addrManager = $manager->getSubManager('address');
     $search = $manager->createSearch();
     $search->setSlice(0, 1);
     $result = $manager->searchItems($search);
     if (($customerItem = reset($result)) === false) {
         throw new \RuntimeException('No customer item found');
     }
     $addrItem = $customerItem->getPaymentAddress();
     $addrItem->setId(null);
     $basketCntl = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $basketCntl->setAddress($type, $addrItem);
     $view = \TestHelperHtml::getView();
     $view->orderBasket = $basketCntl->get();
     $view->orderBasket->setCustomerId($customerItem->getId());
     $this->object->setView($view);
     $this->object->process();
     $orderAddress = $view->orderBasket->getAddress($type);
     $actual = $addrManager->getItem($orderAddress->getAddressId());
     $addrManager->deleteItem($actual->getId());
     $this->assertEquals($addrItem->getFirstname(), $actual->getFirstname());
     $this->assertEquals($addrItem->getLastname(), $actual->getLastname());
     $this->assertEquals($addrItem->getPostal(), $actual->getPostal());
     $this->assertEquals($addrItem->getTelephone(), $actual->getTelephone());
     $this->assertEquals($addrItem->getTelefax(), $actual->getTelefax());
 }
예제 #15
0
 public function testGetBodyException()
 {
     $mock = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Basket\\Standard\\Standard')->setConstructorArgs(array($this->context, \TestHelperHtml::getHtmlTemplatePaths()))->setMethods(array('setViewParams'))->getMock();
     $mock->setView(\TestHelperHtml::getView());
     $mock->expects($this->once())->method('setViewParams')->will($this->throwException(new \Exception()));
     $mock->getBody();
 }
예제 #16
0
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Basket\Related\Bought\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
예제 #17
0
 protected function setUp()
 {
     $this->view = \TestHelperHtml::getView();
     $this->context = \TestHelperHtml::getContext();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Account\Download\Standard($this->context, $paths);
     $this->object->setView($this->view);
 }
예제 #18
0
 public function testGetBodyOtherStep()
 {
     $view = \TestHelperHtml::getView();
     $view->standardStepActive = 'xyz';
     $this->object->setView($view);
     $output = $this->object->getBody();
     $this->assertEquals('', $output);
 }
예제 #19
0
 public function testGetBody()
 {
     $view = \TestHelperHtml::getView();
     $view->standardBasket = $this->getBasket();
     $this->object->setView($view);
     $output = $this->object->getBody();
     $this->assertStringStartsWith('<div class="common-summary-service container">', $output);
 }
예제 #20
0
 protected function setUp()
 {
     \Aimeos\MShop\Factory::setCache(true);
     $this->context = \TestHelperHtml::getContext();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Checkout\Standard\Process\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
예제 #21
0
 public function testGetBody()
 {
     $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $view = \TestHelperHtml::getView();
     $view->standardBasket = $controller->get();
     $this->object->setView($view);
     $output = $this->object->getBody();
     $this->assertStringStartsWith('<div class="checkout-standard-summary-option container">', $output);
 }
예제 #22
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $this->emailMock = $this->getMock('\\Aimeos\\MW\\Mail\\Message\\None');
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Email\Watch\Html\Salutation\Standard($this->context, $paths);
     $view = \TestHelperHtml::getView();
     $view->extAddressItem = self::$customerItem->getPaymentAddress();
     $view->addHelper('mail', new \Aimeos\MW\View\Helper\Mail\Standard($view, $this->emailMock));
     $this->object->setView($view);
 }
예제 #23
0
 public function testGetBody()
 {
     $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $basket = $controller->get();
     $basket->addCoupon('OPQR');
     $view = \TestHelperHtml::getView();
     $view->standardBasket = $basket;
     $this->object->setView($view);
     $output = $this->object->getBody();
     $this->assertStringStartsWith('<div class="common-summary-coupon', $output);
 }
예제 #24
0
 public function testGetBody()
 {
     $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $controller->addProduct($this->getProductItem('CNE')->getId(), 1, array(), array(), array(), array(), array(), 'default');
     $view = \TestHelperHtml::getView();
     $view->standardBasket = $controller->get();
     $this->object->setView($view);
     $output = $this->object->getBody();
     $this->assertStringStartsWith('<div class="common-summary-detail container">', $output);
     $this->assertRegExp('#<tfoot>.*<tr class="tax">.*<td class="price">3.03 .+</td>.*.*</tfoot>#smU', $output);
 }
예제 #25
0
 public function testGetBody()
 {
     $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $view = \TestHelperHtml::getView();
     $view->standardStepActive = 'summary';
     $view->standardBasket = $controller->get();
     $view->standardSteps = array('before', 'summary');
     $this->object->setView($view);
     $output = $this->object->getBody();
     $this->assertStringStartsWith('<section class="checkout-standard-summary common-summary">', $output);
 }
예제 #26
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $this->emailMock = $this->getMock('\\Aimeos\\MW\\Mail\\Message\\None');
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Email\Payment\Html\Legal\Standard($this->context, $paths);
     $view = \TestHelperHtml::getView();
     $view->extOrderItem = self::$orderItem;
     $view->extOrderBaseItem = self::$orderBaseItem;
     $view->addHelper('mail', new \Aimeos\MW\View\Helper\Mail\Standard($view, $this->emailMock));
     $this->object->setView($view);
 }
예제 #27
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $this->emailMock = $this->getMock('\\Aimeos\\MW\\Mail\\Message\\None');
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Email\Delivery\Html\Salutation\Standard($this->context, $paths);
     $view = \TestHelperHtml::getView();
     $view->extOrderItem = self::$orderItem;
     $view->extOrderBaseItem = self::$orderBaseItem;
     $view->extAddressItem = self::$orderBaseItem->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY);
     $view->addHelper('mail', new \Aimeos\MW\View\Helper\Mail\Standard($view, $this->emailMock));
     $this->object->setView($view);
 }
예제 #28
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $this->emailMock = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\Message\\None')->getMock();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Email\Payment\Standard($this->context, $paths);
     $view = \TestHelperHtml::getView('unittest', $this->context->getConfig());
     $view->extOrderItem = self::$orderItem;
     $view->extOrderBaseItem = self::$orderBaseItem;
     $view->extAddressItem = self::$orderBaseItem->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
     $view->addHelper('mail', new \Aimeos\MW\View\Helper\Mail\Standard($view, $this->emailMock));
     $this->object->setView($view);
 }
예제 #29
0
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $this->emailMock = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\Message\\None')->getMock();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Email\Account\Html\Standard($this->context, $paths);
     $view = \TestHelperHtml::getView('unittest', $this->context->getConfig());
     $view->extAddressItem = self::$customerItem->getPaymentAddress();
     $view->extAccountCode = self::$customerItem->getCode();
     $view->extAccountPassword = '******';
     $view->addHelper('mail', new \Aimeos\MW\View\Helper\Mail\Standard($view, $this->emailMock));
     $this->object->setView($view);
 }
예제 #30
0
 public function testGetBody()
 {
     $manager = \Aimeos\MShop\Order\Manager\Factory::createManager($this->context);
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'order.base.service.code', 'paypalexpress'));
     $items = $manager->searchItems($search);
     if (($item = reset($items)) === false) {
         throw new \Exception('No item found');
     }
     $view = \TestHelperHtml::getView();
     $view->confirmOrderItem = $item;
     $this->object->setView($view);
     $output = $this->object->getBody();
     $this->assertStringStartsWith('<div class="checkout-confirm-retry">', $output);
 }