diff 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
line wrap: on
line diff
--- a/vendor/psy/psysh/test/ShellTest.php	Thu Apr 26 11:26:54 2018 +0100
+++ b/vendor/psy/psysh/test/ShellTest.php	Tue Jul 10 15:07:59 2018 +0100
@@ -380,6 +380,38 @@
         ];
     }
 
+    /**
+     * @dataProvider commandsToHas
+     */
+    public function testHasCommand($command, $has)
+    {
+        $shell = new Shell($this->getConfig());
+
+        // :-/
+        $refl = new \ReflectionClass('Psy\\Shell');
+        $method = $refl->getMethod('hasCommand');
+        $method->setAccessible(true);
+
+        $this->assertEquals($method->invokeArgs($shell, [$command]), $has);
+    }
+
+    public function commandsToHas()
+    {
+        return [
+            ['help', true],
+            ['help help', true],
+            ['"help"', false],
+            ['"help help"', false],
+            ['ls -al ', true],
+            ['ls "-al" ', true],
+            ['ls"-al"', false],
+            [' q', true],
+            ['   q  --help', true],
+            ['"q"', false],
+            ['"q",', false],
+        ];
+    }
+
     private function getOutput()
     {
         $stream = fopen('php://memory', 'w+');