InflectCommandTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. declare(strict_types = 1);
  3. namespace Tools\Test\TestCase\Command;
  4. use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
  5. use Cake\TestSuite\TestCase;
  6. use Tools\Command\InflectCommand;
  7. /**
  8. * Tools\Command\InflectCommand Test Case
  9. */
  10. #[\PHPUnit\Framework\Attributes\UsesClass(InflectCommand::class)]
  11. class InflectCommandTest extends TestCase {
  12. use ConsoleIntegrationTestTrait;
  13. /**
  14. * setUp method
  15. *
  16. * @return void
  17. */
  18. public function setUp(): void {
  19. parent::setUp();
  20. $this->loadPlugins(['Tools']);
  21. //$this->useCommandRunner();
  22. }
  23. /**
  24. * Test execute method
  25. *
  26. * @return void
  27. */
  28. public function testExecute(): void {
  29. $this->exec('inflect FooBar all');
  30. $output = $this->_out->messages();
  31. $expected = [
  32. 0 => 'FooBar',
  33. 1 => 'Pluralized form : FooBars',
  34. 2 => 'Singular form : FooBar',
  35. 3 => 'CamelCase form : FooBar',
  36. 4 => 'under_scored_form : foo_bar',
  37. 5 => 'Human Readable Group form : FooBar',
  38. 6 => 'table_names form : foo_bars',
  39. 7 => 'Cake Model Class form : FooBar',
  40. 8 => 'variableForm : fooBar',
  41. 9 => 'Dasherized-form : foo-bar',
  42. ];
  43. $this->assertSame($expected, $output);
  44. }
  45. }