|
@@ 52-66 (lines=15) @@
|
| 49 |
|
$this->assertTrue($this->definitionAnalyzer->shouldDefinitionBeAutowired(new ContainerBuilder(), $definition)); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
public function testServiceFactoryMethodDoesNotHaveArguments() |
| 53 |
|
{ |
| 54 |
|
$containerBuilder = new ContainerBuilder(); |
| 55 |
|
$containerBuilder->addDefinitions([ |
| 56 |
|
'factory' => new Definition(EmptyConstructorFactory::class), |
| 57 |
|
]); |
| 58 |
|
|
| 59 |
|
$definition = new Definition(EmptyConstructor::class); |
| 60 |
|
$definition->setFactory([ |
| 61 |
|
new Reference('factory'), |
| 62 |
|
'create', |
| 63 |
|
]); |
| 64 |
|
|
| 65 |
|
$this->assertFalse($this->definitionAnalyzer->shouldDefinitionBeAutowired($containerBuilder, $definition)); |
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
public function testFactoryMethodDoesNotHaveArguments() |
| 69 |
|
{ |
|
@@ 79-95 (lines=17) @@
|
| 76 |
|
$this->assertFalse($this->definitionAnalyzer->shouldDefinitionBeAutowired(new ContainerBuilder(), $definition)); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
public function testServiceFactoryBuiltClassHaveMissingArgumentsTypehints() |
| 80 |
|
{ |
| 81 |
|
$containerBuilder = new ContainerBuilder(); |
| 82 |
|
$containerBuilder->addDefinitions([ |
| 83 |
|
'factory' => new Definition(MissingArgumentsTypehintsFactory::class), |
| 84 |
|
]); |
| 85 |
|
|
| 86 |
|
$definition = new Definition(MissingArgumentsTypehints::class); |
| 87 |
|
$definition->setFactory([ |
| 88 |
|
new Reference('factory'), |
| 89 |
|
'create', |
| 90 |
|
]); |
| 91 |
|
|
| 92 |
|
$definition->setArguments(['@someService']); |
| 93 |
|
|
| 94 |
|
$this->assertFalse($this->definitionAnalyzer->shouldDefinitionBeAutowired($containerBuilder, $definition)); |
| 95 |
|
} |
| 96 |
|
|
| 97 |
|
public function testFactoryBuiltClassHaveMissingArgumentsTypehints() |
| 98 |
|
{ |
|
@@ 110-126 (lines=17) @@
|
| 107 |
|
$this->assertFalse($this->definitionAnalyzer->shouldDefinitionBeAutowired(new ContainerBuilder(), $definition)); |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
public function testServiceFactoryBuiltClassHaveNotMissingArgumentsTypehints() |
| 111 |
|
{ |
| 112 |
|
$containerBuilder = new ContainerBuilder(); |
| 113 |
|
$containerBuilder->addDefinitions([ |
| 114 |
|
'factory' => new Definition(NotMissingArgumentsTypehintsFactory::class), |
| 115 |
|
]); |
| 116 |
|
|
| 117 |
|
$definition = new Definition(NotMissingArgumentsTypehints::class); |
| 118 |
|
$definition->setFactory([ |
| 119 |
|
new Reference('factory'), |
| 120 |
|
'create', |
| 121 |
|
]); |
| 122 |
|
|
| 123 |
|
$definition->setArguments(['@someService']); |
| 124 |
|
|
| 125 |
|
$this->assertTrue($this->definitionAnalyzer->shouldDefinitionBeAutowired($containerBuilder, $definition)); |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
public function testFactoryBuiltClassHaveNotMissingArgumentsTypehints() |
| 129 |
|
{ |