/** * Tests the keepalive method. * * @return void * * @since 3.1 */ public function testKeepalive() { // We generate a random template name so that we don't collide or hit anything// $template = 'mytemplate' . rand(1, 10000); // We create a stub (not a mock because we don't enforce whether it is called or not) to return a value from getTemplate JFactory::$application->expects($this->any())->method('getTemplate')->willReturn($template); JHtmlBehaviorInspector::keepalive(); $this->assertEquals(array('JHtmlBehavior::keepalive' => true), JHtmlBehaviorInspector::getLoaded()); }
/** * Tests the keepalive method. * * @return void * * @since 3.1 */ public function testKeepalive() { // We generate a random template name so that we don't collide or hit anything// $template = 'mytemplate' . rand(1, 10000); // We create a stub (not a mock because we don't enforce whether it is called or not) // to return a value from getTemplate $mock = $this->getMock('myMockObject', array('getTemplate')); $mock->expects($this->any())->method('getTemplate')->will($this->returnValue($template)); // @todo We need to mock this. $mock->input = new JInput(); JFactory::$application = $mock; JHtmlBehaviorInspector::keepalive(); $this->assertEquals(array('JHtmlBehavior::keepalive' => true, 'JHtmlBehavior::framework' => array('core' => true)), JHtmlBehaviorInspector::getLoaded()); }