From a5024edcc5c259fd6d48920e19e0fa4cd7097998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 2 Aug 2022 15:31:41 -0300 Subject: Extract normalization's move repeating group action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- .../Normalization/MoveRepeatingGroupTest.php | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/classes/Controllers/Normalization/MoveRepeatingGroupTest.php (limited to 'test') diff --git a/test/classes/Controllers/Normalization/MoveRepeatingGroupTest.php b/test/classes/Controllers/Normalization/MoveRepeatingGroupTest.php new file mode 100644 index 0000000000..b7ff21a73a --- /dev/null +++ b/test/classes/Controllers/Normalization/MoveRepeatingGroupTest.php @@ -0,0 +1,53 @@ +createDbiDummy(); + $dbiDummy->addSelectDb('test_db'); + $dbiDummy->addResult('CREATE TABLE `new_table` SELECT `id`,`col1`,`col1` as `new_column` FROM `test_table` UNION SELECT `id`,`col1`,`col2` as `new_column` FROM `test_table`', []); + $dbiDummy->addResult('ALTER TABLE `test_table` DROP `col1`, DROP `col2`', []); + // phpcs:enable + + $dbi = $this->createDatabaseInterface($dbiDummy); + $GLOBALS['dbi'] = $dbi; + $response = new ResponseRenderer(); + $template = new Template(); + + $controller = new MoveRepeatingGroup( + $response, + $template, + new Normalization($dbi, new Relation($dbi), new Transformations(), $template) + ); + $controller($this->createStub(ServerRequest::class)); + + $message = Message::success('Selected repeating group has been moved to the table \'test_table\''); + $this->assertSame(['queryError' => false, 'message' => $message->getDisplay()], $response->getJSONResult()); + } +} -- cgit v1.2.3