atoum/ruler-extension

--filter + --loop = fail

Hywan opened this issue · 7 comments

Do you reproduce?

@Hywan can you describe the fail you get?

An error in the ruler-extension.

When I take this test (https://gist.github.com/agallou/67835a4181b077e32220) on this gist with the filter I get this error :

Error: Context reference \test1\\ does not exists.

when I launch this command :

./vendor/bin/atoum toto_test.php --loop  --filter "'test1' in tags"

(that works withtout the --loop option)

I will look into it.

The rule seems to be escaped when using the loop option.
Here is it's value without the loop option : 'test1' in tags
And it's value with the loop option : \test1\\ in tags

seems to be a problem in the toString method of the cli class : https://github.com/atoum/atoum/blob/master/classes/cli/command.php#L31

When removing the escaping in vendor/atoum/atoum/classes/cli/command.php

44d43
< 
57c56
<                                       $command .= ' ' . escapeshellarg($value);
---
>                                       $command .= sprintf(' "%s"', $value);
68c67
<                       $command = escapeshellcmd($this->binaryPath . $command);
---
>                       $command = $this->binaryPath . $command;
70d68
< 

the loop mode works in conjuction with the ruler extension.

I'll try to find a better fix.

@agallou Good! Maybe @mageekguy could help on this one?

@Hywan @agallou you should look at this: https://github.com/atoum/atoum/blob/d361021cc7a0448f2e609e2357f668b50d9bd3b8/classes/scripts/runner.php#L1200 and also in the php class which handles launching php commands.