mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #7439 from creative-commoners/pulls/4.0/trim-injector-names
FIX Trim whitespace off names in Injector
This commit is contained in:
commit
313f8c7ac3
@ -1010,7 +1010,8 @@ class Injector implements ContainerInterface
|
||||
$args = $extraArgs;
|
||||
}
|
||||
}
|
||||
return [ $name, $args ];
|
||||
$name = trim($name);
|
||||
return [$name, $args];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -960,6 +960,13 @@ class InjectorTest extends SapphireTest
|
||||
$injector->get('UnknownService');
|
||||
}
|
||||
|
||||
public function testGetTrimsWhitespaceFromNames()
|
||||
{
|
||||
$injector = new Injector;
|
||||
|
||||
$this->assertInstanceOf(MyChildClass::class, $injector->get(' ' . MyChildClass::class . ' '));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test nesting of injector
|
||||
*/
|
||||
|
@ -2,10 +2,9 @@
|
||||
|
||||
namespace SilverStripe\Core\Tests\Injector\InjectorTest;
|
||||
|
||||
use SilverStripe\Core\Tests\Injector\InjectorTest;
|
||||
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;
|
||||
|
||||
use SilverStripe\Core\Tests\Injector\InjectorTest;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class MyGrandChildClass extends InjectorTest\MyChildClass implements TestOnly
|
||||
class MyGrandChildClass extends MyChildClass implements TestOnly
|
||||
{
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user