-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Expand file tree
/
Copy pathIndexColumnTest.php
More file actions
88 lines (76 loc) · 2.48 KB
/
IndexColumnTest.php
File metadata and controls
88 lines (76 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\IndexColumn;
use PHPUnit\Framework\TestCase;
/**
* @covers \PhpMyAdmin\IndexColumn
*/
class IndexColumnTest extends TestCase
{
/** @var IndexColumn */
private $object;
protected function setUp(): void
{
$this->object = new IndexColumn();
}
public function testGetNull(): void
{
self::assertSame('', $this->object->getNull());
self::assertSame('No', $this->object->getNull(true));
$this->object->set(['Null' => 'YES']);
self::assertSame('YES', $this->object->getNull());
self::assertSame('Yes', $this->object->getNull(true));
}
public function testGetSeqInIndex(): void
{
self::assertSame(1, $this->object->getSeqInIndex());
$this->object->set(['Seq_in_index' => 2]);
self::assertSame(2, $this->object->getSeqInIndex());
}
public function testGetSubPart(): void
{
self::assertNull($this->object->getSubPart());
$this->object->set(['Sub_part' => 2]);
self::assertSame(2, $this->object->getSubPart());
}
public function testGetCompareData(): void
{
self::assertSame(
['Column_name' => '', 'Seq_in_index' => 1, 'Collation' => null, 'Sub_part' => null, 'Null' => ''],
$this->object->getCompareData()
);
$object = new IndexColumn([
'Column_name' => 'name',
'Seq_in_index' => 2,
'Collation' => 'collation',
'Sub_part' => 2,
'Null' => 'NO',
]);
self::assertSame([
'Column_name' => 'name',
'Seq_in_index' => 2,
'Collation' => 'collation',
'Sub_part' => 2,
'Null' => 'NO',
], $object->getCompareData());
}
public function testGetName(): void
{
self::assertSame('', $this->object->getName());
$this->object->set(['Column_name' => 'name']);
self::assertSame('name', $this->object->getName());
}
public function testGetCardinality(): void
{
self::assertNull($this->object->getCardinality());
$this->object->set(['Cardinality' => 2]);
self::assertSame(2, $this->object->getCardinality());
}
public function testGetCollation(): void
{
self::assertNull($this->object->getCollation());
$this->object->set(['Collation' => 'collation']);
self::assertSame('collation', $this->object->getCollation());
}
}