ArgumentsTest.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * CakePHP(tm) : 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(tm) Project
  12. * @since 3.6.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Test\TestSuite\Console;
  16. use Cake\Console\Arguments;
  17. use Cake\TestSuite\TestCase;
  18. /**
  19. * Arguments test case.
  20. */
  21. class ArgumentsTest extends TestCase
  22. {
  23. /**
  24. * Get all arguments
  25. *
  26. * @return void
  27. */
  28. public function testGetArguments()
  29. {
  30. $values = ['big', 'brown', 'bear'];
  31. $args = new Arguments($values, []);
  32. $this->assertSame($values, $args->getArguments());
  33. }
  34. /**
  35. * Get arguments by index
  36. *
  37. * @return void
  38. */
  39. public function testGetArgumentAt()
  40. {
  41. $values = ['big', 'brown', 'bear'];
  42. $args = new Arguments($values, []);
  43. $this->assertSame($values[0], $args->getArgumentAt(0));
  44. $this->assertSame($values[1], $args->getArgumentAt(1));
  45. $this->assertNull($args->getArgumentAt(3));
  46. }
  47. /**
  48. * check arguments by index
  49. *
  50. * @return void
  51. */
  52. public function testHasArgumentAt()
  53. {
  54. $values = ['big', 'brown', 'bear'];
  55. $args = new Arguments($values, []);
  56. $this->assertTrue($args->hasArgumentAt(0));
  57. $this->assertTrue($args->hasArgumentAt(1));
  58. $this->assertFalse($args->hasArgumentAt(3));
  59. }
  60. }