Open tvl83 opened 10 years ago
After a little more digging I figured out how to get behat-ls
to work. But for windows it's more accurately called behat-dir
instead of the array_search()
we are going to do loop over the $this->output
with a foreach
if it is found in there we flip a bool and if the bool isn't flipped at the end of the loop then we throw the exception.
$found=false;
foreach($this->output as $line)
{
if(strpos($line, $string) !== false)
$found = true;
}
if(!$found)
throw new \Exception(sprintf('Did not see "%s" in the output', $string));
Oh yea, set the $output
as an array
using annotation up top.
/**
* @var array
*/
private $output;
This let's us iterate over the $output variable with foreach. (I don't know if this is absolutely necessary but my IDE (PHPStorm) was yelling at me about it. My scenario is passing now :)
First of all, there isn't a
ls
command in windows, obviously. So I useddir
which is roughly the equivalent (I likels
better).I am in the
FeatureContext.php
file and did avar_dump($this->output)
and this is what I getso the
array_search($string, $this->output)
fails.What can I use to make this pass, if anything?
On a side note: also because I am on windows the
system('rm -r '.realpath('test'));
doesn't work for me so I figured out thatsystem('rd /S /Q '.realpath('test'));
is what needs to be used.