From 8a46b33ef7ab736c550619f18220400027a9dcf3 Mon Sep 17 00:00:00 2001 From: Robert Korulczyk Date: Fri, 30 Mar 2018 00:45:45 +0200 Subject: [PATCH] Simplify yield test for `Command::batchInsert()`. (#16007) --- tests/framework/db/CommandTest.php | 14 +++++++++++++- tests/framework/db/testBatchInsertWithYield.php | 22 ---------------------- 2 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 tests/framework/db/testBatchInsertWithYield.php diff --git a/tests/framework/db/CommandTest.php b/tests/framework/db/CommandTest.php index 3fe73f0..cf1f325 100644 --- a/tests/framework/db/CommandTest.php +++ b/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()); } /** diff --git a/tests/framework/db/testBatchInsertWithYield.php b/tests/framework/db/testBatchInsertWithYield.php deleted file mode 100644 index d9efb40..0000000 --- a/tests/framework/db/testBatchInsertWithYield.php +++ /dev/null @@ -1,22 +0,0 @@ -getConnection()->createCommand(); -$command->batchInsert( - '{{customer}}', - ['email', 'name', 'address'], - $rows -); -$this->assertEquals(0, $command->execute());