public resolve ( Nelmio\Alice\Definition\ValueInterface $value, Nelmio\Alice\FixtureInterface $fixture, |
||
$value | Nelmio\Alice\Definition\ValueInterface | |
$fixture | Nelmio\Alice\FixtureInterface | |
$fixtureSet | ||
$scope | array | |
$context | ||
리턴 |
public function resolve(ValueInterface $value, FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, array $scope, GenerationContext $context) : ResolvedValueWithFixtureSet
{
$parameterKey = $value->getValue();
$parameters = $fixtureSet->getParameters();
if (false === $parameters->has($parameterKey)) {
throw UnresolvableValueExceptionFactory::createForCouldNotFindParameter($parameterKey);
}
return new ResolvedValueWithFixtureSet($parameters->get($parameterKey), $fixtureSet);
}
/** * @expectedException \Nelmio\Alice\Throwable\Exception\Generator\Resolver\UnresolvableValueException * @expectedExceptionMessage Could not find the parameter "foo". */ public function testThrowsAnExceptionIfTheVariableCannotBeFoundInTheScope() { $value = new ParameterValue('foo'); $set = ResolvedFixtureSetFactory::create(); $resolver = new ParameterValueResolver(); $resolver->resolve($value, new FakeFixture(), $set, [], new GenerationContext()); }