Skip to content

Commit 4853228

Browse files
committed
test fixed.
1 parent b49ad5f commit 4853228

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

tests/Integration/Service/Generator/Definition/IndexDefinitionTest.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ public function testGenerateResultShouldWork(): array
4949
#[Depends('testGenerateResultShouldWork')]
5050
public function testIndexWorks(array $result): void
5151
{
52-
/**
53-
* @var IndexEntity $index
54-
*/
55-
$index = $result[1];
52+
$index = $this->getIndexByName('testi', $result);
5653
$this->assertEquals('index', $index->getType());
5754
$this->assertEquals('testi', $index->getName());
5855
$this->assertEquals(
@@ -69,10 +66,7 @@ public function testIndexWorks(array $result): void
6966
#[Depends('testGenerateResultShouldWork')]
7067
public function testUniqueIndexWorks(array $result): void
7168
{
72-
/**
73-
* @var IndexEntity $index
74-
*/
75-
$index = $result[0];
69+
$index = $this->getIndexByName('fields_test_medium_int_unique', $result);
7670
$this->assertEquals('unique', $index->getType());
7771
$this->assertEquals(
7872
[
@@ -82,5 +76,18 @@ public function testUniqueIndexWorks(array $result): void
8276
);
8377
}
8478

79+
protected function getIndexByName(string $name, array $result): ?IndexEntity
80+
{
81+
$indexResult = null;
82+
foreach ($result as $index) {
83+
if ($index->getName() === $name) {
84+
$indexResult = $index;
85+
break;
86+
}
87+
}
88+
self::assertInstanceOf(IndexEntity::class, $indexResult);
89+
return $indexResult;
90+
}
91+
8592

8693
}

0 commit comments

Comments
 (0)