"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/framework/db/mssql/ActiveRecordTest.php" between
yii2-2.0.36.tar.gz and yii2-2.0.37.tar.gz

About: Yii 2 is a high-performance component-based PHP framework for developing large-scale Web applications (source).

ActiveRecordTest.php  (yii2-2.0.36):ActiveRecordTest.php  (yii2-2.0.37)
<?php <?php
/** /**
* @link http://www.yiiframework.com/ * @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC * @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
namespace yiiunit\framework\db\mssql; namespace yiiunit\framework\db\mssql;
use yiiunit\data\ar\TestTrigger;
use yiiunit\data\ar\TestTriggerAlert;
/** /**
* @group db * @group db
* @group mssql * @group mssql
*/ */
class ActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest class ActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
{ {
public $driverName = 'sqlsrv'; public $driverName = 'sqlsrv';
public function testExplicitPkOnAutoIncrement() public function testExplicitPkOnAutoIncrement()
{ {
$this->markTestSkipped('MSSQL does not support explicit value for an IDE NTITY column.'); $this->markTestSkipped('MSSQL does not support explicit value for an IDE NTITY column.');
} }
/**
* @throws \yii\db\Exception
*/
public function testSaveWithTrigger()
{
$db = $this->getConnection();
// drop trigger if exist
$sql = 'IF (OBJECT_ID(N\'[dbo].[test_alert]\') IS NOT NULL)
BEGIN
DROP TRIGGER [dbo].[test_alert];
END';
$db->createCommand($sql)->execute();
// create trigger
$sql = 'CREATE TRIGGER [dbo].[test_alert] ON [dbo].[test_trigger]
AFTER INSERT
AS
BEGIN
INSERT INTO [dbo].[test_trigger_alert] ( [stringcol] )
SELECT [stringcol]
FROM [inserted]
END';
$db->createCommand($sql)->execute();
$record = new TestTrigger();
$record->stringcol = 'test';
$this->assertTrue($record->save(false));
$this->assertEquals(1, $record->id);
$testRecord = TestTriggerAlert::findOne(1);
$this->assertEquals('test', $testRecord->stringcol);
}
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 37 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)