/** * @test */ public function getOutput() { $aimeos = new \Aimeos\Shop\Base\Aimeos(); $this->inject($this->object, 'aimeos', $aimeos); $context = $this->getMockBuilder('\\Aimeos\\Shop\\Base\\Context')->setMethods(array('get'))->disableOriginalConstructor()->getMock(); $ctx = new \Aimeos\MShop\Context\Item\Standard(); $ctx->setConfig(new \Aimeos\MW\Config\PHPArray()); $ctx->setLocale(new \Aimeos\MShop\Locale\Item\Standard(array('langid' => 'de'))); $context->expects($this->once())->method('get')->will($this->returnValue($ctx)); $this->inject($this->object, 'context', $context); $viewContainer = $this->getMockBuilder('\\Aimeos\\Shop\\Base\\View')->setMethods(array('create'))->disableOriginalConstructor()->getMock(); $mwView = new \Aimeos\MW\View\Standard(); $viewContainer->expects($this->once())->method('create')->will($this->returnValue($mwView)); $this->inject($this->object, 'viewContainer', $viewContainer); $uriBuilder = $this->getMockBuilder('\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder')->disableOriginalConstructor()->getMock(); $this->inject($this->object, 'uriBuilder', $uriBuilder); $client = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Catalog\\Lists\\Standard')->setMethods(array('getBody', 'getHeader', 'process'))->disableOriginalConstructor()->getMock(); $client->expects($this->once())->method('getBody')->will($this->returnValue('body')); $client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); $client->expects($this->once())->method('process'); \Aimeos\Client\Html\Catalog\Lists\Factory::injectClient('\\Aimeos\\Client\\Html\\Catalog\\Lists\\Standard', $client); $this->view->expects($this->once())->method('assign')->with($this->equalTo('aimeos_component_header'), $this->equalTo('header')); $class = new \ReflectionClass('\\Aimeos\\Shop\\Controller\\AbstractController'); $method = $class->getMethod('getOutput'); $method->setAccessible(true); $result = $method->invokeArgs($this->object, array('catalog/lists')); $this->assertEquals('body', $result); }
/** * Renders the catalog list section. */ public function listAction() { if (is_object($GLOBALS['TSFE']) && isset($GLOBALS['TSFE']->config['config'])) { $GLOBALS['TSFE']->config['config']['noPageTitle'] = 2; } $templatePaths = Base::getAimeos()->getCustomPaths('client/html'); $client = \Aimeos\Client\Html\Catalog\Lists\Factory::createClient($this->getContext(), $templatePaths); return $this->getClientOutput($client); }
/** * @test */ public function listAction() { $name = '\\Aimeos\\Client\\Html\\Catalog\\Lists\\Standard'; $client = $this->getMock($name, array('getBody', 'getHeader', 'process'), array(), '', false); $client->expects($this->once())->method('getBody')->will($this->returnValue('body')); $client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); \Aimeos\Client\Html\Catalog\Lists\Factory::injectClient($name, $client); $output = $this->object->listAction(); \Aimeos\Client\Html\Catalog\Lists\Factory::injectClient($name, null); $this->assertEquals('body', $output); }
public function testListBody() { $start = microtime(true); $client = \Aimeos\Client\Html\Catalog\Lists\Factory::createClient($this->context, $this->paths); $client->setView($this->view); $client->getBody(); $stop = microtime(true); echo "\n catalog list body: " . ($stop - $start) * 1000 . " msec\n"; }
public function testCreateClientNameNotFound() { $this->setExpectedException('\\Aimeos\\Client\\Html\\Exception'); \Aimeos\Client\Html\Catalog\Lists\Factory::createClient($this->context, $this->templatePaths, 'notfound'); }