TestTaskTest.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  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\Console\Command\Task;
  16. use Cake\Console\Command\Task\TemplateTask;
  17. use Cake\Console\Command\Task\TestTask;
  18. use Cake\Controller\Controller;
  19. use Cake\Core\App;
  20. use Cake\Core\Configure;
  21. use Cake\Core\Plugin;
  22. use Cake\ORM\Table;
  23. use Cake\ORM\TableRegistry;
  24. use Cake\TestSuite\TestCase;
  25. use TestApp\Controller\PostsController;
  26. use TestApp\Model\Table\ArticlesTable;
  27. /**
  28. * TestTaskTest class
  29. *
  30. */
  31. class TestTaskTest extends TestCase {
  32. /**
  33. * Fixtures
  34. *
  35. * @var string
  36. */
  37. public $fixtures = ['core.article', 'core.author',
  38. 'core.comment', 'core.articles_tag', 'core.tag'];
  39. /**
  40. * setUp method
  41. *
  42. * @return void
  43. */
  44. public function setUp() {
  45. parent::setUp();
  46. $out = $this->getMock('Cake\Console\ConsoleOutput', array(), array(), '', false);
  47. $in = $this->getMock('Cake\Console\ConsoleInput', array(), array(), '', false);
  48. $this->Task = $this->getMock('Cake\Console\Command\Task\TestTask',
  49. array('in', 'err', 'createFile', '_stop', 'isLoadableClass'),
  50. array($out, $out, $in)
  51. );
  52. $this->Task->name = 'Test';
  53. $this->Task->Template = new TemplateTask($out, $out, $in);
  54. }
  55. /**
  56. * tearDown method
  57. *
  58. * @return void
  59. */
  60. public function tearDown() {
  61. parent::tearDown();
  62. unset($this->Task);
  63. Plugin::unload();
  64. }
  65. /**
  66. * Test that with no args execute() outputs the types you can generate
  67. * tests for.
  68. *
  69. * @return void
  70. */
  71. public function testExecuteNoArgsPrintsTypeOptions() {
  72. $this->Task = $this->getMockBuilder('Cake\Console\Command\Task\TestTask')
  73. ->disableOriginalConstructor()
  74. ->setMethods(['outputTypeChoices'])
  75. ->getMock();
  76. $this->Task->expects($this->once())
  77. ->method('outputTypeChoices');
  78. $this->Task->execute();
  79. }
  80. /**
  81. * Test outputTypeChoices method
  82. *
  83. * @return void
  84. */
  85. public function testOutputTypeChoices() {
  86. $this->Task->stdout->expects($this->at(0))
  87. ->method('write')
  88. ->with($this->stringContains('You must provide'));
  89. $this->Task->stdout->expects($this->at(1))
  90. ->method('write')
  91. ->with($this->stringContains('1. Entity'));
  92. $this->Task->stdout->expects($this->at(2))
  93. ->method('write')
  94. ->with($this->stringContains('2. Table'));
  95. $this->Task->stdout->expects($this->at(3))
  96. ->method('write')
  97. ->with($this->stringContains('3. Controller'));
  98. $this->Task->outputTypeChoices();
  99. }
  100. /**
  101. * Test that with no args execute() outputs the types you can generate
  102. * tests for.
  103. *
  104. * @return void
  105. */
  106. public function testExecuteOneArgPrintsClassOptions() {
  107. $this->Task = $this->getMockBuilder('Cake\Console\Command\Task\TestTask')
  108. ->disableOriginalConstructor()
  109. ->setMethods(['outputClassChoices'])
  110. ->getMock();
  111. $this->Task->expects($this->once())
  112. ->method('outputClassChoices');
  113. $this->Task->args = ['Entity'];
  114. $this->Task->execute();
  115. }
  116. /**
  117. * test execute with type and class name defined
  118. *
  119. * @return void
  120. */
  121. public function testExecuteWithTwoArgs() {
  122. $this->Task->args = ['Table', 'TestTaskTag'];
  123. $this->Task->expects($this->once())->method('createFile')
  124. ->with(
  125. $this->stringContains('TestCase' . DS . 'Model' . DS . 'Table' . DS . 'TestTaskTagTableTest.php'),
  126. $this->stringContains('class TestTaskTagTableTest extends TestCase')
  127. );
  128. $this->Task->execute();
  129. }
  130. /**
  131. * Test generating class options for table.
  132. *
  133. * @return void
  134. */
  135. public function testOutputClassOptionsForTable() {
  136. $this->Task->stdout->expects($this->at(0))
  137. ->method('write')
  138. ->with($this->stringContains('You must provide'));
  139. $this->Task->stdout->expects($this->at(1))
  140. ->method('write')
  141. ->with($this->stringContains('1. ArticlesTable'));
  142. $this->Task->stdout->expects($this->at(2))
  143. ->method('write')
  144. ->with($this->stringContains('2. ArticlesTagsTable'));
  145. $this->Task->stdout->expects($this->at(3))
  146. ->method('write')
  147. ->with($this->stringContains('3. AuthUsersTable'));
  148. $this->Task->stdout->expects($this->at(4))
  149. ->method('write')
  150. ->with($this->stringContains('4. AuthorsTable'));
  151. $this->Task->outputClassChoices('Table');
  152. }
  153. /**
  154. * Test generating class options for table.
  155. *
  156. * @return void
  157. */
  158. public function testOutputClassOptionsForTablePlugin() {
  159. Plugin::load('TestPlugin');
  160. $this->Task->plugin = 'TestPlugin';
  161. $this->Task->stdout->expects($this->at(0))
  162. ->method('write')
  163. ->with($this->stringContains('You must provide'));
  164. $this->Task->stdout->expects($this->at(1))
  165. ->method('write')
  166. ->with($this->stringContains('1. TestPluginCommentsTable'));
  167. $this->Task->outputClassChoices('Table');
  168. }
  169. /**
  170. * Test that method introspection pulls all relevant non parent class
  171. * methods into the test case.
  172. *
  173. * @return void
  174. */
  175. public function testMethodIntrospection() {
  176. $result = $this->Task->getTestableMethods('TestApp\Model\Table\ArticlesTable');
  177. $expected = array('dosomething', 'dosomethingelse');
  178. $this->assertEquals($expected, array_map('strtolower', $result));
  179. }
  180. /**
  181. * test that the generation of fixtures works correctly.
  182. *
  183. * @return void
  184. */
  185. public function testFixtureArrayGenerationFromModel() {
  186. $subject = new ArticlesTable();
  187. $result = $this->Task->generateFixtureList($subject);
  188. $expected = [
  189. 'app.article',
  190. 'app.author',
  191. 'app.tag',
  192. 'app.articles_tag'
  193. ];
  194. $this->assertEquals($expected, $result);
  195. }
  196. /**
  197. * test that the generation of fixtures works correctly.
  198. *
  199. * @return void
  200. */
  201. public function testFixtureArrayGenerationFromController() {
  202. $subject = new PostsController();
  203. $result = $this->Task->generateFixtureList($subject);
  204. $expected = [
  205. 'app.post',
  206. ];
  207. $this->assertEquals($expected, $result);
  208. }
  209. /**
  210. * creating test subjects should clear the registry so the registry is always fresh
  211. *
  212. * @return void
  213. */
  214. public function testRegistryClearWhenBuildingTestObjects() {
  215. $articles = TableRegistry::get('Articles');
  216. $this->Task->buildTestSubject('Table', 'Posts');
  217. $this->assertFalse(TableRegistry::exists('Articles'));
  218. }
  219. /**
  220. * Test the user interaction for defining additional fixtures.
  221. *
  222. * @return void
  223. */
  224. public function testGetUserFixtures() {
  225. $this->Task->expects($this->at(0))->method('in')->will($this->returnValue('y'));
  226. $this->Task->expects($this->at(1))->method('in')
  227. ->will($this->returnValue('app.pizza, app.topping, app.side_dish'));
  228. $result = $this->Task->getUserFixtures();
  229. $expected = array('app.pizza', 'app.topping', 'app.side_dish');
  230. $this->assertEquals($expected, $result);
  231. }
  232. /**
  233. * Dataprovider for class name generation.
  234. *
  235. * @return array
  236. */
  237. public static function realClassProvider() {
  238. return [
  239. ['Entity', 'Article', 'App\Model\Entity\Article'],
  240. ['entity', 'ArticleEntity', 'App\Model\Entity\ArticleEntity'],
  241. ['Table', 'Posts', 'App\Model\Table\PostsTable'],
  242. ['table', 'PostsTable', 'App\Model\Table\PostsTable'],
  243. ['Controller', 'Posts', 'App\Controller\PostsController'],
  244. ['controller', 'PostsController', 'App\Controller\PostsController'],
  245. ['Behavior', 'Timestamp', 'App\Model\Behavior\TimestampBehavior'],
  246. ['behavior', 'TimestampBehavior', 'App\Model\Behavior\TimestampBehavior'],
  247. ['Helper', 'Form', 'App\View\Helper\FormHelper'],
  248. ['helper', 'FormHelper', 'App\View\Helper\FormHelper'],
  249. ['Component', 'Auth', 'App\Controller\Component\AuthComponent'],
  250. ['component', 'AuthComponent', 'App\Controller\Component\AuthComponent'],
  251. ];
  252. }
  253. /**
  254. * test that resolving class names works
  255. *
  256. * @dataProvider realClassProvider
  257. * @return void
  258. */
  259. public function testGetRealClassname($type, $name, $expected) {
  260. $result = $this->Task->getRealClassname($type, $name);
  261. $this->assertEquals($expected, $result);
  262. }
  263. /**
  264. * test resolving class names with plugins
  265. *
  266. * @return void
  267. */
  268. public function testGetRealClassnamePlugin() {
  269. Plugin::load('TestPlugin');
  270. $this->Task->plugin = 'TestPlugin';
  271. $result = $this->Task->getRealClassname('Helper', 'Asset');
  272. $expected = 'TestPlugin\View\Helper\AssetHelper';
  273. $this->assertEquals($expected, $result);
  274. }
  275. /**
  276. * Test baking a test for a concrete model with fixtures arg
  277. *
  278. * @return void
  279. */
  280. public function testBakeFixturesParam() {
  281. $this->Task->expects($this->once())
  282. ->method('createFile')
  283. ->will($this->returnValue(true));
  284. $this->Task->params['fixtures'] = 'app.post, app.comments , app.user ,';
  285. $result = $this->Task->bake('Table', 'Articles');
  286. $this->assertContains('public $fixtures = [', $result);
  287. $this->assertContains('app.post', $result);
  288. $this->assertContains('app.comments', $result);
  289. $this->assertContains('app.user', $result);
  290. $this->assertNotContains("''", $result);
  291. }
  292. /**
  293. * Test baking a test for a concrete model.
  294. *
  295. * @return void
  296. */
  297. public function testBakeModelTest() {
  298. $this->Task->expects($this->once())
  299. ->method('createFile')
  300. ->will($this->returnValue(true));
  301. $result = $this->Task->bake('Table', 'Articles');
  302. $this->assertContains("use App\Model\Table\ArticlesTable", $result);
  303. $this->assertContains('class ArticlesTableTest extends TestCase', $result);
  304. $this->assertContains('function setUp()', $result);
  305. $this->assertContains("\$config = TableRegistry::exists('Articles') ?", $result);
  306. $this->assertContains("\$this->Articles = TableRegistry::get('Articles', \$config", $result);
  307. $this->assertContains('function tearDown()', $result);
  308. $this->assertContains('unset($this->Articles)', $result);
  309. }
  310. /**
  311. * test baking controller test files
  312. *
  313. * @return void
  314. */
  315. public function testBakeControllerTest() {
  316. Configure::write('App.namespace', 'TestApp');
  317. $this->Task->expects($this->once())
  318. ->method('createFile')
  319. ->will($this->returnValue(true));
  320. $result = $this->Task->bake('Controller', 'PostsController');
  321. $this->assertContains("use TestApp\Controller\PostsController", $result);
  322. $this->assertContains('class PostsControllerTest extends ControllerTestCase', $result);
  323. $this->assertNotContains('function setUp()', $result);
  324. $this->assertNotContains("\$this->Posts = new PostsController()", $result);
  325. $this->assertNotContains("\$this->Posts->constructClasses()", $result);
  326. $this->assertNotContains('function tearDown()', $result);
  327. $this->assertNotContains('unset($this->Posts)', $result);
  328. $this->assertContains("'app.post'", $result);
  329. }
  330. /**
  331. * test baking controller test files
  332. *
  333. * @return void
  334. */
  335. public function testBakePrefixControllerTest() {
  336. Configure::write('App.namespace', 'TestApp');
  337. $this->Task->expects($this->once())
  338. ->method('createFile')
  339. ->with($this->stringContains('Controller' . DS . 'Admin' . DS . 'PostsControllerTest.php'))
  340. ->will($this->returnValue(true));
  341. $result = $this->Task->bake('controller', 'Admin\Posts');
  342. $this->assertContains("use TestApp\Controller\Admin\PostsController", $result);
  343. $this->assertContains('class PostsControllerTest extends ControllerTestCase', $result);
  344. $this->assertNotContains('function setUp()', $result);
  345. $this->assertNotContains("\$this->Posts = new PostsController()", $result);
  346. $this->assertNotContains("\$this->Posts->constructClasses()", $result);
  347. $this->assertNotContains('function tearDown()', $result);
  348. $this->assertNotContains('unset($this->Posts)', $result);
  349. }
  350. /**
  351. * test baking component test files,
  352. *
  353. * @return void
  354. */
  355. public function testBakeComponentTest() {
  356. Configure::write('App.namespace', 'TestApp');
  357. $this->Task->expects($this->once())
  358. ->method('createFile')
  359. ->will($this->returnValue(true));
  360. $result = $this->Task->bake('Component', 'Apple');
  361. $this->assertContains('use Cake\Controller\ComponentRegistry', $result);
  362. $this->assertContains('use TestApp\Controller\Component\AppleComponent', $result);
  363. $this->assertContains('class AppleComponentTest extends TestCase', $result);
  364. $this->assertContains('function setUp()', $result);
  365. $this->assertContains("\$registry = new ComponentRegistry()", $result);
  366. $this->assertContains("\$this->Apple = new AppleComponent(\$registry)", $result);
  367. $this->assertContains('function testStartup()', $result);
  368. $this->assertContains('$this->markTestIncomplete(\'testStartup not implemented.\')', $result);
  369. $this->assertContains('function tearDown()', $result);
  370. $this->assertContains('unset($this->Apple)', $result);
  371. }
  372. /**
  373. * test baking behavior test files,
  374. *
  375. * @return void
  376. */
  377. public function testBakeBehaviorTest() {
  378. $this->Task->expects($this->once())
  379. ->method('createFile')
  380. ->will($this->returnValue(true));
  381. $result = $this->Task->bake('Behavior', 'Example');
  382. $this->assertContains("use App\Model\Behavior\ExampleBehavior;", $result);
  383. $this->assertContains('class ExampleBehaviorTest extends TestCase', $result);
  384. $this->assertContains('function setUp()', $result);
  385. $this->assertContains("\$this->Example = new ExampleBehavior()", $result);
  386. $this->assertContains('function tearDown()', $result);
  387. $this->assertContains('unset($this->Example)', $result);
  388. }
  389. /**
  390. * test baking helper test files,
  391. *
  392. * @return void
  393. */
  394. public function testBakeHelperTest() {
  395. $this->Task->expects($this->once())
  396. ->method('createFile')
  397. ->will($this->returnValue(true));
  398. $result = $this->Task->bake('Helper', 'Example');
  399. $this->assertContains("use Cake\View\View;", $result);
  400. $this->assertContains("use App\View\Helper\ExampleHelper;", $result);
  401. $this->assertContains('class ExampleHelperTest extends TestCase', $result);
  402. $this->assertContains('function setUp()', $result);
  403. $this->assertContains("\$view = new View()", $result);
  404. $this->assertContains("\$this->Example = new ExampleHelper(\$view)", $result);
  405. $this->assertContains('function tearDown()', $result);
  406. $this->assertContains('unset($this->Example)', $result);
  407. }
  408. /**
  409. * test Constructor generation ensure that constructClasses is called for controllers
  410. *
  411. * @return void
  412. */
  413. public function testGenerateConstructor() {
  414. $result = $this->Task->generateConstructor('controller', 'PostsController');
  415. $expected = ['', '', ''];
  416. $this->assertEquals($expected, $result);
  417. $result = $this->Task->generateConstructor('table', 'App\Model\\Table\PostsTable');
  418. $expected = [
  419. "\$config = TableRegistry::exists('Posts') ? [] : ['className' => 'App\Model\\Table\PostsTable'];\n",
  420. "TableRegistry::get('Posts', \$config);\n",
  421. ''
  422. ];
  423. $this->assertEquals($expected, $result);
  424. $result = $this->Task->generateConstructor('helper', 'FormHelper');
  425. $expected = ["\$view = new View();\n", "new FormHelper(\$view);\n", ''];
  426. $this->assertEquals($expected, $result);
  427. $result = $this->Task->generateConstructor('entity', 'TestPlugin\Model\Entity\Article');
  428. $expected = ["", "new Article();\n", ''];
  429. $this->assertEquals($expected, $result);
  430. }
  431. /**
  432. * Test generateUses()
  433. *
  434. * @return void
  435. */
  436. public function testGenerateUses() {
  437. $result = $this->Task->generateUses('table', 'App\Model\Table\PostsTable');
  438. $expected = array(
  439. 'Cake\ORM\TableRegistry',
  440. 'App\Model\Table\PostsTable',
  441. );
  442. $this->assertEquals($expected, $result);
  443. $result = $this->Task->generateUses('controller', 'App\Controller\PostsController');
  444. $expected = array(
  445. 'App\Controller\PostsController',
  446. );
  447. $this->assertEquals($expected, $result);
  448. $result = $this->Task->generateUses('helper', 'App\View\Helper\FormHelper');
  449. $expected = array(
  450. 'Cake\View\View',
  451. 'App\View\Helper\FormHelper',
  452. );
  453. $this->assertEquals($expected, $result);
  454. $result = $this->Task->generateUses('component', 'App\Controller\Component\AuthComponent');
  455. $expected = array(
  456. 'Cake\Controller\ComponentRegistry',
  457. 'App\Controller\Component\AuthComponent',
  458. );
  459. $this->assertEquals($expected, $result);
  460. }
  461. /**
  462. * Test that mock class generation works for the appropriate classes
  463. *
  464. * @return void
  465. */
  466. public function testMockClassGeneration() {
  467. $result = $this->Task->hasMockClass('controller');
  468. $this->assertTrue($result);
  469. }
  470. /**
  471. * test bake() with a -plugin param
  472. *
  473. * @return void
  474. */
  475. public function testBakeWithPlugin() {
  476. $this->Task->plugin = 'TestPlugin';
  477. Plugin::load('TestPlugin');
  478. $path = TEST_APP . 'Plugin/TestPlugin/Test/TestCase/View/Helper/FormHelperTest.php';
  479. $path = str_replace('/', DS, $path);
  480. $this->Task->expects($this->once())->method('createFile')
  481. ->with($path, $this->anything());
  482. $this->Task->bake('Helper', 'Form');
  483. }
  484. /**
  485. * Provider for test case file names.
  486. *
  487. * @return array
  488. */
  489. public static function caseFileNameProvider() {
  490. return array(
  491. array('Table', 'App\Model\Table\PostsTable', 'TestCase/Model/Table/PostsTableTest.php'),
  492. array('Entity', 'App\Model\Entity\Article', 'TestCase/Model/Entity/ArticleTest.php'),
  493. array('Helper', 'App\View\Helper\FormHelper', 'TestCase/View/Helper/FormHelperTest.php'),
  494. array('Controller', 'App\Controller\PostsController', 'TestCase/Controller/PostsControllerTest.php'),
  495. array('Controller', 'App\Controller\Admin\PostsController', 'TestCase/Controller/Admin/PostsControllerTest.php'),
  496. array('Behavior', 'App\Model\Behavior\TreeBehavior', 'TestCase/Model/Behavior/TreeBehaviorTest.php'),
  497. array('Component', 'App\Controller\Component\AuthComponent', 'TestCase/Controller/Component/AuthComponentTest.php'),
  498. array('entity', 'App\Model\Entity\Article', 'TestCase/Model/Entity/ArticleTest.php'),
  499. array('table', 'App\Model\Table\PostsTable', 'TestCase/Model/Table/PostsTableTest.php'),
  500. array('helper', 'App\View\Helper\FormHelper', 'TestCase/View/Helper/FormHelperTest.php'),
  501. array('controller', 'App\Controller\PostsController', 'TestCase/Controller/PostsControllerTest.php'),
  502. array('behavior', 'App\Model\Behavior\TreeBehavior', 'TestCase/Model/Behavior/TreeBehaviorTest.php'),
  503. array('component', 'App\Controller\Component\AuthComponent', 'TestCase/Controller/Component/AuthComponentTest.php'),
  504. );
  505. }
  506. /**
  507. * Test filename generation for each type + plugins
  508. *
  509. * @dataProvider caseFileNameProvider
  510. * @return void
  511. */
  512. public function testTestCaseFileName($type, $class, $expected) {
  513. $result = $this->Task->testCaseFileName($type, $class);
  514. $expected = ROOT . DS . 'Test/' . $expected;
  515. $this->assertPathEquals($expected, $result);
  516. }
  517. /**
  518. * Test filename generation for plugins.
  519. *
  520. * @return void
  521. */
  522. public function testTestCaseFileNamePlugin() {
  523. $this->Task->path = DS . 'my/path/tests/';
  524. Plugin::load('TestPlugin');
  525. $this->Task->plugin = 'TestPlugin';
  526. $class = 'TestPlugin\Model\Entity\Post';
  527. $result = $this->Task->testCaseFileName('entity', $class);
  528. $expected = TEST_APP . 'Plugin/TestPlugin/Test/TestCase/Model/Entity/PostTest.php';
  529. $this->assertPathEquals($expected, $result);
  530. }
  531. /**
  532. * Data provider for mapType() tests.
  533. *
  534. * @return array
  535. */
  536. public static function mapTypeProvider() {
  537. return array(
  538. array('controller', 'Controller'),
  539. array('Controller', 'Controller'),
  540. array('component', 'Controller\Component'),
  541. array('Component', 'Controller\Component'),
  542. array('table', 'Model\Table'),
  543. array('Table', 'Model\Table'),
  544. array('entity', 'Model\Entity'),
  545. array('Entity', 'Model\Entity'),
  546. array('behavior', 'Model\Behavior'),
  547. array('Behavior', 'Model\Behavior'),
  548. array('helper', 'View\Helper'),
  549. array('Helper', 'View\Helper'),
  550. array('Helper', 'View\Helper'),
  551. );
  552. }
  553. /**
  554. * Test that mapType returns the correct package names.
  555. *
  556. * @dataProvider mapTypeProvider
  557. * @return void
  558. */
  559. public function testMapType($original, $expected) {
  560. $this->assertEquals($expected, $this->Task->mapType($original));
  561. }
  562. }