ViewTaskTest.php 18 KB

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