Пример #1
0
 /**
  * Method to test protect().
  *
  * @return void
  *
  * @expectedException \OutOfBoundsException
  *
  * @covers Windwalker\DI\Container::protect
  */
 public function testProtect()
 {
     $container = new Container();
     // Share, Protect
     $container->protect('olive', function () {
         return new \SplStack();
     }, true);
     $this->assertInstanceOf('SplStack', $container->get('olive'));
     $container->set('olive', function () {
         return new \SplQueue();
     }, true, false);
     // Should not be override
     $this->assertInstanceOf('SplStack', $container->get('olive'));
 }