Example #1
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());
 }
Example #2
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());
 }
Example #3
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());
 }
Example #4
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());
 }
Example #5
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();
 }
Example #6
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());
 }
Example #7
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();
 }
Example #8
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());
 }
Example #9
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);
 }
Example #10
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());
 }
Example #11
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());
 }
Example #12
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());
 }
Example #13
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();
 }
Example #14
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());
 }
Example #15
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());
 }
Example #16
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);
 }
Example #17
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);
 }
Example #18
0
 private static function getAimeos()
 {
     if (!isset(self::$aimeos)) {
         require_once dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
         self::$aimeos = new \Aimeos\Bootstrap(array(), false);
     }
     return self::$aimeos;
 }
Example #19
0
 public function testGetBodyOtherStep()
 {
     $view = \TestHelperHtml::getView();
     $view->standardStepActive = 'xyz';
     $this->object->setView($view);
     $output = $this->object->getBody();
     $this->assertEquals('', $output);
 }
Example #20
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);
 }
Example #21
0
 private static function getAimeos()
 {
     if (!isset(self::$aimeos)) {
         require_once 'Bootstrap.php';
         spl_autoload_register('Aimeos\\Bootstrap::autoload');
         $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
         self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true);
     }
     return self::$aimeos;
 }
Example #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);
 }
Example #23
0
 /**
  * @param string $code
  */
 protected function getProductItem($code)
 {
     $manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperHtml::getContext());
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', $code));
     $items = $manager->searchItems($search, array('attribute', 'price', 'product'));
     if (($item = reset($items)) === false) {
         throw new \Exception(sprintf('No product item with code "%1$s" found', $code));
     }
     return $item;
 }
Example #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);
 }
Example #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);
 }
Example #26
0
 public function testTransformRelativeUrlFromConfig()
 {
     $view = new \Aimeos\MW\View\Standard();
     $helper = new \Aimeos\MW\View\Helper\Encoder\Standard($view);
     $view->addHelper('encoder', $helper);
     $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, \TestHelperHtml::getContext()->getConfig());
     $view->addHelper('config', $helper);
     $this->object = new \Aimeos\MW\View\Helper\Content\Standard($view);
     $output = $this->object->transform('path/to/resource');
     $this->assertEquals('/path/to/resource', $output);
 }
Example #27
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);
 }
Example #28
0
 protected function getProductItem()
 {
     $manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperHtml::getContext());
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', 'CNC'));
     $items = $manager->searchItems($search);
     if (($item = reset($items)) === false) {
         throw new \Exception('No product item with code "CNC" found');
     }
     return $item;
 }
Example #29
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);
 }
Example #30
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);
 }