public denormalize ( Nelmio\Alice\FixtureInterface $scope, Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParserInterface $parser, array $unparsedSpecs ) : |
||
$scope | Nelmio\Alice\FixtureInterface | |
$parser | Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParserInterface | |
$unparsedSpecs | array | |
return |
public function denormalize(FixtureInterface $scope, FlagParserInterface $parser, array $unparsedSpecs) : SpecificationBag
{
$constructor = null;
$properties = new PropertyBag();
$calls = new MethodCallBag();
foreach ($unparsedSpecs as $unparsedPropertyName => $value) {
if ('__construct' === $unparsedPropertyName) {
$constructor = $this->denormalizeConstructor($value, $scope, $parser);
continue;
}
if ('__calls' === $unparsedPropertyName) {
$calls = $this->denormalizeCall($this->callsDenormalizer, $value, $calls, $scope, $parser);
continue;
}
$properties = $this->denormalizeProperty($this->propertyDenormalizer, $parser, $unparsedPropertyName, $value, $properties, $scope);
}
return new SpecificationBag($constructor, $properties, $calls);
}
/** * @expectedException \TypeError * @expectedExceptionMessage Expected method call value to be an array, got "NULL" instead. */ public function testDenormalizeWithInvalidMethodCalls() { $specs = ['__calls' => [null]]; $denormalizer = new SimpleSpecificationsDenormalizer(new FakeConstructorDenormalizer(), new FakePropertyDenormalizer(), new FakeCallsDenormalizer()); $denormalizer->denormalize(new FakeFixture(), new FakeFlagParser(), $specs); }