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'); }
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 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); }