/** * Test case */ public function testViewCache() { $view = new Enlight_View_Default($this->engine); $view->loadTemplate('string:hello {uniqid()}'); $view->setCaching(true); $this->assertFalse($view->isCached()); $result = $view->render(); $view->loadTemplate('string:hello {uniqid()}'); $view->setCaching(true); $this->assertTrue($view->isCached()); $this->assertEquals($result, $view->render()); }
public function testGetCacheId() { $this->view->loadTemplate('string:{block name="testBlock"}Content{$test}{/block}'); $this->view->setCacheId("123"); $this->view->addCacheId("456"); $this->assertArrayCount(2, explode('|', $this->view->getCacheId())); }
/** * Test case method * * @ticket 5268 */ public function testPostDispatch() { $request = $this->Request()->setModuleName('frontend')->setDispatched(true); $response = $this->Response(); $this->Plugin()->Config()->setAllowModifications()->set('tracking_code', 'TEST1234')->set('anonymize_ip', true); $view = new Enlight_View_Default(Shopware()->Template()); $view->loadTemplate('frontend/index/index.tpl'); $action = $this->getMock('Enlight_Controller_Action', null, array($request, $response)); $action->setView($view); $eventArgs = $this->createEventArgs()->setSubject($action); $e = null; try { $this->Plugin()->onPostDispatch($eventArgs); } catch (Exception $e) { } $this->assertNull($e); $this->assertEquals('TEST1234', $view->GoogleTrackingID); $this->assertTrue($view->GoogleAnonymizeIp); $this->assertContains('frontend/plugins/google/index.tpl', $view->Template()->getTemplateResource()); }
/** * Test case */ public function testViewFetch() { $view = new Enlight_View_Default($this->engine); $view->loadTemplate('string: '); $view->assign('test', 'success'); $this->assertEquals('success', $view->fetch('string:{$test}')); }