public function test_connection_gets_only_resolved_once() { $this->container->shouldReceive('singleton')->once(); $this->registry->addConnection('default'); $this->container->shouldReceive('make')->once()->with('doctrine.connections.default')->andReturn('connection'); $this->registry->getConnection(); $this->registry->getConnection(); $this->registry->getConnection(); $this->registry->getConnection(); $this->registry->getConnection(); $this->assertEquals($this->registry->getConnection('default'), $this->registry->getConnection()); }
/** * Gets the named connection. * * @param string $name The connection name (null for the default one). * @return object * @static */ public static function getConnection($name = null) { return \LaravelDoctrine\ORM\IlluminateRegistry::getConnection($name); }