-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
First of all, there isn't a ls
command in windows, obviously. So I used dir
which is roughly the equivalent (I like ls
better).
I am in the FeatureContext.php
file and did a var_dump($this->output)
and this is what I get
array(11) {
[0] =>
string(32) " Volume in drive C has no label."
[1] =>
string(34) " Volume Serial Number is 1094-4CD1"
[2] =>
string(0) ""
[3] =>
string(78) " Directory of C:\Users\Thomas\PhpstormProjects\symfony\behat-ls\test\test\test"
[4] =>
string(0) ""
[5] =>
string(40) "01/21/2014 07:56 PM <DIR> ."
[6] =>
string(41) "01/21/2014 07:56 PM <DIR> .."
[7] =>
string(46) "01/21/2014 07:56 PM 0 hammond"
[8] =>
string(43) "01/21/2014 07:56 PM 0 john"
[9] =>
string(45) " 2 File(s) 0 bytes"
[10] =>
string(50) " 2 Dir(s) 3,029,737,472 bytes free"
}
so 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 that system('rd /S /Q '.realpath('test'));
is what needs to be used.
Activity
tvl83 commentedon Jan 22, 2014
After a little more digging I figured out how to get
behat-ls
to work. But for windows it's more accurately calledbehat-dir
instead of the
array_search()
we are going to do loop over the$this->output
with aforeach
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.Oh yea, set the
$output
as anarray
using annotation up top.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 :)