@@ -67,6 +67,25 @@ public function testLoad() {
67
67
$ this ->assertTrue ($ this ->Helpers ->enabled ('Html ' ));
68
68
}
69
69
70
+ /**
71
+ * test lazy loading of helpers
72
+ *
73
+ * @return void
74
+ */
75
+ public function testLazyLoad () {
76
+ $ result = $ this ->Helpers ->Html ;
77
+ $ this ->assertInstanceOf ('HtmlHelper ' , $ result );
78
+
79
+ $ result = $ this ->Helpers ->Form ;
80
+ $ this ->assertInstanceOf ('FormHelper ' , $ result );
81
+
82
+ App::build (array ('Plugin ' => array (CAKE . 'Test ' . DS . 'test_app ' . DS . 'Plugin ' . DS )));
83
+ $ this ->View ->plugin = 'TestPlugin ' ;
84
+ CakePlugin::load (array ('TestPlugin ' ));
85
+ $ result = $ this ->Helpers ->OtherHelper ;
86
+ $ this ->assertInstanceOf ('OtherHelperHelper ' , $ result );
87
+ }
88
+
70
89
/**
71
90
* Tests loading as an alias
72
91
*
@@ -149,8 +168,8 @@ public function testUnload() {
149
168
$ this ->assertEquals (array ('Form ' , 'Html ' ), $ result , 'loaded helpers is wrong ' );
150
169
151
170
$ this ->Helpers ->unload ('Html ' );
152
- $ this ->assertFalse ( isset ( $ this ->Helpers ->Html ));
153
- $ this ->assertTrue ( isset ( $ this ->Helpers ->Form ));
171
+ $ this ->assertNotContains ( ' Html ' , $ this ->Helpers ->attached ( ));
172
+ $ this ->assertContains ( ' Form ' , $ this ->Helpers ->attached ( ));
154
173
155
174
$ result = $ this ->Helpers ->attached ();
156
175
$ this ->assertEquals (array ('Form ' ), $ result , 'loaded helpers is wrong ' );
0 commit comments