CommandTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * CakePHP : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://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. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP Project
  12. * @since 3.6.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Test\TestCase\Console;
  16. use Cake\Console\Command;
  17. use Cake\ORM\Locator\TableLocator;
  18. use Cake\ORM\Table;
  19. use Cake\TestSuite\TestCase;
  20. /**
  21. * Test case for Console\Command
  22. */
  23. class CommandTest extends TestCase
  24. {
  25. /**
  26. * test orm locator is setup
  27. *
  28. * @return void
  29. */
  30. public function testConstructorSetsLocator()
  31. {
  32. $command = new Command();
  33. $result = $command->getTableLocator();
  34. $this->assertInstanceOf(TableLocator::class, $result);
  35. }
  36. /**
  37. * test loadModel is configured properly
  38. *
  39. * @return void
  40. */
  41. public function testConstructorLoadModel()
  42. {
  43. $command = new Command();
  44. $command->loadModel('Comments');
  45. $this->assertInstanceOf(Table::class, $command->Comments);
  46. }
  47. }