Commit 73106085 authored by ramonornela's avatar ramonornela Committed by Benjamin Eberlei

[FIX] - Portability SQLSERVER

 - name platform 'sqlsrv' nonexistent and E_NOTICE index array.
parent 0087f3fe
......@@ -75,10 +75,10 @@ class Connection extends \Doctrine\DBAL\Connection
$params['portability'] = self::PORTABILITY_DRIZZLE;
} else if ($this->_platform->getName() === 'sqlanywhere') {
$params['portability'] = self::PORTABILITY_SQLANYWHERE;
} else if ($this->_platform->getName() === 'sqlsrv') {
$params['portability'] = $params['portabililty'] & self::PORTABILITY_SQLSRV;
} elseif ($this->_platform->getName() === 'db2') {
$params['portability'] = self::PORTABILITY_DB2;
} else if ($this->_platform->getName() === 'mssql') {
$params['portability'] = $params['portability'] & self::PORTABILITY_SQLSRV;
} else {
$params['portability'] = $params['portability'] & self::PORTABILITY_OTHERVENDORS;
}
......
......@@ -6,6 +6,7 @@ use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use PDO;
use Doctrine\DBAL\Portability\Connection as ConnectionPortability;
require_once __DIR__ . '/../../TestInit.php';
......@@ -124,4 +125,24 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->assertNull($row['test_null']);
$this->assertArrayNotHasKey(0, $row, "PDO::FETCH_ASSOC should not return numerical keys.");
}
public function testPortabilitySqlServer()
{
$portability = ConnectionPortability::PORTABILITY_SQLSRV;
$params = array(
'portability' => $portability
);
$driverMock = $this->getMock('Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Driver', array('connect'));
$driverMock->expects($this->once())
->method('connect')
->will($this->returnValue(null));
$connection = new ConnectionPortability($params, $driverMock);
$connection->connect($params);
$this->assertEquals($portability, $connection->getPortability());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment