view = $this->getView();
$this->helper = new Zend_Dojo_View_Helper_BorderContainer();
$this->helper->setView($this->view);
}
/**
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
*
* @return void
*/
public function tearDown()
{
}
public function getView()
{
require_once 'Zend/View.php';
$view = new Zend_View();
$view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
return $view;
}
public function getContainer()
{
$html = '';
foreach (array('top', 'bottom', 'center', 'left', 'right') as $pane) {
$id = $pane . 'Pane';
$content = 'This is the content of pane ' . $pane;
$html .= $this->view->contentPane($id, $content, array('region' => $pane));
}
return $this->helper->borderContainer('container', $html, array('design' => 'headline'));
}
public function testShouldAllowDeclarativeDijitCreation()
{
$html = $this->getContainer();
$this->assertRegexp('/
]*(dojoType="dijit.layout.BorderContainer")/', $html, $html);
}
public function testShouldAllowProgrammaticDijitCreation()
{
Zend_Dojo_View_Helper_Dojo::setUseProgrammatic();
$html = $this->getContainer();
$this->assertNotRegexp('/
]*(dojoType="dijit.layout.BorderContainer")/', $html);
$this->assertNotNull($this->view->dojo()->getDijit('container'));
}
/**
* @group ZF-4664
*/
public function testMultipleCallsToBorderContainerShouldNotCreateMultipleStyleEntries()
{
$this->getContainer();
$this->getContainer();
$style = 'html, body { height: 100%; width: 100%; margin: 0; padding: 0; }';
$styles = $this->helper->view->headStyle()->toString();
$this->assertEquals(1, substr_count($styles, $style), $styles);
}
}
// Call Zend_Dojo_View_Helper_BorderContainerTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == "Zend_Dojo_View_Helper_BorderContainerTest::main") {
Zend_Dojo_View_Helper_BorderContainerTest::main();
}