예제 #1
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;
 }
예제 #2
0
 private static function getAimeos()
 {
     if (!isset(self::$aimeos)) {
         require_once 'Bootstrap.php';
         spl_autoload_register('Aimeos\\Bootstrap::autoload');
         $extdir = dirname(dirname(dirname(__DIR__)));
         self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true);
     }
     return self::$aimeos;
 }
예제 #3
0
 public function testCreateController()
 {
     $context = \TestHelperFrontend::getContext();
     $config = $context->getConfig();
     $config->set('controller/frontend/common/decorators/default', array());
     $target = '\\Aimeos\\Controller\\Frontend\\Service\\Iface';
     $controller = \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext());
     $this->assertInstanceOf($target, $controller);
     $controller = \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
     $this->assertInstanceOf($target, $controller);
 }
예제 #4
0
 public function testUpdate()
 {
     $context = \TestHelperFrontend::getContext();
     $name = 'ControllerFrontendOrderUpdate';
     $context->getConfig()->set('controller/common/order/name', $name);
     $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')->setMethods(array('update'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
     $orderCntlStub->expects($this->once())->method('update');
     $object = new \Aimeos\Controller\Frontend\Order\Standard($context);
     $object->update(\Aimeos\MShop\Factory::createManager($context, 'order')->createItem());
 }
예제 #5
0
 public function testClearSpecific()
 {
     $cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
     $context = \TestHelperFrontend::getContext();
     $basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
     $catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
     \Aimeos\Controller\Frontend\Factory::clear((string) $context, 'basket');
     $basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
     $catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
     \Aimeos\Controller\Frontend\Factory::setCache($cache);
     $this->assertNotSame($basket1, $basket2);
     $this->assertSame($catalog1, $catalog2);
 }
 protected function setUp()
 {
     $this->context = \TestHelperFrontend::getContext();
     $object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
     $this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category($object, $this->context);
 }
예제 #7
0
 protected function setUp()
 {
     $context = \TestHelperFrontend::getContext();
     $cntl = new \Aimeos\Controller\Frontend\Catalog\Standard($context);
     $this->object = new \Aimeos\Controller\Frontend\Common\Decorator\Example($cntl, $context);
 }
예제 #8
0
 public function testCreateControllerNotExisting()
 {
     $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
     \Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
 }
예제 #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()
 {
     $context = \TestHelperFrontend::getContext();
     $controller = \Aimeos\Controller\Frontend\Service\Factory::createController($context, 'Standard');
     $this->object = new \Aimeos\Controller\Frontend\Service\Decorator\Example($controller, $context);
 }
예제 #10
0
 /**
  * @return \Aimeos\MShop\Order\Item\Base\Iface
  */
 protected function getServiceItem()
 {
     $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext());
     $search = $serviceManager->createSearch(true);
     $expr = array($search->getConditions(), $search->compare('==', 'service.provider', 'Standard'), $search->compare('==', 'service.type.domain', 'service'), $search->compare('==', 'service.type.code', 'delivery'));
     $search->setConditions($search->combine('&&', $expr));
     $services = $serviceManager->searchItems($search);
     if (($service = reset($services)) === false) {
         throw new \Exception('No service item found');
     }
     return $service;
 }
예제 #11
0
 public function testGetIndexItemsCategory()
 {
     $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext());
     $search = $catalogManager->createSearch();
     $search->setConditions($search->compare('==', 'catalog.code', 'new'));
     $search->setSlice(0, 1);
     $items = $catalogManager->searchItems($search);
     if (($item = reset($items)) === false) {
         throw new \RuntimeException('Catalog item not found');
     }
     $total = 0;
     $filter = $this->object->createIndexFilterCategory($item->getId(), 'position', '+', 1, 1);
     $results = $this->object->getIndexItems($filter, array(), $total);
     $this->assertEquals(3, $total);
     $this->assertEquals(1, count($results));
 }
예제 #12
0
<?php

/**
 * @copyright Metaways Infosystems GmbH, 2011
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
 * @copyright Aimeos (aimeos.org), 2015
 */
/*
 * Set error reporting to maximum
 */
error_reporting(-1);
ini_set('display_errors', '1');
date_default_timezone_set('UTC');
/**
 * Set locale settings to reasonable defaults
 */
setlocale(LC_ALL, 'en_US.UTF-8');
setlocale(LC_NUMERIC, 'POSIX');
setlocale(LC_CTYPE, 'en_US.UTF-8');
setlocale(LC_TIME, 'POSIX');
/*
 * Set include path for tests
 */
define('PATH_TESTS', __DIR__);
require_once 'TestHelperFrontend.php';
\TestHelperFrontend::bootstrap();
예제 #13
0
 /**
  * @param string $code
  */
 protected function getService($code)
 {
     $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext());
     $search = $serviceManager->createSearch();
     $search->setConditions($search->compare('==', 'service.code', $code));
     $result = $serviceManager->searchItems($search, array('text'));
     if (($item = reset($result)) === false) {
         throw new \Exception(sprintf('No service item with code "%1$s" found', $code));
     }
     return $item;
 }
예제 #14
0
 /**
  * @param string $company
  */
 protected function getAddress($company)
 {
     $customer = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelperFrontend::getContext(), 'Standard');
     $addressManager = $customer->getSubManager('address', 'Standard');
     $search = $addressManager->createSearch();
     $search->setConditions($search->compare('==', 'customer.address.company', $company));
     $items = $addressManager->searchItems($search);
     if (($item = reset($items)) === false) {
         throw new \RuntimeException(sprintf('No address item with company "%1$s" found', $company));
     }
     return $item;
 }