Ejemplo n.º 1
0
 public function test_javascript_for_current_controller()
 {
     $controller = new MockAkActionController($this);
     $controller->asset_host = AK_ASSET_HOST;
     $controller->setReturnValue('urlFor', '/url/for/test');
     $asset_tag_helper = new AssetTagHelper();
     $asset_tag_helper->setController($controller);
     $controller->setReturnValue('getControllerName', 'valid_controller');
     $controller->setReturnValue('urlFor', '/url/for/test');
     $this->assertEqual($asset_tag_helper->javascript_for_current_controller(), '<script src="' . $this->testing_url_path . '/javascripts/valid_controller.js" type="text/javascript"></script>' . "\n");
     $controller = new MockAkActionController($this);
     $controller->asset_host = AK_ASSET_HOST;
     $controller->setReturnValue('urlFor', '/url/for/test');
     $asset_tag_helper = new AssetTagHelper();
     $asset_tag_helper->setController($controller);
     $controller->setReturnValue('getControllerName', 'non_valid_controller');
     $controller->setReturnValue('urlFor', '/url/for/test');
     $this->assertEqual($asset_tag_helper->javascript_for_current_controller(), '');
 }