Beispiel #1
0
 public function testAddControllerDecoratorsExcludes()
 {
     $this->context->getConfig()->set('controller/jsonadm/decorators/excludes', array('TestDecorator'));
     $this->context->getConfig()->set('controller/jsonadm/common/decorators/default', array('TestDecorator'));
     $this->setExpectedException('\\Aimeos\\Controller\\JsonAdm\\Exception');
     \Aimeos\Controller\JsonAdm\Factory::createController($this->context, array(), 'attribute', 'Standard');
 }
Beispiel #2
0
 public function testClearSpecific()
 {
     $cache = \Aimeos\Controller\JsonAdm\Factory::setCache(true);
     $context = \TestHelperJadm::getContext();
     $templatePaths = \TestHelperJadm::getControllerPaths();
     $cntlA1 = \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, 'attribute');
     $cntlB1 = \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, 'attribute/lists/type');
     \Aimeos\Controller\JsonAdm\Factory::clear((string) $context, 'attribute');
     $cntlA2 = \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, 'attribute');
     $cntlB2 = \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, 'attribute/lists/type');
     \Aimeos\Controller\JsonAdm\Factory::setCache($cache);
     $this->assertNotSame($cntlA1, $cntlA2);
     $this->assertSame($cntlB1, $cntlB2);
 }
 /**
  * Returns the resource controller
  *
  * @return \Aimeos\MShop\Context\Item\Iface Context item
  */
 protected function createController()
 {
     $site = Route::input('site', Input::get('site', 'default'));
     $lang = Input::get('lang', config('app.locale', 'en'));
     $resource = Route::input('resource');
     $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get();
     $templatePaths = $aimeos->getCustomPaths('controller/jsonadm/templates');
     $context = app('\\Aimeos\\Shop\\Base\\Context')->get(false);
     $context = $this->setLocale($context, $site, $lang);
     $view = app('\\Aimeos\\Shop\\Base\\View')->create($context->getConfig(), $templatePaths, $lang);
     $context->setView($view);
     return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource);
 }
Beispiel #4
0
 public static function bootstrap()
 {
     self::getAimeos();
     \Aimeos\MShop\Factory::setCache(false);
     \Aimeos\Controller\JsonAdm\Factory::setCache(false);
 }
 /**
  * Returns the resource controller
  *
  * @param string $sitecode Unique site code
  * @param string Resource location, e.g. "product/stock/wareshouse"
  * @param string $lang Language code
  * @return \Aimeos\MShop\Context\Item\Iface Context item
  */
 protected function createController($sitecode, $resource, $lang)
 {
     $lang = $lang ? $lang : 'en';
     $context = $this->getContext($sitecode, $lang);
     $templatePaths = Base::getAimeos()->getCustomPaths('controller/jsonadm/templates');
     $view = Base::getView($context->getConfig(), $this->uriBuilder, $templatePaths, $this->request, $lang);
     $context->setView($view);
     return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource);
 }
 /**
  * Returns the resource controller
  *
  * @param string $site Unique site code
  * @param string Resource location, e.g. "product/stock/wareshouse"
  * @param string $lang Language code
  * @return \Aimeos\MShop\Context\Item\Iface Context item
  */
 protected function createController($site, $resource, $lang)
 {
     $aimeos = $this->get('aimeos')->get();
     $templatePaths = $aimeos->getCustomPaths('controller/jsonadm/templates');
     $context = $this->get('aimeos_context')->get(false);
     $context = $this->setLocale($context, $site, $lang);
     $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang);
     $context->setView($view);
     return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource);
 }