I was able to track it down a little more. The problem is not about "subscenarios", but about scenarios in general, when you pass in a Slim variable that has been defined in a table before.
The result is here http://twitpic.com/a7m6l/full
My test wiki page looks like this.
I have a simple !-EchoAndEquality-! class.
{{{class EchoAndEquality
{
public function valueEquals($a, $b)
{
return $a === $b;
}
public function echoValue($x)
{
return $x;
}
} }}}
The class follows this specification and Slim variable assignment works.
!|script|echo and equality |
|ensure |value |b |equals|b|
|reject |value |c |equals|d|
|$x= |echo value|a |
|ensure |value |$x|equals|a|
Scenarios do not work as expected, when Slim variables are passed in as parameters and they are called in a table, after the variable was set the first time.
!|scenario|equality of|first value|and |second value|
|ensure |value |@firstValue|equals|@secondValue|
This works, since $y was not defined in a table before. It would not work for $x passed into the scenario.
!|script |
|$y= |echo value|b |
|equality of|$y |and|b|
This one fails in the scenario in a new table. The direct call without the scenario works.
!|script |
|$y= |echo value|c |
|equality of|$y |and|c |
|ensure |value |$y |equals|c|
Gregor
2009/7/10 Gregor Gramlich <gramlich@...>:
> Hello,
>
> I just switched to the new release and lots of my tests using PhpSlim
> started to fail. They make heavy use of scenarios invoking
> subscenarios.
> The bug seems to be due to a different behaviour of variables within
> subscenarios that are executed in a separate table after the variable
> had been set. So it probably was introduced with the table by table
> execution, but I am pretty sure, that it the fault is not on the Slim
> server side, but on the FitNesse side.
>
> The variable is REPLACED by the assigned value that was made in the
> table before. I put up a simple test.
>
> You can see the result at http://twitpic.com/9w9h2/full
>
> ---
>
> I have a simple !-SetterGetter-! class with a set(string x), get(),
> valueEquals(string x, string y) method.
>
> !|script|setter getter |
> |set |a |
> |check |get |a |
> |ensure |value|b|equals|b|
> |reject |value|c|equals|d|
>
> Scenarios that assign values to variables which are reused in
> subscenarios do not work anymore as expected.
>
> !|scenario |set |value
> |equals get |
> |set |@value
> |
> |$x= |get
> |
> |# |The following line works and uses the correct value of x
> |
> |ensure |value |$x
> |equals |@value |
> |# |But when we do it by a sub scenario, the $x value is not
> passed into it correctly. The last value assigned to $x is used|
> |equality of|$x |and
> |@value |
>
> !|scenario|equality of|first value|and |second value|
> |ensure |value |@firstValue|equals|@secondValue|
>
> The whole table here works.
>
> !|script |
> |start|setter getter|
> |set |a |
> |$x= |get |
> |check|get |$x |
> |check|get |a |
> |set|b|equals get|
>
> This one fails in the subscenario.
>
> !|script |
> |set|c|equals get|
>
> ---
>
> Gregor
>