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
89
90
91
|
<?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
{
$this->assertEquals('', $this->object->getNull());
$this->assertEquals('No', $this->object->getNull(true));
$this->object->set(['Null' => 'YES']);
$this->assertEquals('YES', $this->object->getNull());
$this->assertEquals('Yes', $this->object->getNull(true));
}
public function testGetSeqInIndex(): void
{
$this->assertEquals(1, $this->object->getSeqInIndex());
$this->object->set(['Seq_in_index' => 2]);
$this->assertEquals(2, $this->object->getSeqInIndex());
}
public function testGetSubPart(): void
{
$this->assertNull($this->object->getSubPart());
$this->object->set(['Sub_part' => 2]);
$this->assertEquals(2, $this->object->getSubPart());
}
public function testGetCompareData(): void
{
$this->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',
]);
$this->assertSame(
[
'Column_name' => 'name',
'Seq_in_index' => 2,
'Collation' => 'collation',
'Sub_part' => 2,
'Null' => 'NO',
],
$object->getCompareData()
);
}
public function testGetName(): void
{
$this->assertEquals('', $this->object->getName());
$this->object->set(['Column_name' => 'name']);
$this->assertEquals('name', $this->object->getName());
}
public function testGetCardinality(): void
{
$this->assertNull($this->object->getCardinality());
$this->object->set(['Cardinality' => 2]);
$this->assertEquals(2, $this->object->getCardinality());
}
public function testGetCollation(): void
{
$this->assertNull($this->object->getCollation());
$this->object->set(['Collation' => 'collation']);
$this->assertEquals('collation', $this->object->getCollation());
}
}
|