3 declare(strict_types
=1);
5 namespace PhpMyAdmin\Tests
;
7 use PhpMyAdmin\IndexColumn
;
8 use PHPUnit\Framework\TestCase
;
11 * @covers \PhpMyAdmin\IndexColumn
13 class IndexColumnTest
extends TestCase
15 /** @var IndexColumn */
18 protected function setUp(): void
20 $this->object = new IndexColumn();
23 public function testGetNull(): void
25 $this->assertEquals('', $this->object->getNull());
26 $this->assertEquals('No', $this->object->getNull(true));
27 $this->object->set(['Null' => 'YES']);
28 $this->assertEquals('YES', $this->object->getNull());
29 $this->assertEquals('Yes', $this->object->getNull(true));
32 public function testGetSeqInIndex(): void
34 $this->assertEquals(1, $this->object->getSeqInIndex());
35 $this->object->set(['Seq_in_index' => 2]);
36 $this->assertEquals(2, $this->object->getSeqInIndex());
39 public function testGetSubPart(): void
41 $this->assertNull($this->object->getSubPart());
42 $this->object->set(['Sub_part' => 2]);
43 $this->assertEquals(2, $this->object->getSubPart());
46 public function testGetCompareData(): void
49 ['Column_name' => '', 'Seq_in_index' => 1, 'Collation' => null, 'Sub_part' => null, 'Null' => ''],
50 $this->object->getCompareData()
52 $object = new IndexColumn([
53 'Column_name' => 'name',
55 'Collation' => 'collation',
61 'Column_name' => 'name',
63 'Collation' => 'collation',
67 $object->getCompareData()
71 public function testGetName(): void
73 $this->assertEquals('', $this->object->getName());
74 $this->object->set(['Column_name' => 'name']);
75 $this->assertEquals('name', $this->object->getName());
78 public function testGetCardinality(): void
80 $this->assertNull($this->object->getCardinality());
81 $this->object->set(['Cardinality' => 2]);
82 $this->assertEquals(2, $this->object->getCardinality());
85 public function testGetCollation(): void
87 $this->assertNull($this->object->getCollation());
88 $this->object->set(['Collation' => 'collation']);
89 $this->assertEquals('collation', $this->object->getCollation());