Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
asika32764 committed Nov 10, 2023
1 parent c618bfe commit ae9cc73
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/database/test/Manager/PostgreSQLTableManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static function (Schema $schema) {
ORDER BY "table_name" ASC;
CREATE TABLE IF NOT EXISTS "enterprise" (
"id" serial NOT NULL,
"type" char(25) NOT NULL DEFAULT '',
"type" varchar(25) NOT NULL DEFAULT '',
"catid" integer DEFAULT NULL,
"alias" varchar(255) NOT NULL DEFAULT '',
"title" varchar(255) NOT NULL DEFAULT 'H',
Expand Down Expand Up @@ -179,7 +179,7 @@ function (Schema $schema) {
ALTER TABLE "enterprise"
ADD COLUMN "first_officer" varchar(512) NOT NULL DEFAULT '';
ALTER TABLE "enterprise"
ALTER COLUMN "alias" TYPE char(25),
ALTER COLUMN "alias" TYPE varchar(25),
ALTER COLUMN "alias" SET NOT NULL,
ALTER COLUMN "alias" SET DEFAULT '';
SELECT "ix".*, tc.constraint_type = 'PRIMARY KEY' AS "is_primary"
Expand Down
18 changes: 16 additions & 2 deletions packages/database/test/Platform/PostgreSQLPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,28 @@ public function testGetViews(): void
{
$views = $this->instance->listViews(static::$schema);

foreach ($views as &$view) {
// Remove prefix since it may different between PostgreSQL versions.
$view['VIEW_DEFINITION'] = str_replace(
'ww_articles.',
'',
$view['VIEW_DEFINITION']
);
}

self::assertEquals(
[
'ww_articles_view' => [
'TABLE_NAME' => 'ww_articles_view',
'TABLE_CATALOG' => 'windwalker_test',
'TABLE_SCHEMA' => 'public',
'TABLE_TYPE' => 'VIEW',
'VIEW_DEFINITION' => Str::replaceCRLF(
' SELECT ww_articles.id,
// Remove prefix since it may different between PostgreSQL versions.
'VIEW_DEFINITION' => str_replace(
'ww_articles.',
'',
Str::replaceCRLF(
' SELECT ww_articles.id,
ww_articles.category_id,
ww_articles.page_id,
ww_articles.type,
Expand All @@ -108,6 +121,7 @@ public function testGetViews(): void
ww_articles.language,
ww_articles.params
FROM ww_articles;'
)
),
'CHECK_OPTION' => 'NONE',
'IS_UPDATABLE' => 'YES',
Expand Down

0 comments on commit ae9cc73

Please sign in to comment.