暫無描述

CodeArgumentTest.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /*
  3. * This file is part of Psy Shell.
  4. *
  5. * (c) 2012-2018 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. class CodeArgumentTest extends \PHPUnit\Framework\TestCase
  14. {
  15. /**
  16. * @dataProvider getInvalidModes
  17. * @expectedException \InvalidArgumentException
  18. */
  19. public function testInvalidModes($mode)
  20. {
  21. new CodeArgument('wat', $mode);
  22. }
  23. public function getInvalidModes()
  24. {
  25. return [
  26. [InputArgument::IS_ARRAY],
  27. [InputArgument::IS_ARRAY | InputArgument::REQUIRED],
  28. [InputArgument::IS_ARRAY | InputArgument::OPTIONAL],
  29. ];
  30. }
  31. /**
  32. * @dataProvider getValidModes
  33. */
  34. public function testValidModes($mode)
  35. {
  36. $this->assertInstanceOf('Psy\Input\CodeArgument', new CodeArgument('yeah', $mode));
  37. }
  38. public function getValidModes()
  39. {
  40. return [
  41. [InputArgument::REQUIRED],
  42. [InputArgument::OPTIONAL],
  43. ];
  44. }
  45. }