Browse Source

Simplify yield test for `Command::batchInsert()`. (#16007)

tags/3.0.0-alpha1
Robert Korulczyk 7 years ago committed by Alexander Makarov
parent
commit
8a46b33ef7
  1. 14
      tests/framework/db/CommandTest.php
  2. 22
      tests/framework/db/testBatchInsertWithYield.php

14
tests/framework/db/CommandTest.php

@ -307,7 +307,19 @@ SQL;
public function testBatchInsertWithYield()
{
include __DIR__ . '/testBatchInsertWithYield.php';
$rows = call_user_func(function () {
if (false) {
yield [];
}
});
$command = $this->getConnection()->createCommand();
$command->batchInsert(
'{{customer}}',
['email', 'name', 'address'],
$rows
);
$this->assertEquals(0, $command->execute());
}
/**

22
tests/framework/db/testBatchInsertWithYield.php

@ -1,22 +0,0 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/* @var $this \yiiunit\framework\db\CommandTest */
$rows = call_user_func(function () {
if (false) {
yield [];
}
});
$command = $this->getConnection()->createCommand();
$command->batchInsert(
'{{customer}}',
['email', 'name', 'address'],
$rows
);
$this->assertEquals(0, $command->execute());
Loading…
Cancel
Save