ManagerTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace League\CLImate\Tests\Argument;
  3. use League\CLImate\Argument\Argument;
  4. use League\CLImate\Argument\Manager;
  5. use PHPUnit\Framework\TestCase;
  6. class ManagerTest extends TestCase
  7. {
  8. private $manager;
  9. public function setUp()
  10. {
  11. $this->manager = new Manager;
  12. }
  13. public function testDefined1()
  14. {
  15. $argument = Argument::createFromArray("test", [
  16. "prefix" => "t",
  17. "longPrefix" => "test",
  18. ]);
  19. $this->manager->add($argument);
  20. $result = $this->manager->defined("test", ["command", "--test"]);
  21. $this->assertTrue($result);
  22. }
  23. public function testDefined2()
  24. {
  25. $result = $this->manager->defined("test");
  26. $this->assertFalse($result);
  27. }
  28. public function testDefined3()
  29. {
  30. $argument = Argument::createFromArray("lorem", [
  31. "prefix" => "l",
  32. "longPrefix" => "Лорем",
  33. ]);
  34. $this->manager->add($argument);
  35. $result = $this->manager->defined("lorem", ["command", "--Лорем"]);
  36. $this->assertTrue($result);
  37. }
  38. }