File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
tests/Integration/Service/Generator/Definition Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments