|
@@ 285-296 (lines=12) @@
|
| 282 |
|
$this->assertEquals($myObject->auto, 'somevalue'); |
| 283 |
|
} |
| 284 |
|
|
| 285 |
|
public function testSettingSpecificProperty() |
| 286 |
|
{ |
| 287 |
|
$injector = new Injector(); |
| 288 |
|
$config = array(AnotherService::class); |
| 289 |
|
$injector->load($config); |
| 290 |
|
$injector->setInjectMapping(TestObject::class, 'sampleService', AnotherService::class); |
| 291 |
|
$testObject = $injector->get(TestObject::class); |
| 292 |
|
|
| 293 |
|
$this->assertInstanceOf( |
| 294 |
|
AnotherService::class, |
| 295 |
|
$testObject->sampleService |
| 296 |
|
); |
| 297 |
|
} |
| 298 |
|
|
| 299 |
|
public function testSettingSpecificMethod() |
|
@@ 299-311 (lines=13) @@
|
| 296 |
|
); |
| 297 |
|
} |
| 298 |
|
|
| 299 |
|
public function testSettingSpecificMethod() |
| 300 |
|
{ |
| 301 |
|
$injector = new Injector(); |
| 302 |
|
$config = array(AnotherService::class); |
| 303 |
|
$injector->load($config); |
| 304 |
|
$injector->setInjectMapping(TestObject::class, 'setSomething', AnotherService::class, 'method'); |
| 305 |
|
|
| 306 |
|
$testObject = $injector->get(TestObject::class); |
| 307 |
|
|
| 308 |
|
$this->assertInstanceOf( |
| 309 |
|
AnotherService::class, |
| 310 |
|
$testObject->sampleService |
| 311 |
|
); |
| 312 |
|
} |
| 313 |
|
|
| 314 |
|
public function testInjectingScopedService() |