2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Core\Tests\Injector\InjectorTest;
|
|
|
|
|
|
|
|
use SilverStripe\Core\Injector\SilverStripeServiceConfigurationLocator;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
|
|
|
|
class InjectorTestConfigLocator extends SilverStripeServiceConfigurationLocator implements TestOnly
|
|
|
|
{
|
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
protected function configFor($name)
|
|
|
|
{
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
switch ($name) {
|
|
|
|
case TestObject::class:
|
2020-04-20 19:58:09 +02:00
|
|
|
return $this->configs[$name] = [
|
2016-12-16 05:34:21 +01:00
|
|
|
'class' => ConstructableObject::class,
|
2020-04-20 19:58:09 +02:00
|
|
|
'constructor' => [
|
2018-01-16 19:39:30 +01:00
|
|
|
'%$' . OtherTestObject::class
|
2020-04-20 19:58:09 +02:00
|
|
|
]
|
|
|
|
];
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
case 'ConfigConstructor':
|
2020-04-20 19:58:09 +02:00
|
|
|
return $this->configs[$name] = [
|
2016-12-16 05:34:21 +01:00
|
|
|
'class' => ConstructableObject::class,
|
2020-04-20 19:58:09 +02:00
|
|
|
'constructor' => ['value']
|
|
|
|
];
|
2016-12-16 05:34:21 +01:00
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
return parent::configFor($name);
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|