From 7e589686da076bd801368698dbe688f64beebe2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Thu, 10 Jun 2021 18:54:43 -0300 Subject: [PATCH] Add tests for Partition and SubPartition classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- test/classes/PartitionTest.php | 25 ++++++++++++++++++++ test/classes/SubPartitionTest.php | 39 +++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 test/classes/PartitionTest.php create mode 100644 test/classes/SubPartitionTest.php diff --git a/test/classes/PartitionTest.php b/test/classes/PartitionTest.php new file mode 100644 index 0000000000..46bca5cf74 --- /dev/null +++ b/test/classes/PartitionTest.php @@ -0,0 +1,25 @@ +assertNull($actual); + } + + public function testGetPartitionMethodWithRangeMethod(): void + { + $actual = Partition::getPartitionMethod('database', 'range_partition_method'); + $this->assertEquals('RANGE', $actual); + } +} diff --git a/test/classes/SubPartitionTest.php b/test/classes/SubPartitionTest.php new file mode 100644 index 0000000000..5770004478 --- /dev/null +++ b/test/classes/SubPartitionTest.php @@ -0,0 +1,39 @@ + 'TABLE_SCHEMA', + 'TABLE_NAME' => 'TABLE_NAME', + 'SUBPARTITION_NAME' => 'subpartition_name', + 'SUBPARTITION_ORDINAL_POSITION' => 1, + 'SUBPARTITION_METHOD' => 'subpartition_method', + 'SUBPARTITION_EXPRESSION' => 'subpartition_expression', + 'TABLE_ROWS' => 2, + 'DATA_LENGTH' => 3, + 'INDEX_LENGTH' => 4, + 'PARTITION_COMMENT' => 'partition_comment', + ]; + $object = new SubPartition($row); + $this->assertEquals('subpartition_name', $object->getName()); + $this->assertEquals(1, $object->getOrdinal()); + $this->assertEquals('subpartition_method', $object->getMethod()); + $this->assertEquals('subpartition_expression', $object->getExpression()); + $this->assertEquals(2, $object->getRows()); + $this->assertEquals(3, $object->getDataLength()); + $this->assertEquals(4, $object->getIndexLength()); + $this->assertEquals('partition_comment', $object->getComment()); + } +}