Nelmio\Alice\Generator\ObjectGenerator\CompleteObjectGeneratorTest::testUsesDecoratedGeneratorToGenerateTheObjectAndReturnsTheResultIfDoesNotRequireACompleteObject PHP Method

testUsesDecoratedGeneratorToGenerateTheObjectAndReturnsTheResultIfDoesNotRequireACompleteObject() public method

    public function testUsesDecoratedGeneratorToGenerateTheObjectAndReturnsTheResultIfDoesNotRequireACompleteObject()
    {
        $fixture = new SimpleFixture('dummy', 'Dummy', SpecificationBagFactory::create(null, (new PropertyBag())->with(new Property('foo', 'bar'))));
        $set = ResolvedFixtureSetFactory::create(null, (new FixtureBag())->with($fixture));
        $context = new GenerationContext();
        $decoratedGeneratorProphecy = $this->prophesize(ObjectGeneratorInterface::class);
        $decoratedGeneratorProphecy->generate($fixture, $set, $context)->willReturn($expected = (new ObjectBag())->with(new SimpleObject('dummy', new \stdClass())));
        /** @var ObjectGeneratorInterface $decoratedGenerator */
        $decoratedGenerator = $decoratedGeneratorProphecy->reveal();
        $generator = new CompleteObjectGenerator($decoratedGenerator);
        $actual = $generator->generate($fixture, $set, $context);
        $this->assertEquals($expected, $actual);
        $decoratedGeneratorProphecy->generate(Argument::cetera())->shouldHaveBeenCalledTimes(1);
    }