Exemplo n.º 1
0
 /** @test */
 public function TestParseCommandArgs()
 {
     /*//
     	test that passing command arrays in the same format as they come from
     	_SERVER['argv'] parse as expected.
     	//*/
     $data = Nether\Console\Client::ParseCommandArgs(['one', 'two', '--three', '--four=true', 'five', '--six=end of test', '-zomg', '-lmao=ayy']);
     // note, -m and -o appear twice in this dataset.
     $this->AssertTrue(count($data['Inputs']) === 3, 'test parsed the right number of inputs');
     $this->AssertTrue($data['Inputs'][0] === 'one');
     $this->AssertTrue($data['Inputs'][1] === 'two');
     $this->AssertTrue($data['Inputs'][2] === 'five');
     $this->AssertTrue(count($data['Options']) === 9, 'test parsed right number of options');
     $this->AssertTrue($data['Options']['three'] === true);
     $this->AssertTrue($data['Options']['four'] === 'true');
     $this->AssertTrue($data['Options']['six'] === 'end of test');
     $this->AssertTrue($data['Options']['z'] === true);
     $this->AssertTrue($data['Options']['g'] === true);
     $this->AssertTrue($data['Options']['l'] === true);
     $this->AssertTrue($data['Options']['m'] === true);
     $this->AssertTrue($data['Options']['a'] === true);
     $this->AssertTrue($data['Options']['o'] === 'ayy');
     return;
 }