CodeArgumentTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /*
  3. * This file is part of Psy Shell.
  4. *
  5. * (c) 2012-2017 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\Tests\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 array(
  26. array(InputArgument::IS_ARRAY),
  27. array(InputArgument::IS_ARRAY | InputArgument::REQUIRED),
  28. array(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 array(
  41. array(InputArgument::REQUIRED),
  42. array(InputArgument::OPTIONAL),
  43. );
  44. }
  45. }