@@ 18-29 (lines=12) @@ | ||
15 | * @param string|null $constraint |
|
16 | * @param string $expected |
|
17 | */ |
|
18 | public function testParse($type, $text, $constraint, $expected) |
|
19 | { |
|
20 | $stream = $this->makeStream($text); |
|
21 | ||
22 | $index = new IndexDefinition(); |
|
23 | $index->parse($stream, $type, $constraint); |
|
24 | if (is_null($index->name)) { |
|
25 | $index->name = 'k1'; |
|
26 | } |
|
27 | ||
28 | $this->assertSame($expected, $index->toString()); |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * @return array |
|
@@ 146-158 (lines=13) @@ | ||
143 | * @param string $text |
|
144 | * @param array $expected |
|
145 | */ |
|
146 | public function testCovers($text, array $expected) |
|
147 | { |
|
148 | $stream = $this->makeStream($text); |
|
149 | ||
150 | $index = new IndexDefinition(); |
|
151 | $index->parse($stream, 'KEY'); |
|
152 | $covers = $index->getCovers(); |
|
153 | ||
154 | sort($expected); |
|
155 | sort($covers); |
|
156 | ||
157 | $this->assertSame($covers, $expected); |
|
158 | } |
|
159 | ||
160 | /** |
|
161 | * @return array |