Mercurial > hg > Members > shoshi > webvirt
comparison cake/tests/cases/console/libs/tasks/view.test.php @ 0:261e66bd5a0c
hg init
author | Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 24 Jul 2011 21:08:31 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:261e66bd5a0c |
---|---|
1 <?php | |
2 /** | |
3 * ViewTask Test file | |
4 * | |
5 * Test Case for view generation shell task | |
6 * | |
7 * PHP versions 4 and 5 | |
8 * | |
9 * CakePHP : Rapid Development Framework (http://cakephp.org) | |
10 * Copyright 2006-2010, Cake Software Foundation, Inc. | |
11 * | |
12 * Licensed under The MIT License | |
13 * Redistributions of files must retain the above copyright notice. | |
14 * | |
15 * @copyright Copyright 2006-2010, Cake Software Foundation, Inc. | |
16 * @link http://cakephp.org CakePHP Project | |
17 * @package cake | |
18 * @subpackage cake.tests.cases.console.libs.tasks | |
19 * @since CakePHP v 1.2.0.7726 | |
20 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) | |
21 */ | |
22 App::import('Shell', 'Shell', false); | |
23 | |
24 if (!defined('DISABLE_AUTO_DISPATCH')) { | |
25 define('DISABLE_AUTO_DISPATCH', true); | |
26 } | |
27 | |
28 if (!class_exists('ShellDispatcher')) { | |
29 ob_start(); | |
30 $argv = false; | |
31 require CAKE . 'console' . DS . 'cake.php'; | |
32 ob_end_clean(); | |
33 } | |
34 | |
35 require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'view.php'; | |
36 require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'controller.php'; | |
37 require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php'; | |
38 require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'project.php'; | |
39 | |
40 Mock::generatePartial( | |
41 'ShellDispatcher', 'TestViewTaskMockShellDispatcher', | |
42 array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment') | |
43 ); | |
44 Mock::generatePartial( | |
45 'ViewTask', 'MockViewTask', | |
46 array('in', '_stop', 'err', 'out', 'createFile') | |
47 ); | |
48 | |
49 Mock::generate('ControllerTask', 'ViewTaskMockControllerTask'); | |
50 Mock::generate('ProjectTask', 'ViewTaskMockProjectTask'); | |
51 | |
52 /** | |
53 * Test View Task Comment Model | |
54 * | |
55 * @package cake | |
56 * @subpackage cake.tests.cases.console.libs.tasks | |
57 */ | |
58 class ViewTaskComment extends Model { | |
59 | |
60 /** | |
61 * Model name | |
62 * | |
63 * @var string | |
64 * @access public | |
65 */ | |
66 var $name = 'ViewTaskComment'; | |
67 | |
68 /** | |
69 * Table name | |
70 * | |
71 * @var string | |
72 * @access public | |
73 */ | |
74 var $useTable = 'comments'; | |
75 | |
76 /** | |
77 * Belongs To Associations | |
78 * | |
79 * @var array | |
80 * @access public | |
81 */ | |
82 var $belongsTo = array( | |
83 'Article' => array( | |
84 'className' => 'ViewTaskArticle', | |
85 'foreignKey' => 'article_id' | |
86 ) | |
87 ); | |
88 } | |
89 | |
90 /** | |
91 * Test View Task Article Model | |
92 * | |
93 * @package cake | |
94 * @subpackage cake.tests.cases.console.libs.tasks | |
95 */ | |
96 class ViewTaskArticle extends Model { | |
97 | |
98 /** | |
99 * Model name | |
100 * | |
101 * @var string | |
102 * @access public | |
103 */ | |
104 var $name = 'ViewTaskArticle'; | |
105 | |
106 /** | |
107 * Table name | |
108 * | |
109 * @var string | |
110 * @access public | |
111 */ | |
112 var $useTable = 'articles'; | |
113 } | |
114 | |
115 /** | |
116 * Test View Task Comments Controller | |
117 * | |
118 * @package cake | |
119 * @subpackage cake.tests.cases.console.libs.tasks | |
120 */ | |
121 class ViewTaskCommentsController extends Controller { | |
122 | |
123 /** | |
124 * Controller name | |
125 * | |
126 * @var string | |
127 * @access public | |
128 */ | |
129 var $name = 'ViewTaskComments'; | |
130 | |
131 /** | |
132 * Testing public controller action | |
133 * | |
134 * @return void | |
135 * @access public | |
136 */ | |
137 function index() { | |
138 } | |
139 | |
140 /** | |
141 * Testing public controller action | |
142 * | |
143 * @return void | |
144 * @access public | |
145 */ | |
146 function add() { | |
147 } | |
148 } | |
149 | |
150 /** | |
151 * Test View Task Articles Controller | |
152 * | |
153 * @package cake | |
154 * @subpackage cake.tests.cases.console.libs.tasks | |
155 */ | |
156 class ViewTaskArticlesController extends Controller { | |
157 | |
158 /** | |
159 * Controller name | |
160 * | |
161 * @var string | |
162 * @access public | |
163 */ | |
164 var $name = 'ViewTaskArticles'; | |
165 | |
166 /** | |
167 * Test public controller action | |
168 * | |
169 * @return void | |
170 * @access public | |
171 */ | |
172 function index() { | |
173 } | |
174 | |
175 /** | |
176 * Test public controller action | |
177 * | |
178 * @return void | |
179 * @access public | |
180 */ | |
181 function add() { | |
182 } | |
183 | |
184 /** | |
185 * Test admin prefixed controller action | |
186 * | |
187 * @return void | |
188 * @access public | |
189 */ | |
190 function admin_index() { | |
191 } | |
192 | |
193 /** | |
194 * Test admin prefixed controller action | |
195 * | |
196 * @return void | |
197 * @access public | |
198 */ | |
199 function admin_add() { | |
200 } | |
201 | |
202 /** | |
203 * Test admin prefixed controller action | |
204 * | |
205 * @return void | |
206 * @access public | |
207 */ | |
208 function admin_view() { | |
209 } | |
210 | |
211 /** | |
212 * Test admin prefixed controller action | |
213 * | |
214 * @return void | |
215 * @access public | |
216 */ | |
217 function admin_edit() { | |
218 } | |
219 | |
220 /** | |
221 * Test admin prefixed controller action | |
222 * | |
223 * @return void | |
224 * @access public | |
225 */ | |
226 function admin_delete() { | |
227 } | |
228 } | |
229 | |
230 /** | |
231 * ViewTaskTest class | |
232 * | |
233 * @package cake | |
234 * @subpackage cake.tests.cases.console.libs.tasks | |
235 */ | |
236 class ViewTaskTest extends CakeTestCase { | |
237 | |
238 /** | |
239 * Fixtures | |
240 * | |
241 * @var array | |
242 * @access public | |
243 */ | |
244 var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag'); | |
245 | |
246 /** | |
247 * startTest method | |
248 * | |
249 * Ensure that the default theme is used | |
250 * | |
251 * @return void | |
252 * @access public | |
253 */ | |
254 function startTest() { | |
255 $this->Dispatcher =& new TestViewTaskMockShellDispatcher(); | |
256 $this->Dispatcher->shellPaths = App::path('shells'); | |
257 $this->Task =& new MockViewTask($this->Dispatcher); | |
258 $this->Task->name = 'ViewTask'; | |
259 $this->Task->Dispatch =& $this->Dispatcher; | |
260 $this->Task->Template =& new TemplateTask($this->Dispatcher); | |
261 $this->Task->Controller =& new ViewTaskMockControllerTask(); | |
262 $this->Task->Project =& new ViewTaskMockProjectTask(); | |
263 $this->Task->path = TMP; | |
264 $this->Task->Template->params['theme'] = 'default'; | |
265 | |
266 $this->_routing = Configure::read('Routing'); | |
267 } | |
268 | |
269 /** | |
270 * endTest method | |
271 * | |
272 * @return void | |
273 * @access public | |
274 */ | |
275 function endTest() { | |
276 ClassRegistry::flush(); | |
277 Configure::write('Routing', $this->_routing); | |
278 } | |
279 | |
280 /** | |
281 * Test getContent and parsing of Templates. | |
282 * | |
283 * @return void | |
284 * @access public | |
285 */ | |
286 function testGetContent() { | |
287 $vars = array( | |
288 'modelClass' => 'TestViewModel', | |
289 'schema' => array(), | |
290 'primaryKey' => 'id', | |
291 'displayField' => 'name', | |
292 'singularVar' => 'testViewModel', | |
293 'pluralVar' => 'testViewModels', | |
294 'singularHumanName' => 'Test View Model', | |
295 'pluralHumanName' => 'Test View Models', | |
296 'fields' => array('id', 'name', 'body'), | |
297 'associations' => array() | |
298 ); | |
299 $result = $this->Task->getContent('view', $vars); | |
300 | |
301 $this->assertPattern('/Delete Test View Model/', $result); | |
302 $this->assertPattern('/Edit Test View Model/', $result); | |
303 $this->assertPattern('/List Test View Models/', $result); | |
304 $this->assertPattern('/New Test View Model/', $result); | |
305 | |
306 $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result); | |
307 $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result); | |
308 $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result); | |
309 } | |
310 | |
311 /** | |
312 * test getContent() using an admin_prefixed action. | |
313 * | |
314 * @return void | |
315 * @access public | |
316 */ | |
317 function testGetContentWithAdminAction() { | |
318 $_back = Configure::read('Routing'); | |
319 Configure::write('Routing.prefixes', array('admin')); | |
320 $vars = array( | |
321 'modelClass' => 'TestViewModel', | |
322 'schema' => array(), | |
323 'primaryKey' => 'id', | |
324 'displayField' => 'name', | |
325 'singularVar' => 'testViewModel', | |
326 'pluralVar' => 'testViewModels', | |
327 'singularHumanName' => 'Test View Model', | |
328 'pluralHumanName' => 'Test View Models', | |
329 'fields' => array('id', 'name', 'body'), | |
330 'associations' => array() | |
331 ); | |
332 $result = $this->Task->getContent('admin_view', $vars); | |
333 | |
334 $this->assertPattern('/Delete Test View Model/', $result); | |
335 $this->assertPattern('/Edit Test View Model/', $result); | |
336 $this->assertPattern('/List Test View Models/', $result); | |
337 $this->assertPattern('/New Test View Model/', $result); | |
338 | |
339 $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result); | |
340 $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result); | |
341 $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result); | |
342 | |
343 $result = $this->Task->getContent('admin_add', $vars); | |
344 $this->assertPattern("/input\('name'\)/", $result); | |
345 $this->assertPattern("/input\('body'\)/", $result); | |
346 $this->assertPattern('/List Test View Models/', $result); | |
347 | |
348 Configure::write('Routing', $_back); | |
349 } | |
350 | |
351 /** | |
352 * test Bake method | |
353 * | |
354 * @return void | |
355 * @access public | |
356 */ | |
357 function testBake() { | |
358 $this->Task->controllerName = 'ViewTaskComments'; | |
359 $this->Task->controllerPath = 'view_task_comments'; | |
360 | |
361 $this->Task->expectAt(0, 'createFile', array( | |
362 TMP . 'view_task_comments' . DS . 'view.ctp', | |
363 new PatternExpectation('/View Task Articles/') | |
364 )); | |
365 $this->Task->bake('view', true); | |
366 | |
367 $this->Task->expectAt(1, 'createFile', array(TMP . 'view_task_comments' . DS . 'edit.ctp', '*')); | |
368 $this->Task->bake('edit', true); | |
369 | |
370 $this->Task->expectAt(2, 'createFile', array( | |
371 TMP . 'view_task_comments' . DS . 'index.ctp', | |
372 new PatternExpectation('/\$viewTaskComment\[\'Article\'\]\[\'title\'\]/') | |
373 )); | |
374 $this->Task->bake('index', true); | |
375 } | |
376 | |
377 /** | |
378 * test that baking a view with no template doesn't make a file. | |
379 * | |
380 * @return void | |
381 */ | |
382 function testBakeWithNoTemplate() { | |
383 $this->Task->controllerName = 'ViewTaskComments'; | |
384 $this->Task->controllerPath = 'view_task_comments'; | |
385 | |
386 $this->Task->expectNever('createFile'); | |
387 $this->Task->bake('delete', true); | |
388 } | |
389 | |
390 /** | |
391 * test bake() with a -plugin param | |
392 * | |
393 * @return void | |
394 * @access public | |
395 */ | |
396 function testBakeWithPlugin() { | |
397 $this->Task->controllerName = 'ViewTaskComments'; | |
398 $this->Task->controllerPath = 'view_task_comments'; | |
399 $this->Task->plugin = 'TestTest'; | |
400 | |
401 $path = APP . 'plugins' . DS . 'test_test' . DS . 'views' . DS . 'view_task_comments' . DS . 'view.ctp'; | |
402 $this->Task->expectAt(0, 'createFile', array($path, '*')); | |
403 $this->Task->bake('view', true); | |
404 } | |
405 | |
406 /** | |
407 * test bake actions baking multiple actions. | |
408 * | |
409 * @return void | |
410 * @access public | |
411 */ | |
412 function testBakeActions() { | |
413 $this->Task->controllerName = 'ViewTaskComments'; | |
414 $this->Task->controllerPath = 'view_task_comments'; | |
415 | |
416 $this->Task->expectAt(0, 'createFile', array( | |
417 TMP . 'view_task_comments' . DS . 'view.ctp', | |
418 new PatternExpectation('/View Task Comments/') | |
419 )); | |
420 $this->Task->expectAt(1, 'createFile', array( | |
421 TMP . 'view_task_comments' . DS . 'edit.ctp', | |
422 new PatternExpectation('/Edit View Task Comment/') | |
423 )); | |
424 $this->Task->expectAt(2, 'createFile', array( | |
425 TMP . 'view_task_comments' . DS . 'index.ctp', | |
426 new PatternExpectation('/ViewTaskComment/') | |
427 )); | |
428 | |
429 $this->Task->bakeActions(array('view', 'edit', 'index'), array()); | |
430 } | |
431 | |
432 /** | |
433 * test baking a customAction (non crud) | |
434 * | |
435 * @return void | |
436 * @access public | |
437 */ | |
438 function testCustomAction() { | |
439 $this->Task->controllerName = 'ViewTaskComments'; | |
440 $this->Task->controllerPath = 'view_task_comments'; | |
441 $this->Task->params['app'] = APP; | |
442 | |
443 $this->Task->setReturnValueAt(0, 'in', ''); | |
444 $this->Task->setReturnValueAt(1, 'in', 'my_action'); | |
445 $this->Task->setReturnValueAt(2, 'in', 'y'); | |
446 $this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_comments' . DS . 'my_action.ctp', '*')); | |
447 | |
448 $this->Task->customAction(); | |
449 } | |
450 | |
451 /** | |
452 * Test all() | |
453 * | |
454 * @return void | |
455 * @access public | |
456 */ | |
457 function testExecuteIntoAll() { | |
458 $this->Task->args[0] = 'all'; | |
459 | |
460 $this->Task->Controller->setReturnValue('listAll', array('view_task_comments')); | |
461 $this->Task->Controller->expectOnce('listAll'); | |
462 | |
463 $this->Task->expectCallCount('createFile', 2); | |
464 $this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_comments' . DS . 'index.ctp', '*')); | |
465 $this->Task->expectAt(1, 'createFile', array(TMP . 'view_task_comments' . DS . 'add.ctp', '*')); | |
466 | |
467 $this->Task->execute(); | |
468 } | |
469 | |
470 /** | |
471 * Test all() with action parameter | |
472 * | |
473 * @return void | |
474 * @access public | |
475 */ | |
476 function testExecuteIntoAllWithActionName() { | |
477 $this->Task->args = array('all', 'index'); | |
478 | |
479 $this->Task->Controller->setReturnValue('listAll', array('view_task_comments')); | |
480 $this->Task->Controller->expectOnce('listAll'); | |
481 | |
482 $this->Task->expectCallCount('createFile', 1); | |
483 $this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_comments' . DS . 'index.ctp', '*')); | |
484 | |
485 $this->Task->execute(); | |
486 } | |
487 | |
488 /** | |
489 * test `cake bake view $controller view` | |
490 * | |
491 * @return void | |
492 * @access public | |
493 */ | |
494 function testExecuteWithActionParam() { | |
495 $this->Task->args[0] = 'ViewTaskComments'; | |
496 $this->Task->args[1] = 'view'; | |
497 | |
498 $this->Task->expectCallCount('createFile', 1); | |
499 $this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_comments' . DS . 'view.ctp', '*')); | |
500 $this->Task->execute(); | |
501 } | |
502 | |
503 /** | |
504 * test `cake bake view $controller` | |
505 * Ensure that views are only baked for actions that exist in the controller. | |
506 * | |
507 * @return void | |
508 * @access public | |
509 */ | |
510 function testExecuteWithController() { | |
511 $this->Task->args[0] = 'ViewTaskComments'; | |
512 | |
513 $this->Task->expectCallCount('createFile', 2); | |
514 $this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_comments' . DS . 'index.ctp', '*')); | |
515 $this->Task->expectAt(1, 'createFile', array(TMP . 'view_task_comments' . DS . 'add.ctp', '*')); | |
516 | |
517 $this->Task->execute(); | |
518 } | |
519 | |
520 /** | |
521 * test that both plural and singular forms can be used for baking views. | |
522 * | |
523 * @return void | |
524 * @access public | |
525 */ | |
526 function testExecuteWithControllerVariations() { | |
527 $this->Task->args = array('ViewTaskComments'); | |
528 | |
529 $this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_comments' . DS . 'index.ctp', '*')); | |
530 $this->Task->expectAt(1, 'createFile', array(TMP . 'view_task_comments' . DS . 'add.ctp', '*')); | |
531 $this->Task->execute(); | |
532 | |
533 $this->Task->args = array('ViewTaskComment'); | |
534 | |
535 $this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_comments' . DS . 'index.ctp', '*')); | |
536 $this->Task->expectAt(1, 'createFile', array(TMP . 'view_task_comments' . DS . 'add.ctp', '*')); | |
537 $this->Task->execute(); | |
538 } | |
539 | |
540 /** | |
541 * test `cake bake view $controller -admin` | |
542 * Which only bakes admin methods, not non-admin methods. | |
543 * | |
544 * @return void | |
545 * @access public | |
546 */ | |
547 function testExecuteWithControllerAndAdminFlag() { | |
548 $_back = Configure::read('Routing'); | |
549 Configure::write('Routing.prefixes', array('admin')); | |
550 $this->Task->args[0] = 'ViewTaskArticles'; | |
551 $this->Task->params['admin'] = 1; | |
552 $this->Task->Project->setReturnValue('getPrefix', 'admin_'); | |
553 | |
554 $this->Task->expectCallCount('createFile', 4); | |
555 $this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_articles' . DS . 'admin_index.ctp', '*')); | |
556 $this->Task->expectAt(1, 'createFile', array(TMP . 'view_task_articles' . DS . 'admin_add.ctp', '*')); | |
557 $this->Task->expectAt(2, 'createFile', array(TMP . 'view_task_articles' . DS . 'admin_view.ctp', '*')); | |
558 $this->Task->expectAt(3, 'createFile', array(TMP . 'view_task_articles' . DS . 'admin_edit.ctp', '*')); | |
559 | |
560 $this->Task->execute(); | |
561 Configure::write('Routing', $_back); | |
562 } | |
563 | |
564 /** | |
565 * test execute into interactive. | |
566 * | |
567 * @return void | |
568 * @access public | |
569 */ | |
570 function testExecuteInteractive() { | |
571 $this->Task->connection = 'test_suite'; | |
572 $this->Task->args = array(); | |
573 $this->Task->params = array(); | |
574 | |
575 $this->Task->Controller->setReturnValue('getName', 'ViewTaskComments'); | |
576 $this->Task->setReturnValue('in', 'y'); | |
577 $this->Task->setReturnValueAt(0, 'in', 'y'); | |
578 $this->Task->setReturnValueAt(1, 'in', 'y'); | |
579 $this->Task->setReturnValueAt(2, 'in', 'n'); | |
580 | |
581 $this->Task->expectCallCount('createFile', 4); | |
582 $this->Task->expectAt(0, 'createFile', array( | |
583 TMP . 'view_task_comments' . DS . 'index.ctp', | |
584 new PatternExpectation('/ViewTaskComment/') | |
585 )); | |
586 $this->Task->expectAt(1, 'createFile', array( | |
587 TMP . 'view_task_comments' . DS . 'view.ctp', | |
588 new PatternExpectation('/ViewTaskComment/') | |
589 )); | |
590 $this->Task->expectAt(2, 'createFile', array( | |
591 TMP . 'view_task_comments' . DS . 'add.ctp', | |
592 new PatternExpectation('/Add View Task Comment/') | |
593 )); | |
594 $this->Task->expectAt(3, 'createFile', array( | |
595 TMP . 'view_task_comments' . DS . 'edit.ctp', | |
596 new PatternExpectation('/Edit View Task Comment/') | |
597 )); | |
598 | |
599 $this->Task->execute(); | |
600 } | |
601 | |
602 /** | |
603 * test `cake bake view posts index list` | |
604 * | |
605 * @return void | |
606 * @access public | |
607 */ | |
608 function testExecuteWithAlternateTemplates() { | |
609 $this->Task->connection = 'test_suite'; | |
610 $this->Task->args = array('ViewTaskComments', 'index', 'list'); | |
611 $this->Task->params = array(); | |
612 | |
613 $this->Task->expectCallCount('createFile', 1); | |
614 $this->Task->expectAt(0, 'createFile', array( | |
615 TMP . 'view_task_comments' . DS . 'list.ctp', | |
616 new PatternExpectation('/ViewTaskComment/') | |
617 )); | |
618 $this->Task->execute(); | |
619 } | |
620 | |
621 /** | |
622 * test execute into interactive() with admin methods. | |
623 * | |
624 * @return void | |
625 * @access public | |
626 */ | |
627 function testExecuteInteractiveWithAdmin() { | |
628 Configure::write('Routing.prefixes', array('admin')); | |
629 $this->Task->connection = 'test_suite'; | |
630 $this->Task->args = array(); | |
631 | |
632 $this->Task->Controller->setReturnValue('getName', 'ViewTaskComments'); | |
633 $this->Task->Project->setReturnValue('getPrefix', 'admin_'); | |
634 $this->Task->setReturnValueAt(0, 'in', 'y'); | |
635 $this->Task->setReturnValueAt(1, 'in', 'n'); | |
636 $this->Task->setReturnValueAt(2, 'in', 'y'); | |
637 | |
638 $this->Task->expectCallCount('createFile', 4); | |
639 $this->Task->expectAt(0, 'createFile', array( | |
640 TMP . 'view_task_comments' . DS . 'admin_index.ctp', | |
641 new PatternExpectation('/ViewTaskComment/') | |
642 )); | |
643 $this->Task->expectAt(1, 'createFile', array( | |
644 TMP . 'view_task_comments' . DS . 'admin_view.ctp', | |
645 new PatternExpectation('/ViewTaskComment/') | |
646 )); | |
647 $this->Task->expectAt(2, 'createFile', array( | |
648 TMP . 'view_task_comments' . DS . 'admin_add.ctp', | |
649 new PatternExpectation('/Add View Task Comment/') | |
650 )); | |
651 $this->Task->expectAt(3, 'createFile', array( | |
652 TMP . 'view_task_comments' . DS . 'admin_edit.ctp', | |
653 new PatternExpectation('/Edit View Task Comment/') | |
654 )); | |
655 | |
656 $this->Task->execute(); | |
657 } | |
658 | |
659 /** | |
660 * test getting templates, make sure noTemplateActions works | |
661 * | |
662 * @return void | |
663 */ | |
664 function testGetTemplate() { | |
665 $result = $this->Task->getTemplate('delete'); | |
666 $this->assertFalse($result); | |
667 | |
668 $result = $this->Task->getTemplate('add'); | |
669 $this->assertEqual($result, 'form'); | |
670 | |
671 Configure::write('Routing.prefixes', array('admin')); | |
672 | |
673 $result = $this->Task->getTemplate('admin_add'); | |
674 $this->assertEqual($result, 'form'); | |
675 } | |
676 | |
677 } |