23
23
24
24
use Cake \Console \Command \Task \DbConfigTask ;
25
25
use Cake \Core \App ;
26
+ use Cake \Core \Configure ;
26
27
use Cake \Core \Plugin ;
27
28
use Cake \TestSuite \TestCase ;
28
29
use Cake \Utility \Folder ;
@@ -52,13 +53,7 @@ public function setUp() {
52
53
$ this ->Task ->bootstrap = TMP . 'tests/bootstrap.php ' ;
53
54
touch ($ this ->Task ->bootstrap );
54
55
55
- $ this ->_paths = $ paths = App::path ('Plugin ' );
56
- foreach ($ paths as $ i => $ p ) {
57
- if (!is_dir ($ p )) {
58
- array_splice ($ paths , $ i , 1 );
59
- }
60
- }
61
- $ this ->_testPath = array_push ($ paths , TMP . 'tests/ ' );
56
+ $ this ->_path = Configure::read ('App.pluginPath ' );
62
57
}
63
58
64
59
/**
@@ -79,24 +74,22 @@ public function tearDown() {
79
74
* @return void
80
75
*/
81
76
public function testBakeFoldersAndFiles () {
82
- $ this ->markTestIncomplete ('This halts the execution for some reason ' );
83
- $ this ->Task ->expects ($ this ->at (0 ))->method ('in ' )->will ($ this ->returnValue ($ this ->_testPath ));
84
- $ this ->Task ->expects ($ this ->at (1 ))->method ('in ' )->will ($ this ->returnValue ('y ' ));
77
+ $ this ->Task ->expects ($ this ->at (0 ))->method ('in ' )->will ($ this ->returnValue ('y ' ));
85
78
86
79
$ path = $ this ->Task ->path . 'BakeTestPlugin ' ;
87
80
88
81
$ file = $ path . DS . 'Controller/BakeTestPluginAppController.php ' ;
89
- $ this ->Task ->expects ($ this ->at (2 ))->method ('createFile ' )
82
+ $ this ->Task ->expects ($ this ->at (1 ))->method ('createFile ' )
90
83
->with ($ file , new \PHPUnit_Framework_Constraint_IsAnything ());
91
84
92
85
$ file = $ path . DS . 'Model/BakeTestPluginAppModel.php ' ;
93
- $ this ->Task ->expects ($ this ->at (3 ))->method ('createFile ' )
86
+ $ this ->Task ->expects ($ this ->at (2 ))->method ('createFile ' )
94
87
->with ($ file , new \PHPUnit_Framework_Constraint_IsAnything ());
95
88
96
89
$ this ->Task ->bake ('BakeTestPlugin ' );
97
90
98
91
$ path = $ this ->Task ->path . 'BakeTestPlugin ' ;
99
- $ this ->assertTrue (is_dir ($ path ), 'No plugin dir %s ' );
92
+ $ this ->assertTrue (is_dir ($ path ), 'No plugin dir ' );
100
93
101
94
$ directories = array (
102
95
'Config/Schema ' ,
@@ -127,20 +120,17 @@ public function testBakeFoldersAndFiles() {
127
120
* @return void
128
121
*/
129
122
public function testExecuteWithNoArgs () {
130
- $ this ->markTestIncomplete ('This halts the execution for some reason ' );
131
-
132
123
$ this ->Task ->expects ($ this ->at (0 ))->method ('in ' )->will ($ this ->returnValue ('TestPlugin ' ));
133
- $ this ->Task ->expects ($ this ->at (1 ))->method ('in ' )->will ($ this ->returnValue ($ this ->_testPath ));
134
- $ this ->Task ->expects ($ this ->at (2 ))->method ('in ' )->will ($ this ->returnValue ('y ' ));
124
+ $ this ->Task ->expects ($ this ->at (1 ))->method ('in ' )->will ($ this ->returnValue ('y ' ));
135
125
136
126
$ path = $ this ->Task ->path . 'TestPlugin ' ;
137
127
$ file = $ path . DS . 'Controller/TestPluginAppController.php ' ;
138
128
139
- $ this ->Task ->expects ($ this ->at (3 ))->method ('createFile ' )
129
+ $ this ->Task ->expects ($ this ->at (2 ))->method ('createFile ' )
140
130
->with ($ file , new \PHPUnit_Framework_Constraint_IsAnything ());
141
131
142
132
$ file = $ path . DS . 'Model/TestPluginAppModel.php ' ;
143
- $ this ->Task ->expects ($ this ->at (4 ))->method ('createFile ' )
133
+ $ this ->Task ->expects ($ this ->at (3 ))->method ('createFile ' )
144
134
->with ($ file , new \PHPUnit_Framework_Constraint_IsAnything ());
145
135
146
136
$ this ->Task ->args = array ();
@@ -156,21 +146,17 @@ public function testExecuteWithNoArgs() {
156
146
* @return void
157
147
*/
158
148
public function testExecuteWithOneArg () {
159
- $ this ->markTestIncomplete ('This halts the execution for some reason ' );
160
-
161
149
$ this ->Task ->expects ($ this ->at (0 ))->method ('in ' )
162
- ->will ($ this ->returnValue ($ this ->_testPath ));
163
- $ this ->Task ->expects ($ this ->at (1 ))->method ('in ' )
164
150
->will ($ this ->returnValue ('y ' ));
165
151
166
152
$ path = $ this ->Task ->path . 'BakeTestPlugin ' ;
167
153
$ file = $ path . DS . 'Controller/BakeTestPluginAppController.php ' ;
168
- $ this ->Task ->expects ($ this ->at (2 ))->method ('createFile ' )
154
+ $ this ->Task ->expects ($ this ->at (1 ))->method ('createFile ' )
169
155
->with ($ file , new \PHPUnit_Framework_Constraint_IsAnything ());
170
156
171
157
$ path = $ this ->Task ->path . 'BakeTestPlugin ' ;
172
158
$ file = $ path . DS . 'Model/BakeTestPluginAppModel.php ' ;
173
- $ this ->Task ->expects ($ this ->at (3 ))->method ('createFile ' )
159
+ $ this ->Task ->expects ($ this ->at (2 ))->method ('createFile ' )
174
160
->with ($ file , new \PHPUnit_Framework_Constraint_IsAnything ());
175
161
176
162
$ this ->Task ->args = array ('BakeTestPlugin ' );
0 commit comments