Skip to content

Commit ee434a7

Browse files
committed
tests added.
1 parent 103b91d commit ee434a7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/Unit/Generator/Compiler/Mapper/IndexMapperTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77
use N3XT0R\MigrationGenerator\Service\Generator\Compiler\Mapper\IndexMapper;
8+
use N3XT0R\MigrationGenerator\Service\Generator\Definition\Entity\ForeignKeyEntity;
89
use N3XT0R\MigrationGenerator\Service\Generator\Definition\Entity\IndexEntity;
910
use PHPUnit\Framework\TestCase;
1011

@@ -20,12 +21,12 @@ public function setUp(): void
2021

2122
public function testMapWithAnyOtherDataThanIndexShouldNotWork(): void
2223
{
23-
$data = [1, 2, 3];
24+
$data = [new ForeignKeyEntity(), new IndexEntity(), new IndexEntity()];
2425
$this->assertCount(0, $this->mapper->map($data));
2526
}
2627

2728
/**
28-
* @param string $type
29+
* @param string $type
2930
* @testWith ["index"]
3031
* ["unique"]
3132
*/
@@ -39,11 +40,11 @@ public function testMapWithSingleIndexWorks(string $type): void
3940
$result = $this->mapper->map([$index]);
4041
$this->assertCount(1, $result);
4142

42-
$this->assertStringContainsString('$table->' . $index->getType() . '(\'test\', \'testIndex\');', $result[0]);
43+
$this->assertStringContainsString('$table->'.$index->getType().'(\'test\', \'testIndex\');', $result[0]);
4344
}
4445

4546
/**
46-
* @param string $type
47+
* @param string $type
4748
* @testWith ["index"]
4849
* ["unique"]
4950
*/
@@ -58,7 +59,7 @@ public function testMapWithMultipleIndexWorks(string $type): void
5859
$this->assertCount(1, $result);
5960

6061
$this->assertStringContainsString(
61-
'$table->' . $index->getType() . '([\'test\', \'test2\'], \'testIndex2\');',
62+
'$table->'.$index->getType().'([\'test\', \'test2\'], \'testIndex2\');',
6263
$result[0]
6364
);
6465
}

0 commit comments

Comments
 (0)