Skip to content

Commit

Permalink
fix postgres and sqlserver tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
  • Loading branch information
MasterOdin committed Aug 26, 2020
1 parent d513f16 commit 8528925
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions tests/Phinx/Db/Adapter/PostgresAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1867,12 +1867,12 @@ public function testDumpCreateTable()
$table = new \Phinx\Db\Table('table1', [], $this->adapter);

$table->addColumn('column1', 'string')
->addColumn('column2', 'integer')
->addColumn('column3', 'string', ['default' => 'test'])
->addColumn('column2', 'integer', ['null' => true])
->addColumn('column3', 'string', ['default' => 'test', 'null' => false])
->save();

$expectedOutput = 'CREATE TABLE "public"."table1" ("id" SERIAL NOT NULL, "column1" CHARACTER VARYING (255) ' .
'NOT NULL, "column2" INTEGER NOT NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
'"table1_pkey" PRIMARY KEY ("id"));';
$actualOutput = $consoleOutput->fetch();
$this->assertStringContainsString(
Expand All @@ -1893,12 +1893,12 @@ public function testDumpCreateTableWithSchema()
$table = new \Phinx\Db\Table('schema1.table1', [], $this->adapter);

$table->addColumn('column1', 'string')
->addColumn('column2', 'integer')
->addColumn('column3', 'string', ['default' => 'test'])
->addColumn('column2', 'integer', ['null' => true])
->addColumn('column3', 'string', ['default' => 'test', 'null' => false])
->save();

$expectedOutput = 'CREATE TABLE "schema1"."table1" ("id" SERIAL NOT NULL, "column1" CHARACTER VARYING (255) ' .
'NOT NULL, "column2" INTEGER NOT NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
'"table1_pkey" PRIMARY KEY ("id"));';
$actualOutput = $consoleOutput->fetch();
$this->assertStringContainsString(
Expand Down Expand Up @@ -2010,7 +2010,7 @@ public function testDumpCreateTableAndThenInsert()
$this->adapter->setOutput($consoleOutput);

$table = new \Phinx\Db\Table('schema1.table1', ['id' => false, 'primary_key' => ['column1']], $this->adapter);
$table->addColumn('column1', 'string')
$table->addColumn('column1', 'string', ['null' => false])
->addColumn('column2', 'integer')
->save();

Expand All @@ -2021,7 +2021,7 @@ public function testDumpCreateTableAndThenInsert()
])->save();

$expectedOutput = <<<'OUTPUT'
CREATE TABLE "schema1"."table1" ("column1" CHARACTER VARYING (255) NOT NULL, "column2" INTEGER NOT NULL, CONSTRAINT "table1_pkey" PRIMARY KEY ("column1"));
CREATE TABLE "schema1"."table1" ("column1" CHARACTER VARYING (255) NOT NULL, "column2" INTEGER NULL, CONSTRAINT "table1_pkey" PRIMARY KEY ("column1"));
INSERT INTO "schema1"."table1" ("column1", "column2") VALUES ('id1', 1);
OUTPUT;
$actualOutput = $consoleOutput->fetch();
Expand Down
6 changes: 3 additions & 3 deletions tests/Phinx/Db/Adapter/SqlServerAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public function testChangeColumnType()
public function testChangeColumnNameAndNull()
{
$table = new \Phinx\Db\Table('t', [], $this->adapter);
$table->addColumn('column1', 'string')
$table->addColumn('column1', 'string', ['null' => false])
->save();
$newColumn2 = new \Phinx\Db\Table\Column();
$newColumn2->setName('column2')
Expand Down Expand Up @@ -953,7 +953,7 @@ public function testDumpCreateTableAndThenInsert()

$table = new \Phinx\Db\Table('table1', ['id' => false, 'primary_key' => ['column1']], $this->adapter);

$table->addColumn('column1', 'string')
$table->addColumn('column1', 'string', ['null' => false])
->addColumn('column2', 'integer')
->save();

Expand All @@ -966,7 +966,7 @@ public function testDumpCreateTableAndThenInsert()
])->save();

$expectedOutput = <<<'OUTPUT'
CREATE TABLE [table1] ([column1] NVARCHAR (255) NOT NULL , [column2] INT NOT NULL , CONSTRAINT PK_table1 PRIMARY KEY ([column1]));
CREATE TABLE [table1] ([column1] NVARCHAR (255) NOT NULL , [column2] INT NULL , CONSTRAINT PK_table1 PRIMARY KEY ([column1]));
INSERT INTO [table1] ([column1], [column2]) VALUES ('id1', 1);
OUTPUT;
$actualOutput = str_replace("\r\n", "\n", $consoleOutput->fetch());
Expand Down

0 comments on commit 8528925

Please sign in to comment.