Example #1
0
 /**
  * Test if doctype is HTML
  */
 public function testGravatarHtmlDoctype()
 {
     $object = new Gravatar();
     $view = new View();
     $view->doctype()->setDoctype(strtoupper("HTML5"));
     $object->setView($view);
     $this->assertRegExp('/[^\\/]>$/', $this->helper->__invoke('*****@*****.**')->__toString());
 }
Example #2
0
 public function setUp()
 {
     $view = new View();
     $base = str_replace('/', DIRECTORY_SEPARATOR, '/../_templates');
     $view->resolver()->addPath(__DIR__ . $base);
     $view->vars()->setStrictVars(true);
     $this->view = $view;
 }
Example #3
0
 public function testCsrfHtmlDoctype()
 {
     $object = new FormCsrf();
     $view = new View();
     $view->doctype()->setDoctype(strtoupper("HTML5"));
     $object->setView($view);
     $this->assertRegExp('/[^\\/]>$/', $object->__invoke());
 }
Example #4
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $view = new View();
     $view->resolver()->addPath(__DIR__ . '/_files/scripts');
     Helper\PaginationControl::setDefaultViewPartial(null);
     $this->_viewHelper = new Helper\PaginationControl();
     $this->_viewHelper->setView($view);
     $this->_paginator = Paginator\Paginator::factory(range(1, 101));
 }
Example #5
0
 /**
  * @group ZF-5174
  */
 public function testPartialLoopPartialCounterResets()
 {
     $data = array(array('message' => 'foo'), array('message' => 'bar'), array('message' => 'baz'), array('message' => 'bat'));
     $view = new View();
     $view->resolver()->addPath($this->basePath . '/application/views/scripts');
     $this->helper->setView($view);
     $result = $this->helper->__invoke('partialLoopCouter.phtml', $data);
     foreach ($data as $key => $item) {
         $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1);
         $this->assertContains($string, $result);
     }
     $result = $this->helper->__invoke('partialLoopCouter.phtml', $data);
     foreach ($data as $key => $item) {
         $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1);
         $this->assertContains($string, $result);
     }
 }
Example #6
0
 public function getView()
 {
     $view = new View();
     $view->resolver()->addPath(__DIR__ . '/../TestAsset/views/');
     return $view;
 }
Example #7
0
 public function testRendersWithPartial()
 {
     $view = new View\PhpRenderer();
     $view->resolver()->addPath(__DIR__ . '/_files/scripts');
     Helper\PaginationControl::setDefaultViewPartial('partial.phtml');
     $this->_paginator->setView($view);
     $string = $this->_paginator->__toString();
     $this->assertEquals('partial rendered successfully', $string);
 }
Example #8
0
 /**
  * @issue ZF-7722
  */
 public function testCharset()
 {
     $view = new View();
     $view->broker('doctype')->direct('HTML5');
     $view->broker('headMeta')->setCharset('utf-8');
     $this->assertEquals('<meta charset="utf-8">', $view->broker('headMeta')->toString());
     $view->broker('doctype')->direct('XHTML5');
     $this->assertEquals('<meta charset="utf-8"/>', $view->broker('headMeta')->toString());
 }
Example #9
0
 /**
  * Prepares the environment before running a test
  *
  */
 protected function setUp()
 {
     $cwd = __DIR__;
     // read navigation config
     $this->_files = $cwd . '/_files';
     $config = new XmlConfig($this->_files . '/navigation.xml');
     // setup containers from config
     $this->_nav1 = new Navigation($config->get('nav_test1'));
     $this->_nav2 = new Navigation($config->get('nav_test2'));
     // setup view
     $view = new PhpRenderer();
     $view->resolver()->addPath($cwd . '/_files/mvc/views');
     // create helper
     $this->_helper = new $this->_helperName();
     $this->_helper->setView($view);
     // set nav1 in helper as default
     $this->_helper->setContainer($this->_nav1);
 }
Example #10
0
 public function testObjectModelSetInObjectKeyWhenKeyPresent()
 {
     $this->helper->setObjectKey('foo');
     $model = new \stdClass();
     $model->footest = 'bar';
     $model->bartest = 'baz';
     $view = new View();
     $view->resolver()->addPath($this->basePath . '/application/views/scripts');
     $this->helper->setView($view);
     $return = $this->helper->direct('partialObj.phtml', $model);
     $this->assertNotContains('No object model passed', $return);
     foreach (get_object_vars($model) as $key => $value) {
         $string = sprintf('%s: %s', $key, $value);
         $this->assertContains($string, $return, "Checking for '{$return}' containing '{$string}'");
     }
 }
Example #11
0
 /**
  * @group ZF-11483
  */
 public function testImageTagRenderedProperlyBasedUponDoctype()
 {
     $this->testCaptchaIsRendered();
     $view = new View();
     $view->plugin('doctype')->setDoctype('XHTML1_STRICT');
     $this->assertRegExp('#/>$#', $this->captcha->render($view));
     $view->plugin('doctype')->setDoctype('HTML4_STRICT');
     $this->assertRegExp('#[^/]>$#', $this->captcha->render($view));
 }