Exemplo n.º 1
0
 protected function setUp()
 {
     \Aimeos\MShop\Factory::setCache(true);
     $context = \TestHelperCntl::getContext();
     $aimeos = \TestHelperCntl::getAimeos();
     $this->object = new TestAbstract($context, $aimeos);
 }
Exemplo n.º 2
0
 public 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;
 }
Exemplo n.º 3
0
 public function testSet()
 {
     $item = \Aimeos\MShop\Factory::createManager(\TestHelperCntl::getContext(), 'product/stock/warehouse')->createItem();
     $item->setCode('cache-test');
     $item->setId(1);
     $this->object->set($item);
     $id = $this->object->get('cache-test');
     $this->assertEquals($item->getId(), $id);
 }
Exemplo n.º 4
0
 private static function getAimeos()
 {
     if (!isset(self::$aimeos)) {
         require_once 'Bootstrap.php';
         spl_autoload_register('Aimeos::autoload');
         $extdir = dirname(dirname(dirname(__DIR__)));
         self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
     }
     return self::$aimeos;
 }
Exemplo n.º 5
0
 public 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;
 }
Exemplo n.º 6
0
 protected function setUp()
 {
     $this->context = \TestHelperCntl::getContext();
     $this->object = new \Aimeos\Controller\Common\Media\Standard($this->context);
 }
Exemplo n.º 7
0
<?php

/*
 * Set error reporting to maximum
 */
error_reporting(-1);
ini_set('display_errors', true);
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');
require_once 'TestHelperCntl.php';
TestHelperCntl::bootstrap();
Exemplo n.º 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()
 {
     \Aimeos\MShop\Factory::setCache(true);
     $this->context = \TestHelperCntl::getContext();
     $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, array());
 }
Exemplo n.º 9
0
 protected function getOrderItem($datepayment)
 {
     $manager = \Aimeos\MShop\Factory::createManager(\TestHelperCntl::getContext(), 'order');
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'order.datepayment', $datepayment));
     $result = $manager->searchItems($search);
     if (($item = reset($result)) === false) {
         throw new \RuntimeException(sprintf('No order item for payment date "%1$s" found', $datepayment));
     }
     return $item;
 }
Exemplo n.º 10
0
 public function testCreateControllerNotExisting()
 {
     $this->setExpectedException('\\Aimeos\\Controller\\Common\\Exception');
     \Aimeos\Controller\Common\Order\Factory::createController(\TestHelperCntl::getContext(), 'notexist');
 }
Exemplo n.º 11
0
 protected function setUp()
 {
     \Aimeos\MShop\Factory::setCache(true);
     $context = \TestHelperCntl::getContext();
     $this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Attribute\Standard($context);
 }
Exemplo n.º 12
0
 public function testUpdateStockBundle()
 {
     $stockItems = array();
     $context = \TestHelperCntl::getContext();
     $productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', 'U:BUNDLE'));
     $bundleItems = $productManager->searchItems($search, array('product'));
     $name = 'ControllerCommonOrderUpdate';
     $context->getConfig()->set('mshop/product/manager/name', $name);
     $stockManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Stock\\Standard')->setMethods(array('saveItem', 'searchItems'))->setConstructorArgs(array($context))->getMock();
     $productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')->setMethods(array('getSubManager'))->setConstructorArgs(array($context))->getMock();
     $productManagerStub->expects($this->once())->method('getSubManager')->will($this->returnValue($stockManagerStub));
     \Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
     $stock = 10;
     $bundleStockItems = array();
     foreach ($bundleItems as $bundleId => $bundleItem) {
         foreach ($bundleItem->getRefItems('product', null, 'default') as $refItem) {
             $stockItem = $stockManagerStub->createItem();
             $stockItem->setParentId($refItem->getId());
             $stockItem->setStockLevel($stock);
             $stockItems[] = $stockItem;
             $stock += 10;
         }
         $bundleStockItem = $stockManagerStub->createItem();
         $bundleStockItem->setParentId($bundleId);
         $bundleStockItem->setStockLevel($stock - 5);
         $bundleStockItems[] = $bundleStockItem;
     }
     $fcn = function ($subject) {
         return $subject->getStockLevel() === 10;
     };
     $stockManagerStub->expects($this->exactly(2))->method('searchItems')->will($this->onConsecutiveCalls($stockItems, $bundleStockItems));
     $stockManagerStub->expects($this->exactly(1))->method('saveItem')->with($this->callback($fcn));
     $class = new \ReflectionClass('\\Aimeos\\Controller\\Common\\Order\\Standard');
     $method = $class->getMethod('updateStockBundle');
     $method->setAccessible(true);
     $object = new \Aimeos\Controller\Common\Order\Standard($context);
     $method->invokeArgs($object, array($bundleItems, 'default'));
 }