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:
|
2017-02-22 04:15:08 +01:00
|
|
|
return $this->configs[$name] = array(
|
2016-12-16 05:34:21 +01:00
|
|
|
'class' => ConstructableObject::class,
|
|
|
|
'constructor' => array(
|
|
|
|
'%$'.OtherTestObject::class
|
|
|
|
)
|
|
|
|
);
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
case 'ConfigConstructor':
|
2017-02-22 04:15:08 +01:00
|
|
|
return $this->configs[$name] = array(
|
2016-12-16 05:34:21 +01:00
|
|
|
'class' => ConstructableObject::class,
|
|
|
|
'constructor' => array('value')
|
|
|
|
);
|
|
|
|
}
|
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
|
|
|
}
|