From dcfcaf4175b3a0626b2b9fca55153d1684162136 Mon Sep 17 00:00:00 2001 From: Veselov Pavel Date: Fri, 23 Aug 2019 20:07:24 +0300 Subject: [PATCH] revert laravel assertions --- src/Helpers/ColumnAssertions.php | 8 +++++++- tests/Functional/Schema/CreateTableTest.php | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Helpers/ColumnAssertions.php b/src/Helpers/ColumnAssertions.php index 9bbad4c..e586d19 100644 --- a/src/Helpers/ColumnAssertions.php +++ b/src/Helpers/ColumnAssertions.php @@ -5,6 +5,7 @@ namespace Umbrellio\Postgres\Helpers; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Schema; use PHPUnit\Framework\TestCase; /** @@ -34,7 +35,12 @@ protected function assertDefaultOnColumn(string $table, string $column, ?string $this->assertSame($expected, $defaultValue); } - protected function assertTypeColumn(string $table, string $column, string $expected): void + protected function assertLaravelTypeColumn(string $table, string $column, string $expected): void + { + $this->assertSame($expected, Schema::getColumnType($table, $column)); + } + + protected function assertPostgresTypeColumn(string $table, string $column, string $expected): void { $this->assertSame($expected, $this->getTypeListing($table, $column)); } diff --git a/tests/Functional/Schema/CreateTableTest.php b/tests/Functional/Schema/CreateTableTest.php index 1c83f97..af97d69 100644 --- a/tests/Functional/Schema/CreateTableTest.php +++ b/tests/Functional/Schema/CreateTableTest.php @@ -40,8 +40,9 @@ public function columnAssertions(): void $this->assertSameTable(['id', 'name', 'field_comment', 'field_default'], 'test_table'); - $this->assertTypeColumn('test_table', 'id', 'integer'); - $this->assertTypeColumn('test_table', 'name', 'character varying'); + $this->assertPostgresTypeColumn('test_table', 'id', 'integer'); + $this->assertLaravelTypeColumn('test_table', 'name', 'string'); + $this->assertPostgresTypeColumn('test_table', 'name', 'character varying'); $this->assertDefaultOnColumn('test_table', 'field_default', '123'); $this->assertCommentOnColumn('test_table', 'field_comment', 'test');