Beispiel #1
0
 protected function setUp()
 {
     $this->context = \TestHelperJadm::getContext();
     $templatePaths = \TestHelperJadm::getControllerPaths();
     $this->view = $this->context->getView();
     $this->object = new \Aimeos\Controller\JsonAdm\Media\Standard($this->context, $this->view, $templatePaths, 'price');
 }
 protected function setUp()
 {
     $this->context = \TestHelperJadm::getContext();
     $templatePaths = \TestHelperJadm::getJsonadmPaths();
     $this->view = $this->context->getView();
     $this->object = new \Aimeos\Admin\JsonAdm\Coupon\Standard($this->context, $this->view, $templatePaths, 'coupon');
 }
Beispiel #3
0
 protected function setUp()
 {
     $context = \TestHelperJadm::getContext();
     $view = $context->getView();
     $this->stub = $this->getMockBuilder('\\Aimeos\\Controller\\JsonAdm\\Standard')->setConstructorArgs(array($context, $view, array(), 'attribute'))->getMock();
     $this->object = new TestBase($this->stub, $context, $view, array(), 'attribute');
 }
Beispiel #4
0
 protected function setUp()
 {
     $this->context = \TestHelperJadm::getContext();
     $config = $this->context->getConfig();
     $config->set('controller/jsonadm/common/decorators/default', array());
     $config->set('controller/jsonadm/decorators/global', array());
     $config->set('controller/jsonadm/decorators/local', array());
 }
Beispiel #5
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;
 }
Beispiel #6
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;
 }
Beispiel #7
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);
 }
 public function testClearSpecific()
 {
     $cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
     $context = \TestHelperJadm::getContext();
     $templatePaths = \TestHelperJadm::getJsonadmPaths();
     $cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
     $cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
     \Aimeos\Admin\JsonAdm\Factory::clear((string) $context, 'order');
     $cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
     $cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
     \Aimeos\Admin\JsonAdm\Factory::setCache($cache);
     $this->assertNotSame($cntlA1, $cntlA2);
     $this->assertSame($cntlB1, $cntlB2);
 }
Beispiel #9
0
 public function testGetInvalid()
 {
     $header = array();
     $status = 500;
     $templatePaths = \TestHelperJadm::getControllerPaths();
     $object = new \Aimeos\Controller\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'invalid');
     $result = json_decode($object->get('', $header, $status), true);
     $this->assertEquals(404, $status);
     $this->assertEquals(1, count($header));
     $this->assertEquals(1, count($result['errors']));
     $this->assertArrayHasKey('title', $result['errors'][0]);
     $this->assertArrayHasKey('detail', $result['errors'][0]);
     $this->assertArrayNotHasKey('data', $result);
     $this->assertArrayNotHasKey('indluded', $result);
 }
Beispiel #10
0
<?php

/**
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
 * @copyright Aimeos (aimeos.org), 2015
 */
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');
require_once 'TestHelperJadm.php';
\TestHelperJadm::bootstrap();