You've already forked phpmyadmin
mirror of
https://github.com/phpmyadmin/phpmyadmin.git
synced 2026-10-28 07:41:55 +03:00
Add tests for Partition and SubPartition classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
25
test/classes/PartitionTest.php
Normal file
25
test/classes/PartitionTest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\Partition;
|
||||
|
||||
/**
|
||||
* @covers \PhpMyAdmin\Partition
|
||||
*/
|
||||
class PartitionTest extends AbstractTestCase
|
||||
{
|
||||
public function testGetPartitionMethodReturnsNull(): void
|
||||
{
|
||||
$actual = Partition::getPartitionMethod('database', 'no_partition_method');
|
||||
$this->assertNull($actual);
|
||||
}
|
||||
|
||||
public function testGetPartitionMethodWithRangeMethod(): void
|
||||
{
|
||||
$actual = Partition::getPartitionMethod('database', 'range_partition_method');
|
||||
$this->assertEquals('RANGE', $actual);
|
||||
}
|
||||
}
|
||||
39
test/classes/SubPartitionTest.php
Normal file
39
test/classes/SubPartitionTest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\SubPartition;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \PhpMyAdmin\SubPartition
|
||||
*/
|
||||
class SubPartitionTest extends TestCase
|
||||
{
|
||||
public function testSubPartition(): void
|
||||
{
|
||||
$row = [
|
||||
'TABLE_SCHEMA' => '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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user