|
|
|
@ -231,8 +231,8 @@ class ContainerTest extends TestCase
|
|
|
|
|
{ |
|
|
|
|
$container = new Container(); |
|
|
|
|
$container->setDefinitions([ |
|
|
|
|
'model.order' => Order::className(), |
|
|
|
|
Cat::className() => Type::className(), |
|
|
|
|
'model.order' => Order::class, |
|
|
|
|
Cat::class => Type::class, |
|
|
|
|
'test\TraversableInterface' => [ |
|
|
|
|
['class' => 'yiiunit\data\base\TraversableObject'], |
|
|
|
|
[['item1', 'item2']] |
|
|
|
@ -243,8 +243,8 @@ class ContainerTest extends TestCase
|
|
|
|
|
]); |
|
|
|
|
$container->setDefinitions([]); |
|
|
|
|
|
|
|
|
|
$this->assertInstanceOf(Order::className(), $container->get('model.order')); |
|
|
|
|
$this->assertInstanceOf(Type::className(), $container->get(Cat::className())); |
|
|
|
|
$this->assertInstanceOf(Order::class, $container->get('model.order')); |
|
|
|
|
$this->assertInstanceOf(Type::class, $container->get(Cat::class)); |
|
|
|
|
|
|
|
|
|
$traversable = $container->get('test\TraversableInterface'); |
|
|
|
|
$this->assertInstanceOf('yiiunit\data\base\TraversableObject', $traversable); |
|
|
|
@ -257,7 +257,7 @@ class ContainerTest extends TestCase
|
|
|
|
|
{ |
|
|
|
|
$container = new Container(); |
|
|
|
|
$container->setSingletons([ |
|
|
|
|
'model.order' => Order::className(), |
|
|
|
|
'model.order' => Order::class, |
|
|
|
|
'test\TraversableInterface' => [ |
|
|
|
|
['class' => 'yiiunit\data\base\TraversableObject'], |
|
|
|
|
[['item1', 'item2']] |
|
|
|
|