-
-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #226 from kitloong/feature/update
Fix update
- Loading branch information
Showing
30 changed files
with
127 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace KitLoong\MigrationsGenerator\Tests\Unit\Database\Models\PgSQL; | ||
|
||
use KitLoong\MigrationsGenerator\Database\Models\PgSQL\PgSQLColumn; | ||
use KitLoong\MigrationsGenerator\Enum\Migrations\Method\ColumnType; | ||
use KitLoong\MigrationsGenerator\Repositories\PgSQLRepository; | ||
use KitLoong\MigrationsGenerator\Support\CheckLaravelVersion; | ||
use KitLoong\MigrationsGenerator\Tests\TestCase; | ||
use Mockery\MockInterface; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
|
||
class PgSQLColumnTest extends TestCase | ||
{ | ||
use CheckLaravelVersion; | ||
|
||
#[DataProvider('spatialTypeNameProvider')] | ||
public function testSpatialTypeName(string $type): void | ||
{ | ||
$this->mock(PgSQLRepository::class, static function (MockInterface $mock): void { | ||
$mock->shouldReceive('getStoredDefinition'); | ||
}); | ||
|
||
$column = new PgSQLColumn('table', [ | ||
'name' => 'column', | ||
'type_name' => 'geography', | ||
'type' => $type, | ||
'collation' => null, | ||
'nullable' => false, | ||
'default' => null, | ||
'auto_increment' => false, | ||
'comment' => null, | ||
]); | ||
|
||
if ($this->atLeastLaravel11()) { | ||
$this->assertSame(ColumnType::GEOGRAPHY, $column->getType()); | ||
$this->assertSame('point', $column->getSpatialSubType()); | ||
$this->assertSame(4326, $column->getSpatialSrID()); | ||
return; | ||
} | ||
|
||
$this->assertSame(ColumnType::POINT, $column->getType()); | ||
} | ||
|
||
/** | ||
* @return array<string, string[]> | ||
*/ | ||
public static function spatialTypeNameProvider(): array | ||
{ | ||
return [ | ||
'with dot' => ['extensions.geography(Point,4326)'], | ||
'without dot' => ['geography(Point,4326)'], | ||
]; | ||
} | ||
} |
4 changes: 0 additions & 4 deletions
4
...rces/database/migrations/collation/2020_03_21_000000_expected_create_collations_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...database/migrations/collation/2020_03_21_000000_expected_create_user_collations_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...s/resources/database/migrations/foreign/2020_03_21_000000_expected_create_users_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...rces/database/migrations/foreign/2020_03_21_000001_expected_create_user_profile_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...urces/database/migrations/general/2020_03_21_000000_expected_create_all_columns_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...ources/database/migrations/general/2020_03_21_000000_expected_create_increments_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...resources/database/migrations/general/2020_03_21_000000_expected_create_primary_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...urces/database/migrations/general/2020_03_21_000000_expected_create_quoted_name_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...ase/migrations/general/2020_03_21_000000_expected_create_reserved_name_modifier_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...grations/general/2020_03_21_000000_expected_create_reserved_name_with_precision_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...ources/database/migrations/general/2020_03_21_000000_expected_create_test_index_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...ources/database/migrations/general/2020_03_21_000000_expected_create_timestamps_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...s/resources/database/migrations/general/2020_03_21_000000_expected_create_users_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...tabase/migrations/general/2020_03_21_000001_expected_create_quoted_name_foreign_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...ources/database/migrations/general/2020_03_21_000001_expected_create_quoted_name_proc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...ources/database/migrations/general/2020_03_21_000001_expected_create_quoted_name_view.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.