Skip to content

Commit

Permalink
Adding test for lazy loading helpers using the collection
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 28, 2012
1 parent c700fed commit f009e96
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions lib/Cake/Test/Case/View/HelperCollectionTest.php
Expand Up @@ -67,6 +67,25 @@ public function testLoad() {
$this->assertTrue($this->Helpers->enabled('Html'));
}

/**
* test lazy loading of helpers
*
* @return void
*/
public function testLazyLoad() {
$result = $this->Helpers->Html;
$this->assertInstanceOf('HtmlHelper', $result);

$result = $this->Helpers->Form;
$this->assertInstanceOf('FormHelper', $result);

App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)));
$this->View->plugin = 'TestPlugin';
CakePlugin::load(array('TestPlugin'));
$result = $this->Helpers->OtherHelper;
$this->assertInstanceOf('OtherHelperHelper', $result);
}

/**
* Tests loading as an alias
*
Expand Down Expand Up @@ -149,8 +168,8 @@ public function testUnload() {
$this->assertEquals(array('Form', 'Html'), $result, 'loaded helpers is wrong');

$this->Helpers->unload('Html');
$this->assertFalse(isset($this->Helpers->Html));
$this->assertTrue(isset($this->Helpers->Form));
$this->assertNotContains('Html', $this->Helpers->attached());
$this->assertContains('Form', $this->Helpers->attached());

$result = $this->Helpers->attached();
$this->assertEquals(array('Form'), $result, 'loaded helpers is wrong');
Expand Down

0 comments on commit f009e96

Please sign in to comment.