ViewTaskTest.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  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. $path = APP . 'plugins' . DS . 'test_test' . DS . 'views' . DS . 'view_task_comments' . DS . 'view.ctp';
  353. $this->Task->expects($this->once())->method('createFile')
  354. ->with($path, new PHPUnit_Framework_Constraint_IsAnything());
  355. $this->Task->bake('view', true);
  356. }
  357. /**
  358. * test bake actions baking multiple actions.
  359. *
  360. * @return void
  361. */
  362. public function testBakeActions() {
  363. $this->Task->controllerName = 'ViewTaskComments';
  364. $this->Task->controllerPath = 'view_task_comments';
  365. $this->Task->expects($this->at(0))->method('createFile')
  366. ->with(
  367. TMP . 'view_task_comments' . DS . 'view.ctp',
  368. new PHPUnit_Framework_Constraint_PCREMatch('/View Task Comments/')
  369. );
  370. $this->Task->expects($this->at(1))->method('createFile')
  371. ->with(
  372. TMP . 'view_task_comments' . DS . 'edit.ctp',
  373. new PHPUnit_Framework_Constraint_PCREMatch('/Edit View Task Comment/')
  374. );
  375. $this->Task->expects($this->at(2))->method('createFile')
  376. ->with(
  377. TMP . 'view_task_comments' . DS . 'index.ctp',
  378. new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/')
  379. );
  380. $this->Task->bakeActions(array('view', 'edit', 'index'), array());
  381. }
  382. /**
  383. * test baking a customAction (non crud)
  384. *
  385. * @return void
  386. */
  387. public function testCustomAction() {
  388. $this->Task->controllerName = 'ViewTaskComments';
  389. $this->Task->controllerPath = 'view_task_comments';
  390. $this->Task->params['app'] = APP;
  391. $this->Task->expects($this->any())->method('in')
  392. ->will($this->onConsecutiveCalls('', 'my_action', 'y'));
  393. $this->Task->expects($this->once())->method('createFile')
  394. ->with(
  395. TMP . 'view_task_comments' . DS . 'my_action.ctp',
  396. new PHPUnit_Framework_Constraint_IsAnything()
  397. );
  398. $this->Task->customAction();
  399. }
  400. /**
  401. * Test all()
  402. *
  403. * @return void
  404. */
  405. public function testExecuteIntoAll() {
  406. $this->Task->args[0] = 'all';
  407. $this->Task->Controller->expects($this->once())->method('listAll')
  408. ->will($this->returnValue(array('view_task_comments')));
  409. $this->Task->expects($this->at(0))->method('createFile')
  410. ->with(
  411. TMP . 'view_task_comments' . DS . 'index.ctp',
  412. new PHPUnit_Framework_Constraint_IsAnything()
  413. );
  414. $this->Task->expects($this->at(1))->method('createFile')
  415. ->with(
  416. TMP . 'view_task_comments' . DS . 'add.ctp',
  417. new PHPUnit_Framework_Constraint_IsAnything()
  418. );
  419. $this->Task->expects($this->exactly(2))->method('createFile');
  420. $this->Task->execute();
  421. }
  422. /**
  423. * Test all() with action parameter
  424. *
  425. * @return void
  426. */
  427. public function testExecuteIntoAllWithActionName() {
  428. $this->Task->args = array('all', 'index');
  429. $this->Task->Controller->expects($this->once())->method('listAll')
  430. ->will($this->returnValue(array('view_task_comments')));
  431. $this->Task->expects($this->once())->method('createFile')
  432. ->with(
  433. TMP . 'view_task_comments' . DS . 'index.ctp',
  434. new PHPUnit_Framework_Constraint_IsAnything()
  435. );
  436. $this->Task->execute();
  437. }
  438. /**
  439. * test `cake bake view $controller view`
  440. *
  441. * @return void
  442. */
  443. public function testExecuteWithActionParam() {
  444. $this->Task->args[0] = 'ViewTaskComments';
  445. $this->Task->args[1] = 'view';
  446. $this->Task->expects($this->once())->method('createFile')
  447. ->with(
  448. TMP . 'view_task_comments' . DS . 'view.ctp',
  449. new PHPUnit_Framework_Constraint_IsAnything()
  450. );
  451. $this->Task->execute();
  452. }
  453. /**
  454. * test `cake bake view $controller`
  455. * Ensure that views are only baked for actions that exist in the controller.
  456. *
  457. * @return void
  458. */
  459. public function testExecuteWithController() {
  460. $this->Task->args[0] = 'ViewTaskComments';
  461. $this->Task->expects($this->at(0))->method('createFile')
  462. ->with(
  463. TMP . 'view_task_comments' . DS . 'index.ctp',
  464. new PHPUnit_Framework_Constraint_IsAnything()
  465. );
  466. $this->Task->expects($this->at(1))->method('createFile')
  467. ->with(
  468. TMP . 'view_task_comments' . DS . 'add.ctp',
  469. new PHPUnit_Framework_Constraint_IsAnything()
  470. );
  471. $this->Task->expects($this->exactly(2))->method('createFile');
  472. $this->Task->execute();
  473. }
  474. /**
  475. * static dataprovider for test cases
  476. *
  477. * @return void
  478. */
  479. public static function nameVariations() {
  480. return array(array('ViewTaskComments'), array('ViewTaskComment'), array('view_task_comment'));
  481. }
  482. /**
  483. * test that both plural and singular forms can be used for baking views.
  484. *
  485. * @dataProvider nameVariations
  486. * @return void
  487. */
  488. public function testExecuteWithControllerVariations($name) {
  489. $this->Task->args = array($name);
  490. $this->Task->expects($this->at(0))->method('createFile')
  491. ->with(
  492. TMP . 'view_task_comments' . DS . 'index.ctp',
  493. new PHPUnit_Framework_Constraint_IsAnything()
  494. );
  495. $this->Task->expects($this->at(1))->method('createFile')
  496. ->with(
  497. TMP . 'view_task_comments' . DS . 'add.ctp',
  498. new PHPUnit_Framework_Constraint_IsAnything()
  499. );
  500. $this->Task->execute();
  501. }
  502. /**
  503. * test `cake bake view $controller -admin`
  504. * Which only bakes admin methods, not non-admin methods.
  505. *
  506. * @return void
  507. */
  508. public function testExecuteWithControllerAndAdminFlag() {
  509. $_back = Configure::read('Routing');
  510. Configure::write('Routing.prefixes', array('admin'));
  511. $this->Task->args[0] = 'ViewTaskArticles';
  512. $this->Task->params['admin'] = 1;
  513. $this->Task->Project->expects($this->any())->method('getPrefix')->will($this->returnValue('admin_'));
  514. $this->Task->expects($this->exactly(4))->method('createFile');
  515. $views = array('admin_index.ctp', 'admin_add.ctp', 'admin_view.ctp', 'admin_edit.ctp');
  516. foreach ($views as $i => $view) {
  517. $this->Task->expects($this->at($i))->method('createFile')
  518. ->with(
  519. TMP . 'view_task_articles' . DS . $view,
  520. new PHPUnit_Framework_Constraint_IsAnything()
  521. );
  522. }
  523. $this->Task->execute();
  524. Configure::write('Routing', $_back);
  525. }
  526. /**
  527. * test execute into interactive.
  528. *
  529. * @return void
  530. */
  531. public function testExecuteInteractive() {
  532. $this->Task->connection = 'test';
  533. $this->Task->args = array();
  534. $this->Task->params = array();
  535. $this->Task->Controller->expects($this->once())->method('getName')
  536. ->will($this->returnValue('ViewTaskComments'));
  537. $this->Task->expects($this->any())->method('in')
  538. ->will($this->onConsecutiveCalls('y', 'y', 'n'));
  539. $this->Task->expects($this->at(3))->method('createFile')
  540. ->with(
  541. TMP . 'view_task_comments' . DS . 'index.ctp',
  542. new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/')
  543. );
  544. $this->Task->expects($this->at(4))->method('createFile')
  545. ->with(
  546. TMP . 'view_task_comments' . DS . 'view.ctp',
  547. new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/')
  548. );
  549. $this->Task->expects($this->at(5))->method('createFile')
  550. ->with(
  551. TMP . 'view_task_comments' . DS . 'add.ctp',
  552. new PHPUnit_Framework_Constraint_PCREMatch('/Add View Task Comment/')
  553. );
  554. $this->Task->expects($this->at(6))->method('createFile')
  555. ->with(
  556. TMP . 'view_task_comments' . DS . 'edit.ctp',
  557. new PHPUnit_Framework_Constraint_PCREMatch('/Edit View Task Comment/')
  558. );
  559. $this->Task->expects($this->exactly(4))->method('createFile');
  560. $this->Task->execute();
  561. }
  562. /**
  563. * test `cake bake view posts index list`
  564. *
  565. * @return void
  566. */
  567. public function testExecuteWithAlternateTemplates() {
  568. $this->Task->connection = 'test';
  569. $this->Task->args = array('ViewTaskComments', 'index', 'list');
  570. $this->Task->params = array();
  571. $this->Task->expects($this->once())->method('createFile')
  572. ->with(
  573. TMP . 'view_task_comments' . DS . 'list.ctp',
  574. new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/')
  575. );
  576. $this->Task->execute();
  577. }
  578. /**
  579. * test execute into interactive() with admin methods.
  580. *
  581. * @return void
  582. */
  583. public function testExecuteInteractiveWithAdmin() {
  584. Configure::write('Routing.prefixes', array('admin'));
  585. $this->Task->connection = 'test';
  586. $this->Task->args = array();
  587. $this->Task->Controller->expects($this->once())->method('getName')
  588. ->will($this->returnValue('ViewTaskComments'));
  589. $this->Task->Project->expects($this->once())->method('getPrefix')
  590. ->will($this->returnValue('admin_'));
  591. $this->Task->expects($this->any())->method('in')
  592. ->will($this->onConsecutiveCalls('y', 'n', 'y'));
  593. $this->Task->expects($this->at(3))->method('createFile')
  594. ->with(
  595. TMP . 'view_task_comments' . DS . 'admin_index.ctp',
  596. new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/')
  597. );
  598. $this->Task->expects($this->at(4))->method('createFile')
  599. ->with(
  600. TMP . 'view_task_comments' . DS . 'admin_view.ctp',
  601. new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/')
  602. );
  603. $this->Task->expects($this->at(5))->method('createFile')
  604. ->with(
  605. TMP . 'view_task_comments' . DS . 'admin_add.ctp',
  606. new PHPUnit_Framework_Constraint_PCREMatch('/Add View Task Comment/')
  607. );
  608. $this->Task->expects($this->at(6))->method('createFile')
  609. ->with(
  610. TMP . 'view_task_comments' . DS . 'admin_edit.ctp',
  611. new PHPUnit_Framework_Constraint_PCREMatch('/Edit View Task Comment/')
  612. );
  613. $this->Task->expects($this->exactly(4))->method('createFile');
  614. $this->Task->execute();
  615. }
  616. /**
  617. * test getting templates, make sure noTemplateActions works
  618. *
  619. * @return void
  620. */
  621. function testGetTemplate() {
  622. $result = $this->Task->getTemplate('delete');
  623. $this->assertFalse($result);
  624. $result = $this->Task->getTemplate('add');
  625. $this->assertEqual($result, 'form');
  626. Configure::write('Routing.prefixes', array('admin'));
  627. $result = $this->Task->getTemplate('admin_add');
  628. $this->assertEqual($result, 'form');
  629. }
  630. }