コード例 #1
0
ファイル: ParametersTest.php プロジェクト: phellow/cli
 /**
  * @depends testParse
  */
 public function testArgs()
 {
     $params = new Parameters();
     $_SERVER['argv'] = array('file.php', 'one', 'two');
     $params->parse();
     $this->assertEquals('one', $params->get(0));
     $this->assertEquals('two', $params->get(1));
     $this->assertNull($params->get(2));
     $params->argumentStartIndex = 1;
     $params->parse();
     $this->assertEquals('two', $params->get(0));
     $this->assertNull($params->get(1));
     $params->argumentStartIndex = 0;
     $params->registerArgument('first');
     $params->parse();
     $this->assertEquals('one', $params->get('first'));
     $this->assertEquals('two', $params->get(0));
     $this->assertNull($params->get(1));
     $params->argumentStartIndex = 1;
     $params->parse();
     $this->assertEquals('two', $params->get('first'));
     $this->assertNull($params->get(0));
 }