ApplicationTest.php 731 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace Codeception;
  3. class ApplicationTest extends \PHPUnit\Framework\TestCase
  4. {
  5. public static function setUpBeforeClass()
  6. {
  7. require_once \Codeception\Configuration::dataDir() . 'register_command/examples/MyCustomCommand.php';
  8. }
  9. public function testRegisterCustomCommand()
  10. {
  11. \Codeception\Configuration::append(array('extensions' => array(
  12. 'commands' => array(
  13. 'Project\Command\MyCustomCommand'))));
  14. $application = new Application();
  15. $application->registerCustomCommands();
  16. try {
  17. $application->find('myProject:myCommand');
  18. } catch (\Exception $e) {
  19. $this->fail($e->getMessage());
  20. }
  21. }
  22. }