Beispiel #1
0
 /**
  * @dataProvider hasDocumentDataProvider
  */
 public function testHasDocument($collection1Data, $collection2Data, $isEquals)
 {
     $clientPool = new ClientPool(array('server1' => array('dsn' => 'someDsn1'), 'server2' => array('dsn' => 'someDsn2')));
     $collection1 = $clientPool->get($collection1Data[0])->getDatabase($collection1Data[1])->getCollection($collection1Data[2]);
     $collection2 = $clientPool->get($collection2Data[0])->getDatabase($collection2Data[1])->getCollection($collection2Data[2]);
     $document = $collection1->createDocument();
     $this->assertEquals($isEquals, $collection2->hasDocument($document));
 }
 public function testGet_DsnNotSpecified()
 {
     $pool = new ClientPool(array('connect1' => array('defaultDatabase' => 'db2', 'mapping' => array('db1' => array('col1' => '\\Sokil\\Mongo\\Collection1', 'col2' => '\\Sokil\\Mongo\\Collection2'), 'db2' => array('col1' => '\\Sokil\\Mongo\\Collection3', 'col2' => '\\Sokil\\Mongo\\Collection4')))));
     $this->assertEquals(Client::DEFAULT_DSN, $pool->get('connect1')->getDsn());
 }