You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
<?php |
|
/** |
|
* @link http://www.yiiframework.com/ |
|
* @copyright Copyright (c) 2008 Yii Software LLC |
|
* @license http://www.yiiframework.com/license/ |
|
*/ |
|
|
|
namespace yiiunit\framework\db\mssql; |
|
|
|
use yii\db\Query; |
|
|
|
/** |
|
* @group db |
|
* @group mssql |
|
*/ |
|
class QueryTest extends \yiiunit\framework\db\QueryTest |
|
{ |
|
protected $driverName = 'sqlsrv'; |
|
|
|
public function testUnion() |
|
{ |
|
$connection = $this->getConnection(); |
|
|
|
// MSSQL supports limit only in sub queries with UNION |
|
$query = (new Query()) |
|
->select(['id', 'name']) |
|
->from( |
|
(new Query()) |
|
->select(['id', 'name']) |
|
->from('item') |
|
->limit(2) |
|
) |
|
->union( |
|
(new Query()) |
|
->select(['id', 'name']) |
|
->from( |
|
(new Query()) |
|
->select(['id', 'name']) |
|
->from(['category']) |
|
->limit(2) |
|
) |
|
); |
|
|
|
$result = $query->all($connection); |
|
$this->assertNotEmpty($result); |
|
$this->assertCount(4, $result); |
|
} |
|
}
|
|
|