Nelmio\Alice\Generator\ResolvedFixtureSet::getParameters PHP Method

getParameters() public method

public getParameters ( ) : ParameterBag
return Nelmio\Alice\ParameterBag
    public function getParameters() : ParameterBag
    {
        return $this->parameters;
    }

Usage Example

Ejemplo n.º 1
0
 public function testResolvesAllArguments()
 {
     $specs = SpecificationBagFactory::create(new SimpleMethodCall('__construct', [$firstArg = new VariableValue('firstArg'), $secondArg = new VariableValue('secondArg')]));
     $resolvedSpecs = $specs->withConstructor(new SimpleMethodCall('__construct', ['resolvedFirstArg', 'resolvedSecondArg']));
     $fixture = new SimpleFixture('dummy', 'stdClass', $specs);
     $set = ResolvedFixtureSetFactory::create();
     $context = new GenerationContext();
     $context->markIsResolvingFixture('foo');
     $expected = ResolvedFixtureSetFactory::create(null, (new FixtureBag())->with($fixture->withSpecs($resolvedSpecs)), new ObjectBag(['dummy' => new \stdClass()]));
     $resolverProphecy = $this->prophesize(ValueResolverInterface::class);
     $setAfterFirstArgResolution = new ResolvedFixtureSet($set->getParameters(), (new FixtureBag())->with(new DummyFixture('dummy')), $set->getObjects());
     $resolverProphecy->resolve($firstArg, $fixture, $set, [], $context)->willReturn(new ResolvedValueWithFixtureSet('resolvedFirstArg', $setAfterFirstArgResolution));
     $setAfterSecondArgResolution = new ResolvedFixtureSet($setAfterFirstArgResolution->getParameters(), (new FixtureBag())->with(new DummyFixture('another_dummy')), $setAfterFirstArgResolution->getObjects());
     $resolverProphecy->resolve($secondArg, $fixture, $setAfterFirstArgResolution, [], $context)->willReturn(new ResolvedValueWithFixtureSet('resolvedSecondArg', $setAfterSecondArgResolution));
     /** @var ValueResolverInterface $resolver */
     $resolver = $resolverProphecy->reveal();
     $fixtureAfterResolution = $fixture->withSpecs($resolvedSpecs);
     $decoratedInstantiatorProphecy = $this->prophesize(InstantiatorInterface::class);
     $decoratedInstantiatorProphecy->instantiate($fixtureAfterResolution, $setAfterSecondArgResolution, $context)->willReturn($expected);
     /** @var InstantiatorInterface $decoratedInstantiator */
     $decoratedInstantiator = $decoratedInstantiatorProphecy->reveal();
     $instantiator = new InstantiatorResolver($decoratedInstantiator, $resolver);
     $actual = $instantiator->instantiate($fixture, $set, $context);
     $this->assertSame($expected, $actual);
     $resolverProphecy->resolve(Argument::cetera())->shouldHaveBeenCalledTimes(2);
     $decoratedInstantiatorProphecy->instantiate(Argument::cetera())->shouldHaveBeenCalledTimes(1);
 }
All Usage Examples Of Nelmio\Alice\Generator\ResolvedFixtureSet::getParameters