Commit 5c101ae3 by resurtm

Initial MSSQL tests.

parent 58f3c323
......@@ -12,5 +12,11 @@ return array(
'dsn' => 'sqlite::memory:',
'fixture' => __DIR__ . '/sqlite.sql',
),
'sqlsrv' => array(
'dsn' => 'sqlsrv:Server=localhost;Database=test',
'username' => '',
'password' => '',
'fixture' => __DIR__ . '/mssql.sql',
),
)
);
<?php
namespace yiiunit\framework\db\mssql;
class MssqlActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
{
public function setUp()
{
$this->driverName = 'sqlsrv';
parent::setUp();
}
}
<?php
namespace yiiunit\framework\db\mssql;
class MssqlCommandTest extends \yiiunit\framework\db\CommandTest
{
public function setUp()
{
$this->driverName = 'sqlsrv';
parent::setUp();
}
function testAutoQuoting()
{
$db = $this->getConnection(false);
$sql = 'SELECT [[id]], [[t.name]] FROM {{tbl_customer}} t';
$command = $db->createCommand($sql);
$this->assertEquals("SELECT [id], [t].[name] FROM [tbl_customer] t", $command->sql);
}
function testPrepareCancel()
{
$this->markTestIncomplete();
}
function testBindParamValue()
{
$this->markTestIncomplete();
}
}
<?php
namespace yiiunit\framework\db\mssql;
class MssqlConnectionTest extends \yiiunit\framework\db\ConnectionTest
{
public function setUp()
{
$this->driverName = 'sqlsrv';
parent::setUp();
}
function testQuoteValue()
{
$connection = $this->getConnection(false);
$this->assertEquals(123, $connection->quoteValue(123));
$this->assertEquals("'string'", $connection->quoteValue('string'));
$this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting"));
}
function testQuoteTableName()
{
$connection = $this->getConnection(false);
$this->assertEquals('[table]', $connection->quoteTableName('table'));
$this->assertEquals('[table]', $connection->quoteTableName('[table]'));
$this->assertEquals('[schema].[table]', $connection->quoteTableName('schema.table'));
$this->assertEquals('[schema].[table]', $connection->quoteTableName('schema.[table]'));
$this->assertEquals('{{table}}', $connection->quoteTableName('{{table}}'));
$this->assertEquals('(table)', $connection->quoteTableName('(table)'));
}
function testQuoteColumnName()
{
$connection = $this->getConnection(false);
$this->assertEquals('[column]', $connection->quoteColumnName('column'));
$this->assertEquals('[column]', $connection->quoteColumnName('[column]'));
$this->assertEquals('[table].[column]', $connection->quoteColumnName('table.column'));
$this->assertEquals('[table].[column]', $connection->quoteColumnName('table.[column]'));
$this->assertEquals('[[column]]', $connection->quoteColumnName('[[column]]'));
$this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}'));
$this->assertEquals('(column)', $connection->quoteColumnName('(column)'));
}
}
<?php
namespace yiiunit\framework\db\mssql;
class MssqlQueryTest extends \yiiunit\framework\db\QueryTest
{
public function setUp()
{
$this->driverName = 'sqlsrv';
parent::setUp();
}
}
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