Jsor\Doctrine\PostGIS\Event\DBALSchemaEventSubscriberTest::testSubscriberThrowsWhenRegisteredOnMultipleConnections PHP Метод

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

    public function testSubscriberThrowsWhenRegisteredOnMultipleConnections()
    {
        $this->setExpectedException('\\LogicException', 'It looks like you have registered the Jsor\\Doctrine\\PostGIS\\Event\\DBALSchemaEventSubscriber to more than one connection. Please register one instance per connection.');
        $subscriber = new DBALSchemaEventSubscriber();
        $conn1 = DriverManager::getConnection($this->_getDbParams());
        $conn1->getEventManager()->addEventSubscriber($subscriber);
        $conn2 = DriverManager::getConnection($this->_getDbParams());
        $conn2->getEventManager()->addEventSubscriber($subscriber);
        $conn1->connect();
        $conn2->connect();
    }