lithium\tests\cases\data\ConnectionsTest::testConnectionGetAndReset PHP Method

testConnectionGetAndReset() public method

    public function testConnectionGetAndReset()
    {
        Connections::add('conn-test', $this->config);
        Connections::add('conn-test-2', $this->config);
        $this->assertEqual(array('conn-test', 'conn-test-2'), Connections::get());
        $enabled = MySql::enabled() || PostgreSql::enabled();
        $this->skipIf(!$enabled, 'MySql or PostgreSQL is not enabled');
        if (MySql::enabled()) {
            $this->_port = 3306;
        }
        if (PostgreSql::enabled()) {
            $this->_port = 5432;
        }
        $msg = "Cannot connect to localhost:{$this->_port}";
        $this->skipIf(!$this->_canConnect('localhost', $this->_port), $msg);
        $expected = $this->config + array('type' => 'database', 'filters' => array());
        $this->assertEqual($expected, Connections::get('conn-test', array('config' => true)));
        $this->assertNull(Connections::reset());
        $this->assertEmpty(Connections::get());
        $this->assertInternalType('array', Connections::get());
    }