initialize() публичный Метод

This method will dispatch preConnect and postConnect events.
public initialize ( )
Пример #1
0
 public function testInitialize()
 {
     $conn = new Connection();
     $this->assertNull($conn->getMongo());
     $conn->initialize();
     $this->assertInstanceOf('Mongo', $conn->getMongo());
 }
Пример #2
0
 public function testEventArgsNamespaceTest()
 {
     $listener = new ListenerStub();
     $manager = new EventManager();
     $manager->addEventListener(\Doctrine\MongoDB\Events::preConnect, $listener);
     $connection = new Connection(null, [], null, $manager);
     $connection->initialize();
 }
Пример #3
0
 public function testInitializeMongoClient()
 {
     if (version_compare(phpversion('mongo'), '1.3.0', '<')) {
         $this->markTestSkipped('This test is not applicable to driver versions < 1.3.0');
     }
     $conn = new Connection();
     $this->assertNull($conn->getMongo());
     $conn->initialize();
     $this->assertInstanceOf('MongoClient', $conn->getMongo());
 }
Пример #4
0
 public function testConnectTimeoutOptionIsConverted()
 {
     if (version_compare(phpversion('mongo'), '1.4.0', '<')) {
         $this->markTestSkipped('This test is not applicable to driver versions < 1.4.0');
     }
     /* Since initialize() creates MongoClient directly, we cannot examine
      * the options passed to its constructor.
      *
      * Note: we do not test "wTimeout" conversion, since the driver does not
      * raise a deprecation notice for its usage (see: PHP-1079).
      */
     $conn = new Connection(null, array('timeout' => 10000));
     $conn->initialize();
 }
Пример #5
0
 public function testConnectTimeoutOptionIsConverted()
 {
     /* Since initialize() creates MongoClient directly, we cannot examine
      * the options passed to its constructor.
      *
      * Note: we do not test "wTimeout" conversion, since the driver does not
      * raise a deprecation notice for its usage (see: PHP-1079).
      */
     $conn = new Connection(null, ['timeout' => 10000]);
     $conn->initialize();
 }