atoum / ruler-extension

The atoum ruler-extension allows you to filter your tests using Hoa\Ruler.
MIT License
9 stars 4 forks source link

--filter + --loop = fail #15

Open Hywan opened 9 years ago

Hywan commented 9 years ago

Do you reproduce?

jubianchi commented 9 years ago

@Hywan can you describe the fail you get?

Hywan commented 9 years ago

An error in the ruler-extension.

agallou commented 9 years ago

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.

agallou commented 9 years ago

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

agallou commented 9 years ago

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.

Hywan commented 9 years ago

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

jubianchi commented 9 years ago

@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.