/**
  * Verify that getManager() returns a new instance after a call to resetManager().
  */
 public function test_get_manager_after_reset_should_return_new_manager()
 {
     $this->container->shouldReceive('singleton');
     $this->registry->addManager('default');
     $this->container->shouldReceive('make')->with('doctrine.managers.default')->andReturn(new stdClass(), new stdClass());
     $first = $this->registry->getManager();
     $this->container->shouldReceive('forgetInstance');
     $this->registry->resetManager();
     $second = $this->registry->getManager();
     $this->assertNotSame($first, $second);
 }
Esempio n. 2
0
 public function test_manager_gets_only_resolved_once()
 {
     $this->container->shouldReceive('singleton')->once();
     $this->registry->addManager('default');
     $this->container->shouldReceive('make')->once()->with('doctrine.managers.default')->andReturn('manager');
     $this->registry->getManager();
     $this->registry->getManager();
     $this->registry->getManager();
     $this->registry->getManager();
     $this->registry->getManager();
     $this->assertEquals($this->registry->getManager('default'), $this->registry->getManager());
 }
Esempio n. 3
0
 /**
  * Gets a named object manager.
  *
  * @param string $name The object manager name (null for the default one).
  * @return \Doctrine\Common\Persistence\ObjectManager 
  * @static 
  */
 public static function getManager($name = null)
 {
     return \LaravelDoctrine\ORM\IlluminateRegistry::getManager($name);
 }