mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Adding test for lazy loading helpers using the collection
This commit is contained in:
parent
c700fedbf8
commit
f009e96a69
1 changed files with 21 additions and 2 deletions
|
@ -67,6 +67,25 @@ class HelperCollectionTest extends CakeTestCase {
|
|||
$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
|
||||
*
|
||||
|
@ -149,8 +168,8 @@ class HelperCollectionTest extends CakeTestCase {
|
|||
$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');
|
||||
|
|
Loading…
Add table
Reference in a new issue