I am trying to mock an environment to enable slim3 cli interface.
#!/usr/bin/env php
<?php
array_shift($argv);
$pathInfo = implode('/', $argv);
if (empty($pathinfo)) {
$pathinfo = '--help';
}
$config = ['environment'=>\Slim\Http\Environment::mock(['REQUEST_URI' => $pathInfo])];
$app = new \Slim\App($config);
$app->get('test:output',function(){
exit("Arrived!");
});
$app->run();
However when I run the code php bin/run test:example
absolutely nothing happens.
If I trap the request and get the request URI it's returned as "/".
Has anyone else had this problem and got round it?
Thanks in advance