Пример #1
0
 /**
  * @param Builder $builder
  * @dataProvider containerBuilderProvider
  */
 public function testClosureScalarReturnTypeDeclaration(Builder $builder)
 {
     $builder->define()->name('foo')->using(static function () : string {
         return 'bar';
     })->build();
     $container = $builder->build();
     $this->assertSame('bar', $container->get('foo'));
 }
Пример #2
0
 /**
  * @param Builder $builder
  * @dataProvider containerBuilderProvider
  */
 public function testInjectionPointWithoutFactoryThrowsException(Builder $builder)
 {
     $this->setExpectedException(Exception\DomainException::class);
     $builder->define(Fixture\InjectionPointChild::class)->using(static function (InjectionPoint $point) {
         return new InjectionPointChild($point->class . '::' . $point->method);
     })->build();
     $builder->addInterface(Fixture\InjectionPointChildAwareInterface::class);
     $builder->define(Fixture\InjectionPointParent::class)->build();
     $container = $builder->build();
 }
Пример #3
0
 public function testInvalidModule()
 {
     $this->setExpectedException(Exception\DomainException::class);
     $builder = new ContainerBuilder();
     $builder->addModule(\ArrayObject::class);
     $builder->build();
 }