Mercurial > hg > isophonics-drupal-site
comparison vendor/psy/psysh/test/ShellTest.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 5fb285c0d0e3 |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
378 ['"{{return value}}"', '{{return value}}'], | 378 ['"{{return value}}"', '{{return value}}'], |
379 ['1', '1'], | 379 ['1', '1'], |
380 ]; | 380 ]; |
381 } | 381 } |
382 | 382 |
383 /** | |
384 * @dataProvider commandsToHas | |
385 */ | |
386 public function testHasCommand($command, $has) | |
387 { | |
388 $shell = new Shell($this->getConfig()); | |
389 | |
390 // :-/ | |
391 $refl = new \ReflectionClass('Psy\\Shell'); | |
392 $method = $refl->getMethod('hasCommand'); | |
393 $method->setAccessible(true); | |
394 | |
395 $this->assertEquals($method->invokeArgs($shell, [$command]), $has); | |
396 } | |
397 | |
398 public function commandsToHas() | |
399 { | |
400 return [ | |
401 ['help', true], | |
402 ['help help', true], | |
403 ['"help"', false], | |
404 ['"help help"', false], | |
405 ['ls -al ', true], | |
406 ['ls "-al" ', true], | |
407 ['ls"-al"', false], | |
408 [' q', true], | |
409 [' q --help', true], | |
410 ['"q"', false], | |
411 ['"q",', false], | |
412 ]; | |
413 } | |
414 | |
383 private function getOutput() | 415 private function getOutput() |
384 { | 416 { |
385 $stream = fopen('php://memory', 'w+'); | 417 $stream = fopen('php://memory', 'w+'); |
386 $this->streams[] = $stream; | 418 $this->streams[] = $stream; |
387 | 419 |