public function testVariablesInferenceWithCurrent() { $value = new EvaluatedValue('["foo" => $foo, "expression" => $_expression, "scope" => $_scope]'); $fixture = new SimpleFixture('dummy_1', 'Dummy', SpecificationBagFactory::create(), '1'); $set = ResolvedFixtureSetFactory::create(); $scope = ['foo' => 'bar']; $expected = new ResolvedValueWithFixtureSet(['foo' => 'bar', 'expression' => '["foo" => $foo, "expression" => $_expression, "scope" => $_scope]', 'scope' => ['foo' => 'bar', 'current' => '1']], $set); $resolver = new EvaluatedValueResolver(); $actual = $resolver->resolve($value, $fixture, $set, $scope, new GenerationContext()); $this->assertEquals($expected, $actual); $value = new EvaluatedValue('$scope'); try { $resolver->resolve($value, $fixture, $set, $scope, new GenerationContext()); $this->fail('Expected an exception to be thrown.'); } catch (UnresolvableValueException $exception) { $this->assertEquals('Could not evaluate the expression "$scope".', $exception->getMessage()); } }