Exemple #1
0
 public function testCollection()
 {
     $mandango = new Mandango($this->metadataFactory, $this->cache);
     $connection = new Connection($this->uri, $this->dbName . '_collection');
     $mandango->setConnection('default', $connection);
     $mandango->setDefaultConnectionName('default');
     $collection = $mandango->getRepository('Model\\Article')->getCollection();
     $this->assertEquals($connection->getDatabase()->selectCollection('articles'), $collection);
     $this->assertSame($collection, $mandango->getRepository('Model\\Article')->getCollection());
 }
Exemple #2
0
 /**
  * @expectedException \RuntimeException
  */
 public function testGetDefaultConnectionNotExist()
 {
     $mandango = new Mandango($this->metadataFactory, $this->cache);
     $mandango->setConnection('default', $this->connection);
     $mandango->getDefaultConnection();
 }
Exemple #3
0
 public function testSetConnectionLoggerCallable()
 {
     $mandango = new Mandango($this->metadataFactory, $this->cache);
     $connection = new Connection($this->server, $this->dbName);
     $mandango->setConnection('default', $connection);
     $this->assertNull($connection->getLoggerCallable());
     $this->assertNull($connection->getLogDefault());
     $mandango = new Mandango($this->metadataFactory, $this->cache, $loggerCallable = function () {
     });
     $connection = new Connection($this->server, $this->dbName);
     $mandango->setConnection('default', $connection);
     $this->assertSame($loggerCallable, $connection->getLoggerCallable());
     $this->assertSame(array('connection' => 'default'), $connection->getLogDefault());
 }