mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Trim whitespace off names in Injector
This commit is contained in:
parent
16cac4e3bd
commit
3bdc8c7e65
@ -1024,7 +1024,8 @@ class Injector implements ContainerInterface
|
|||||||
$args = $extraArgs;
|
$args = $extraArgs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [ $name, $args ];
|
$name = trim($name);
|
||||||
|
return [$name, $args];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -960,6 +960,13 @@ class InjectorTest extends SapphireTest
|
|||||||
$injector->get('UnknownService');
|
$injector->get('UnknownService');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetTrimsWhitespaceFromNames()
|
||||||
|
{
|
||||||
|
$injector = new Injector;
|
||||||
|
|
||||||
|
$this->assertInstanceOf(MyChildClass::class, $injector->get(' ' . MyChildClass::class . ' '));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test nesting of injector
|
* Test nesting of injector
|
||||||
*/
|
*/
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Core\Tests\Injector\InjectorTest;
|
namespace SilverStripe\Core\Tests\Injector\InjectorTest;
|
||||||
|
|
||||||
use SilverStripe\Core\Tests\Injector\InjectorTest;
|
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
|
||||||
class MyChildClass extends InjectorTest\MyParentClass implements TestOnly
|
class MyChildClass extends MyParentClass implements TestOnly
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Core\Tests\Injector\InjectorTest;
|
namespace SilverStripe\Core\Tests\Injector\InjectorTest;
|
||||||
|
|
||||||
use SilverStripe\Core\Tests\Injector\InjectorTest;
|
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
|
||||||
class MyGrandChildClass extends InjectorTest\MyChildClass implements TestOnly
|
class MyGrandChildClass extends MyChildClass implements TestOnly
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user