Ejemplo n.º 1
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());
 }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 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();
     $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);
 }
Ejemplo n.º 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\Catalog\Session\Pinned\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
Ejemplo n.º 5
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());
 }
Ejemplo n.º 6
0
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Checkout\Standard\Order\Address\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
Ejemplo n.º 7
0
 protected function setUp()
 {
     \Aimeos\MShop\Factory::setCache(true);
     $this->context = \TestHelperHtml::getContext();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Checkout\Standard\Order\Account\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
Ejemplo n.º 8
0
 protected function setUp()
 {
     $this->context = \TestHelperHtml::getContext();
     $this->context->setEditor('UTC001');
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Checkout\Confirm\Standard($this->context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
Ejemplo n.º 9
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);
 }
Ejemplo n.º 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 = \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);
 }
Ejemplo n.º 11
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);
 }
Ejemplo n.º 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()
 {
     $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);
 }
Ejemplo n.º 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();
     $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);
 }
Ejemplo n.º 14
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();
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Catalog\Lists\Quote\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, array('text'));
     if (($catItem = reset($catItems)) === false) {
         throw new \Exception('No catalog item found');
     }
     $view = \TestHelperHtml::getView();
     $view->listCatPath = array($catalogManager->createItem(), $catItem);
     $this->object->setView($view);
 }
Ejemplo n.º 15
0
 public function testProcessNoService()
 {
     $view = $this->object->getView();
     $param = array('c_step' => 'process');
     $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
     $view->addHelper('param', $helper);
     $orderid = $this->getOrder('2008-02-15 12:34:56')->getId();
     $this->context->getSession()->set('aimeos/orderid', $orderid);
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $mock = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Checkout\\Standard\\Process\\Standard')->setConstructorArgs(array($this->context, $paths))->setMethods(array('getOrderServiceCode'))->getMock();
     $mock->expects($this->once())->method('getOrderServiceCode')->will($this->returnValue(null));
     $mock->setView($view);
     $mock->process();
     $this->assertEquals(0, count($view->get('standardErrorList', array())));
     $this->assertEquals(0, count($view->get('standardProcessParams', array())));
     $this->assertEquals('GET', $view->standardMethod);
     $this->assertEquals('http://baseurl/checkout/standard/?c_step=payment', $view->standardUrlPayment);
 }
Ejemplo n.º 16
0
 public function testProcessOK()
 {
     $object = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Account\\Download\\Standard')->setConstructorArgs(array($this->context, \TestHelperHtml::getHtmlTemplatePaths()))->setMethods(array('checkAccess', 'checkDownload'))->getMock();
     $object->setView($this->view);
     $object->expects($this->once())->method('checkAccess')->will($this->returnValue(true));
     $object->expects($this->once())->method('checkDownload')->will($this->returnValue(true));
     $attrManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Product\\Attribute\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('getItem'))->getMock();
     $attrManagerStub->expects($this->once())->method('getItem')->will($this->returnValue($attrManagerStub->createItem()));
     \Aimeos\MShop\Factory::injectManager($this->context, 'order/base/product/attribute', $attrManagerStub);
     $stream = $this->getMockBuilder('\\Psr\\Http\\Message\\StreamInterface')->getMock();
     $response = $this->getMockBuilder('\\Psr\\Http\\Message\\ResponseInterface')->getMock();
     $response->expects($this->exactly(7))->method('withHeader')->will($this->returnSelf());
     $helper = $this->getMockBuilder('\\Aimeos\\MW\\View\\Helper\\Response\\Standard')->setConstructorArgs(array($this->view, $response))->setMethods(array('createStream'))->getMock();
     $helper->expects($this->once())->method('createStream')->will($this->returnValue($stream));
     $this->view->addHelper('response', $helper);
     \Aimeos\MShop\Factory::setCache(true);
     $object->process();
     \Aimeos\MShop\Factory::setCache(false);
 }
Ejemplo n.º 17
0
 protected function setUp()
 {
     $this->paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->context = \TestHelperHtml::getContext('unitperf');
     $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context);
     $search = $catalogManager->createSearch();
     $search->setConditions($search->compare('==', 'catalog.code', 'home'));
     $items = $catalogManager->searchItems($search);
     if (($catalogItem = reset($items)) === false) {
         throw new \RuntimeException('No catalog item with code "home" found');
     }
     $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', 'perf-00000'));
     $items = $productManager->searchItems($search);
     if (($productItem = reset($items)) === false) {
         throw new \RuntimeException('No product item with code "perf-00000" found');
     }
     $this->view = \TestHelperHtml::getView('unitperf');
     $param = array('f_catid' => $catalogItem->getId(), 'd_prodid' => $productItem->getId());
     $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
     $this->view->addHelper('param', $helper);
 }
Ejemplo n.º 18
0
 protected function setUp()
 {
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Locale\Select\Language\Standard(\TestHelperHtml::getContext(), $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
Ejemplo n.º 19
0
 public function testProcessException()
 {
     $view = $this->object->getView();
     $param = array('c_step' => 'process');
     $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
     $view->addHelper('param', $helper);
     $orderid = $this->getOrder('2008-02-15 12:34:56')->getId();
     $this->context->getSession()->set('aimeos/orderid', $orderid);
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $mock = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Checkout\\Standard\\Process\\Standard')->setConstructorArgs(array($this->context, $paths))->setMethods(array('getOrderServiceCode'))->getMock();
     $mock->expects($this->once())->method('getOrderServiceCode')->will($this->throwException(new \RuntimeException()));
     $mock->setView($view);
     $mock->process();
     $this->assertInternalType('array', $view->standardErrorList);
 }
Ejemplo n.º 20
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()
 {
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Catalog\Filter\Search\Standard(\TestHelperHtml::getContext(), $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
Ejemplo n.º 21
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()
 {
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Catalog\Detail\Additional\Attribute\Standard(\TestHelperHtml::getContext(), $paths);
     $this->object->setView(\TestHelperHtml::getView());
 }
Ejemplo n.º 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->templatePaths = \TestHelperHtml::getHtmlTemplatePaths();
 }
Ejemplo n.º 23
0
 public function testGetBodyCategoryLevels()
 {
     $context = clone $this->context;
     $context->getConfig()->set('client/html/catalog/lists/levels', \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE);
     $paths = \TestHelperHtml::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Catalog\Lists\Standard($context, $paths);
     $this->object->setView(\TestHelperHtml::getView());
     $view = $this->object->getView();
     $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, array('f_catid' => $this->getCatalogItem('root')->getId()));
     $view->addHelper('param', $helper);
     $output = $this->object->getBody();
     $this->assertRegExp('#.*Cafe Noire Cappuccino.*#smu', $output);
     $this->assertRegExp('#.*Cafe Noire Expresso.*#smu', $output);
     $this->assertRegExp('#.*Unittest: Bundle.*#smu', $output);
     $this->assertRegExp('#.*Unittest: Test priced Selection.*#smu', $output);
 }