ViewTaskTest.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. <?php
  2. /**
  3. * CakePHP : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. * @link http://cakephp.org CakePHP Project
  12. * @since 1.2.0
  13. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Test\TestCase\Shell\Task;
  16. use Cake\Shell\Task\TemplateTask;
  17. use Cake\Shell\Task\ViewTask;
  18. use Cake\Controller\Controller;
  19. use Cake\Core\Configure;
  20. use Cake\Core\Plugin;
  21. use Cake\ORM\Table;
  22. use Cake\ORM\TableRegistry;
  23. use Cake\TestSuite\TestCase;
  24. /**
  25. * Test View Task Comment Model
  26. */
  27. class ViewTaskCommentsTable extends Table {
  28. public function initialize(array $config) {
  29. $this->table('comments');
  30. $this->belongsTo('Articles', [
  31. 'foreignKey' => 'article_id'
  32. ]);
  33. }
  34. }
  35. /**
  36. * Test View Task Article Model
  37. */
  38. class ViewTaskArticlesTable extends Table {
  39. public function intialize(array $config) {
  40. $this->table('articles');
  41. }
  42. }
  43. /**
  44. * Test View Task Comments Controller
  45. */
  46. class ViewTaskCommentsController extends Controller {
  47. public $modelClass = 'Cake\Test\TestCase\Shell\Task\ViewTaskCommentsTable';
  48. /**
  49. * Testing public controller action
  50. *
  51. * @return void
  52. */
  53. public function index() {
  54. }
  55. /**
  56. * Testing public controller action
  57. *
  58. * @return void
  59. */
  60. public function add() {
  61. }
  62. }
  63. /**
  64. * ViewTaskTest class
  65. */
  66. class ViewTaskTest extends TestCase {
  67. /**
  68. * Fixtures
  69. *
  70. * @var array
  71. */
  72. public $fixtures = array(
  73. 'core.article', 'core.post', 'core.comment',
  74. 'core.articles_tag',
  75. 'core.tag',
  76. 'core.test_plugin_comment',
  77. 'core.category_thread',
  78. );
  79. /**
  80. * setUp method
  81. *
  82. * Ensure that the default template is used
  83. *
  84. * @return void
  85. */
  86. public function setUp() {
  87. parent::setUp();
  88. Configure::write('App.namespace', 'TestApp');
  89. $this->_setupTask(['in', 'err', 'createFile', '_stop']);
  90. TableRegistry::get('ViewTaskComments', [
  91. 'className' => __NAMESPACE__ . '\ViewTaskCommentsTable',
  92. ]);
  93. }
  94. /**
  95. * Generate the mock objects used in tests.
  96. *
  97. * @return void
  98. */
  99. protected function _setupTask($methods) {
  100. $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false);
  101. $this->Task = $this->getMock('Cake\Shell\Task\ViewTask',
  102. $methods,
  103. [$io]
  104. );
  105. $this->Task->Template = new TemplateTask($io);
  106. $this->Task->Model = $this->getMock('Cake\Shell\Task\ModelTask', [], [$io]);
  107. $this->Task->Template->params['template'] = 'default';
  108. $this->Task->Template->templatePaths = ['default' => CAKE . 'Template/Bake/default/'];
  109. }
  110. /**
  111. * tearDown method
  112. *
  113. * @return void
  114. */
  115. public function tearDown() {
  116. parent::tearDown();
  117. TableRegistry::clear();
  118. unset($this->Task);
  119. }
  120. /**
  121. * Test the controller() method.
  122. *
  123. * @return void
  124. */
  125. public function testController() {
  126. $this->Task->controller('Comments');
  127. $this->assertEquals('Comments', $this->Task->controllerName);
  128. $this->assertEquals(
  129. 'TestApp\Controller\CommentsController',
  130. $this->Task->controllerClass
  131. );
  132. }
  133. /**
  134. * Test the controller() method.
  135. *
  136. * @dataProvider nameVariations
  137. * @return void
  138. */
  139. public function testControllerVariations($name) {
  140. $this->Task->controller($name);
  141. $this->assertEquals('ViewTaskComments', $this->Task->controllerName);
  142. }
  143. /**
  144. * Test controller method with plugins.
  145. *
  146. * @return void
  147. */
  148. public function testControllerPlugin() {
  149. $this->Task->params['plugin'] = 'TestPlugin';
  150. $this->Task->controller('Tests');
  151. $this->assertEquals('Tests', $this->Task->controllerName);
  152. $this->assertEquals(
  153. 'TestPlugin\Controller\TestsController',
  154. $this->Task->controllerClass
  155. );
  156. }
  157. /**
  158. * Test controller method with prefixes.
  159. *
  160. * @return void
  161. */
  162. public function testControllerPrefix() {
  163. $this->Task->params['prefix'] = 'Admin';
  164. $this->Task->controller('Posts');
  165. $this->assertEquals('Posts', $this->Task->controllerName);
  166. $this->assertEquals(
  167. 'TestApp\Controller\Admin\PostsController',
  168. $this->Task->controllerClass
  169. );
  170. $this->Task->params['plugin'] = 'TestPlugin';
  171. $this->Task->controller('Comments');
  172. $this->assertEquals('Comments', $this->Task->controllerName);
  173. $this->assertEquals(
  174. 'TestPlugin\Controller\Admin\CommentsController',
  175. $this->Task->controllerClass
  176. );
  177. }
  178. /**
  179. * test controller with a non-conventional controller name
  180. *
  181. * @return void
  182. */
  183. public function testControllerWithOverride() {
  184. $this->Task->controller('Comments', 'Posts');
  185. $this->assertEquals('Posts', $this->Task->controllerName);
  186. $this->assertEquals(
  187. 'TestApp\Controller\PostsController',
  188. $this->Task->controllerClass
  189. );
  190. }
  191. /**
  192. * Test the model() method.
  193. *
  194. * @return void
  195. */
  196. public function testModel() {
  197. $this->Task->model('Articles');
  198. $this->assertEquals('Articles', $this->Task->modelName);
  199. $this->Task->model('NotThere');
  200. $this->assertEquals('NotTheres', $this->Task->modelName);
  201. }
  202. /**
  203. * Test model() method with plugins.
  204. *
  205. * @return void
  206. */
  207. public function testModelPlugin() {
  208. $this->Task->params['plugin'] = 'TestPlugin';
  209. $this->Task->model('TestPluginComments');
  210. $this->assertEquals(
  211. 'TestPlugin.TestPluginComments',
  212. $this->Task->modelName
  213. );
  214. }
  215. /**
  216. * Test getPath()
  217. *
  218. * @return void
  219. */
  220. public function testGetPath() {
  221. $this->Task->controllerName = 'Posts';
  222. $result = $this->Task->getPath();
  223. $this->assertPathEquals(APP . 'Template/Posts/', $result);
  224. $this->Task->params['prefix'] = 'admin';
  225. $result = $this->Task->getPath();
  226. $this->assertPathEquals(APP . 'Template/Admin/Posts/', $result);
  227. }
  228. /**
  229. * Test getPath with plugins.
  230. *
  231. * @return void
  232. */
  233. public function testGetPathPlugin() {
  234. $this->Task->controllerName = 'Posts';
  235. $pluginPath = APP . 'Plugin/TestPlugin/';
  236. Plugin::load('TestPlugin', array('path' => $pluginPath));
  237. $this->Task->params['plugin'] = $this->Task->plugin = 'TestPlugin';
  238. $result = $this->Task->getPath();
  239. $this->assertPathEquals($pluginPath . 'src/Template/Posts/', $result);
  240. $this->Task->params['prefix'] = 'admin';
  241. $result = $this->Task->getPath();
  242. $this->assertPathEquals($pluginPath . 'src/Template/Admin/Posts/', $result);
  243. Plugin::unload('TestPlugin');
  244. }
  245. /**
  246. * Test getContent and parsing of Templates.
  247. *
  248. * @return void
  249. */
  250. public function testGetContent() {
  251. $vars = array(
  252. 'modelClass' => 'TestViewModel',
  253. 'schema' => [],
  254. 'primaryKey' => ['id'],
  255. 'displayField' => 'name',
  256. 'singularVar' => 'testViewModel',
  257. 'pluralVar' => 'testViewModels',
  258. 'singularHumanName' => 'Test View Model',
  259. 'pluralHumanName' => 'Test View Models',
  260. 'fields' => ['id', 'name', 'body'],
  261. 'associations' => [],
  262. 'keyFields' => [],
  263. );
  264. $result = $this->Task->getContent('view', $vars);
  265. $this->assertContains('Delete Test View Model', $result);
  266. $this->assertContains('Edit Test View Model', $result);
  267. $this->assertContains('List Test View Models', $result);
  268. $this->assertContains('New Test View Model', $result);
  269. $this->assertContains('$testViewModel->id', $result);
  270. $this->assertContains('$testViewModel->name', $result);
  271. $this->assertContains('$testViewModel->body', $result);
  272. }
  273. /**
  274. * test getContent() using a routing prefix action.
  275. *
  276. * @return void
  277. */
  278. public function testGetContentWithRoutingPrefix() {
  279. $vars = array(
  280. 'modelClass' => 'TestViewModel',
  281. 'schema' => [],
  282. 'primaryKey' => ['id'],
  283. 'displayField' => 'name',
  284. 'singularVar' => 'testViewModel',
  285. 'pluralVar' => 'testViewModels',
  286. 'singularHumanName' => 'Test View Model',
  287. 'pluralHumanName' => 'Test View Models',
  288. 'fields' => ['id', 'name', 'body'],
  289. 'keyFields' => [],
  290. 'associations' => []
  291. );
  292. $this->Task->params['prefix'] = 'Admin';
  293. $result = $this->Task->getContent('view', $vars);
  294. $this->assertContains('Delete Test View Model', $result);
  295. $this->assertContains('Edit Test View Model', $result);
  296. $this->assertContains('List Test View Models', $result);
  297. $this->assertContains('New Test View Model', $result);
  298. $this->assertContains('$testViewModel->id', $result);
  299. $this->assertContains('$testViewModel->name', $result);
  300. $this->assertContains('$testViewModel->body', $result);
  301. $result = $this->Task->getContent('add', $vars);
  302. $this->assertContains("input('name')", $result);
  303. $this->assertContains("input('body')", $result);
  304. $this->assertContains('List Test View Models', $result);
  305. }
  306. /**
  307. * test Bake method
  308. *
  309. * @return void
  310. */
  311. public function testBakeView() {
  312. $this->Task->controllerName = 'ViewTaskComments';
  313. $this->Task->modelName = 'ViewTaskComments';
  314. $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController';
  315. $this->Task->expects($this->at(0))
  316. ->method('createFile')
  317. ->with(
  318. $this->_normalizePath(APP . 'Template/ViewTaskComments/view.ctp'),
  319. $this->stringContains('View Task Comments')
  320. );
  321. $this->Task->bake('view', true);
  322. }
  323. /**
  324. * test baking an edit file
  325. *
  326. * @return void
  327. */
  328. public function testBakeEdit() {
  329. $this->Task->controllerName = 'ViewTaskComments';
  330. $this->Task->modelName = 'ViewTaskComments';
  331. $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController';
  332. $this->Task->expects($this->at(0))->method('createFile')
  333. ->with(
  334. $this->_normalizePath(APP . 'Template/ViewTaskComments/edit.ctp'),
  335. $this->anything()
  336. );
  337. $result = $this->Task->bake('edit', true);
  338. $this->assertNotContains("Form->input('id')", $result);
  339. $this->assertContains("Form->input('article_id', ['options' => \$articles])", $result);
  340. }
  341. /**
  342. * test baking an index
  343. *
  344. * @return void
  345. */
  346. public function testBakeIndex() {
  347. $this->Task->controllerName = 'ViewTaskComments';
  348. $this->Task->modelName = 'ViewTaskComments';
  349. $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController';
  350. $this->Task->expects($this->at(0))->method('createFile')
  351. ->with(
  352. $this->_normalizePath(APP . 'Template/ViewTaskComments/index.ctp'),
  353. $this->stringContains("\$viewTaskComment->article->title")
  354. );
  355. $this->Task->bake('index', true);
  356. }
  357. /**
  358. * test Bake with plugins
  359. *
  360. * @return void
  361. */
  362. public function testBakeIndexPlugin() {
  363. $this->Task->controllerName = 'ViewTaskComments';
  364. $this->Task->modelName = 'TestPlugin.TestPluginComments';
  365. $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController';
  366. $table = TableRegistry::get('TestPlugin.TestPluginComments');
  367. $table->belongsTo('Articles');
  368. $this->Task->expects($this->at(0))
  369. ->method('createFile')
  370. ->with(
  371. $this->_normalizePath(APP . 'Template/ViewTaskComments/index.ctp'),
  372. $this->stringContains('$viewTaskComment->article->id')
  373. );
  374. $this->Task->bake('index', true);
  375. }
  376. /**
  377. * Ensure that models associated with themselves do not have action
  378. * links generated.
  379. *
  380. * @return void
  381. */
  382. public function testBakeSelfAssociations() {
  383. $this->Task->controllerName = 'CategoryThreads';
  384. $this->Task->modelName = 'TestApp\Model\Table\CategoryThreadsTable';
  385. $this->Task->expects($this->once())
  386. ->method('createFile')
  387. ->with(
  388. $this->_normalizePath(APP . 'Template/CategoryThreads/index.ctp'),
  389. $this->logicalNot($this->stringContains('ParentCategoryThread'))
  390. );
  391. $this->Task->bake('index', true);
  392. }
  393. /**
  394. * test that baking a view with no template doesn't make a file.
  395. *
  396. * @return void
  397. */
  398. public function testBakeWithNoTemplate() {
  399. $this->Task->controllerName = 'ViewTaskComments';
  400. $this->Task->modelName = 'ViewTaskComments';
  401. $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController';
  402. $this->Task->expects($this->never())->method('createFile');
  403. $this->Task->bake('delete', true);
  404. }
  405. /**
  406. * test bake actions baking multiple actions.
  407. *
  408. * @return void
  409. */
  410. public function testBakeActions() {
  411. $this->Task->controllerName = 'ViewTaskComments';
  412. $this->Task->modelName = 'ViewTaskComments';
  413. $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController';
  414. $this->Task->expects($this->at(0))
  415. ->method('createFile')
  416. ->with(
  417. $this->_normalizePath(APP . 'Template/ViewTaskComments/view.ctp'),
  418. $this->stringContains('View Task Comments')
  419. );
  420. $this->Task->expects($this->at(1))->method('createFile')
  421. ->with(
  422. $this->_normalizePath(APP . 'Template/ViewTaskComments/edit.ctp'),
  423. $this->stringContains('Edit View Task Comment')
  424. );
  425. $this->Task->expects($this->at(2))->method('createFile')
  426. ->with(
  427. $this->_normalizePath(APP . 'Template/ViewTaskComments/index.ctp'),
  428. $this->stringContains('ViewTaskComment')
  429. );
  430. $this->Task->bakeActions(array('view', 'edit', 'index'), array());
  431. }
  432. /**
  433. * test baking a customAction (non crud)
  434. *
  435. * @return void
  436. */
  437. public function testCustomAction() {
  438. $this->Task->controllerName = 'ViewTaskComments';
  439. $this->Task->modelName = 'ViewTaskComments';
  440. $this->Task->controllerClass = __NAMESPACE__ . '\ViewTaskCommentsController';
  441. $this->Task->expects($this->any())->method('in')
  442. ->will($this->onConsecutiveCalls('', 'my_action', 'y'));
  443. $this->Task->expects($this->once())->method('createFile')
  444. ->with(
  445. $this->_normalizePath(APP . 'Template/ViewTaskComments/my_action.ctp'),
  446. $this->anything()
  447. );
  448. $this->Task->customAction();
  449. }
  450. /**
  451. * Test execute no args.
  452. *
  453. * @return void
  454. */
  455. public function testMainNoArgs() {
  456. $this->_setupTask(['in', 'err', 'bake', 'createFile', '_stop']);
  457. $this->Task->Model->expects($this->once())
  458. ->method('listAll')
  459. ->will($this->returnValue(['comments', 'articles']));
  460. $this->Task->expects($this->never())
  461. ->method('bake');
  462. $this->Task->main();
  463. }
  464. /**
  465. * Test all() calls execute
  466. *
  467. * @return void
  468. */
  469. public function testAllCallsMain() {
  470. $this->_setupTask(['in', 'err', 'createFile', 'main', '_stop']);
  471. $this->Task->Model->expects($this->once())
  472. ->method('listAll')
  473. ->will($this->returnValue(['comments', 'articles']));
  474. $this->Task->expects($this->exactly(2))
  475. ->method('main');
  476. $this->Task->expects($this->at(0))
  477. ->method('main')
  478. ->with('comments');
  479. $this->Task->expects($this->at(1))
  480. ->method('main')
  481. ->with('articles');
  482. $this->Task->all();
  483. }
  484. /**
  485. * test `cake bake view $controller view`
  486. *
  487. * @return void
  488. */
  489. public function testMainWithActionParam() {
  490. $this->_setupTask(['in', 'err', 'createFile', 'bake', '_stop']);
  491. $this->Task->expects($this->once())
  492. ->method('bake')
  493. ->with('view', true);
  494. $this->Task->main('ViewTaskComments', 'view');
  495. }
  496. /**
  497. * test `cake bake view $controller`
  498. * Ensure that views are only baked for actions that exist in the controller.
  499. *
  500. * @return void
  501. */
  502. public function testMainWithController() {
  503. $this->_setupTask(['in', 'err', 'createFile', 'bake', '_stop']);
  504. $this->Task->expects($this->exactly(4))
  505. ->method('bake');
  506. $this->Task->expects($this->at(0))
  507. ->method('bake')
  508. ->with('index', $this->anything());
  509. $this->Task->expects($this->at(1))
  510. ->method('bake')
  511. ->with('view', $this->anything());
  512. $this->Task->expects($this->at(2))
  513. ->method('bake')
  514. ->with('add', $this->anything());
  515. $this->Task->expects($this->at(3))
  516. ->method('bake')
  517. ->with('edit', $this->anything());
  518. $this->Task->main('ViewTaskComments');
  519. }
  520. /**
  521. * test that plugin.name works.
  522. *
  523. * @return void
  524. */
  525. public function testMainWithPluginName() {
  526. $this->_setupTask(['in', 'err', 'createFile']);
  527. $this->Task->connection = 'test';
  528. $filename = $this->_normalizePath(TEST_APP . 'Plugin/TestPlugin/src/Template/ViewTaskComments/index.ctp');
  529. Plugin::load('TestPlugin');
  530. $this->Task->expects($this->at(0))
  531. ->method('createFile')
  532. ->with($filename);
  533. $this->Task->main('TestPlugin.ViewTaskComments');
  534. }
  535. /**
  536. * static dataprovider for test cases
  537. *
  538. * @return void
  539. */
  540. public static function nameVariations() {
  541. return [['ViewTaskComments'], ['ViewTaskComment'], ['view_task_comment']];
  542. }
  543. /**
  544. * test `cake bake view $table --controller Blog`
  545. *
  546. * @return void
  547. */
  548. public function testMainWithControllerFlag() {
  549. $this->Task->params['controller'] = 'Blog';
  550. $this->Task->expects($this->exactly(4))
  551. ->method('createFile');
  552. $views = array('index.ctp', 'view.ctp', 'add.ctp', 'edit.ctp');
  553. foreach ($views as $i => $view) {
  554. $this->Task->expects($this->at($i))->method('createFile')
  555. ->with(
  556. $this->_normalizePath(APP . 'Template/Blog/' . $view),
  557. $this->anything()
  558. );
  559. }
  560. $this->Task->main('Posts');
  561. }
  562. /**
  563. * test `cake bake view $controller --prefix Admin`
  564. *
  565. * @return void
  566. */
  567. public function testMainWithControllerAndAdminFlag() {
  568. $this->Task->params['prefix'] = 'Admin';
  569. $this->Task->expects($this->exactly(2))
  570. ->method('createFile');
  571. $views = array('index.ctp', 'add.ctp');
  572. foreach ($views as $i => $view) {
  573. $this->Task->expects($this->at($i))->method('createFile')
  574. ->with(
  575. $this->_normalizePath(APP . 'Template/Admin/Posts/' . $view),
  576. $this->anything()
  577. );
  578. }
  579. $this->Task->main('Posts');
  580. }
  581. /**
  582. * test `cake bake view posts index list`
  583. *
  584. * @return void
  585. */
  586. public function testMainWithAlternateTemplates() {
  587. $this->_setupTask(['in', 'err', 'createFile', 'bake', '_stop']);
  588. $this->Task->connection = 'test';
  589. $this->Task->params = [];
  590. $this->Task->expects($this->once())
  591. ->method('bake')
  592. ->with('list', true);
  593. $this->Task->main('ViewTaskComments', 'index', 'list');
  594. }
  595. /**
  596. * test getting templates, make sure noTemplateActions works and prefixed template is used before generic one.
  597. *
  598. * @return void
  599. */
  600. public function testGetTemplate() {
  601. $result = $this->Task->getTemplate('delete');
  602. $this->assertFalse($result);
  603. $result = $this->Task->getTemplate('add');
  604. $this->assertEquals('form', $result);
  605. $result = $this->Task->getTemplate('edit');
  606. $this->assertEquals('form', $result);
  607. $result = $this->Task->getTemplate('view');
  608. $this->assertEquals('view', $result);
  609. $result = $this->Task->getTemplate('index');
  610. $this->assertEquals('index', $result);
  611. }
  612. /**
  613. * Test getting prefixed views.
  614. *
  615. * @return void
  616. */
  617. public function testGetTemplatePrefixed() {
  618. $this->Task->params['prefix'] = 'Admin';
  619. $result = $this->Task->getTemplate('add');
  620. $this->assertEquals('form', $result);
  621. $this->Task->Template->templatePaths = array(
  622. 'test' => CORE_TESTS . '/test_app/TestApp/Template/Bake/test/'
  623. );
  624. $this->Task->Template->params['template'] = 'test';
  625. $result = $this->Task->getTemplate('edit');
  626. $this->assertEquals('admin_edit', $result);
  627. $result = $this->Task->getTemplate('add');
  628. $this->assertEquals('admin_form', $result);
  629. $result = $this->Task->getTemplate('view');
  630. $this->assertEquals('view', $result);
  631. }
  632. }