CodeArgumentTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. * This file is part of Psy Shell.
  4. *
  5. * (c) 2012-2023 Justin Hileman
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Psy\Test\Input;
  11. use Psy\Input\CodeArgument;
  12. use Symfony\Component\Console\Input\InputArgument;
  13. /**
  14. * @group isolation-fail
  15. */
  16. class CodeArgumentTest extends \Psy\Test\TestCase
  17. {
  18. /**
  19. * @dataProvider getInvalidModes
  20. */
  21. public function testInvalidModes($mode)
  22. {
  23. $this->expectException(\InvalidArgumentException::class);
  24. new CodeArgument('wat', $mode);
  25. $this->fail();
  26. }
  27. public function getInvalidModes()
  28. {
  29. return [
  30. [InputArgument::IS_ARRAY],
  31. [InputArgument::IS_ARRAY | InputArgument::REQUIRED],
  32. [InputArgument::IS_ARRAY | InputArgument::OPTIONAL],
  33. ];
  34. }
  35. /**
  36. * @dataProvider getValidModes
  37. */
  38. public function testValidModes($mode)
  39. {
  40. $this->assertInstanceOf(CodeArgument::class, new CodeArgument('yeah', $mode));
  41. }
  42. public function getValidModes()
  43. {
  44. return [
  45. [InputArgument::REQUIRED],
  46. [InputArgument::OPTIONAL],
  47. ];
  48. }
  49. }