ViewTaskTest.php 18 KB

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