Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions tests/TestCase/MigrationsPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,22 @@
namespace Migrations\Test\TestCase;

use Cake\Console\CommandCollection;
use Cake\Core\Configure;
use Cake\TestSuite\TestCase;
use Migrations\Command\MigrationsRollbackCommand;
use Migrations\Command\RollbackCommand;
use Migrations\MigrationsPlugin;

class MigrationsPluginTest extends TestCase
{
/**
* Test that builtin backend uses RollbackCommand
* Test that console() registers the correct RollbackCommand
*/
public function testConsoleBuiltinBackendUsesCorrectRollbackCommand(): void
public function testConsoleUsesCorrectRollbackCommand(): void
{
Configure::write('Migrations.backend', 'builtin');

$plugin = new MigrationsPlugin();
$commands = new CommandCollection();
$commands = $plugin->console($commands);

$this->assertTrue($commands->has('migrations rollback'));
$this->assertSame(RollbackCommand::class, $commands->get('migrations rollback'));
}

/**
* Test that phinx backend uses MigrationsRollbackCommand
*
* This is the reported bug in https://github.com/cakephp/migrations/issues/990
*/
public function testConsolePhinxBackendUsesCorrectRollbackCommand(): void
{
Configure::write('Migrations.backend', 'phinx');

$plugin = new MigrationsPlugin();
$commands = new CommandCollection();
$commands = $plugin->console($commands);

$this->assertTrue($commands->has('migrations rollback'));
// Bug: RollbackCommand is loaded instead of MigrationsRollbackCommand
$this->assertSame(MigrationsRollbackCommand::class, $commands->get('migrations rollback'));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestSnapshotPostgresTimestampTzPgsql extends BaseMigration
* Up Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-up-method
* https://book.cakephp.org/migrations/5/en/migrations.html#the-up-method
*
* @return void
*/
Expand Down Expand Up @@ -47,14 +47,14 @@ public function up(): void
'limit' => null,
'null' => true,
])
->addColumn('created', 'timestamp', [
->addColumn('created', 'timestampfractional', [
'default' => null,
'limit' => null,
'null' => true,
'precision' => 6,
'scale' => 6,
])
->addColumn('modified', 'timestamp', [
->addColumn('modified', 'timestampfractional', [
'default' => null,
'limit' => null,
'null' => true,
Expand Down Expand Up @@ -83,14 +83,14 @@ public function up(): void
'limit' => 100,
'null' => true,
])
->addColumn('created', 'timestamp', [
->addColumn('created', 'timestampfractional', [
'default' => null,
'limit' => null,
'null' => true,
'precision' => 6,
'scale' => 6,
])
->addColumn('modified', 'timestamp', [
->addColumn('modified', 'timestampfractional', [
'default' => null,
'limit' => null,
'null' => true,
Expand Down Expand Up @@ -194,14 +194,14 @@ public function up(): void
'limit' => 10,
'null' => true,
])
->addColumn('created', 'timestamp', [
->addColumn('created', 'timestampfractional', [
'default' => null,
'limit' => null,
'null' => true,
'precision' => 6,
'scale' => 6,
])
->addColumn('modified', 'timestamp', [
->addColumn('modified', 'timestampfractional', [
'default' => null,
'limit' => null,
'null' => true,
Expand Down Expand Up @@ -261,7 +261,7 @@ public function up(): void
'limit' => null,
'null' => true,
])
->addColumn('highlighted_time', 'timestamp', [
->addColumn('highlighted_time', 'timestampfractional', [
'default' => null,
'limit' => null,
'null' => true,
Expand Down Expand Up @@ -299,14 +299,14 @@ public function up(): void
'limit' => 256,
'null' => true,
])
->addColumn('created', 'timestamp', [
->addColumn('created', 'timestampfractional', [
'default' => null,
'limit' => null,
'null' => true,
'precision' => 6,
'scale' => 6,
])
->addColumn('updated', 'timestamp', [
->addColumn('updated', 'timestampfractional', [
'default' => null,
'limit' => null,
'null' => true,
Expand Down Expand Up @@ -359,7 +359,7 @@ public function up(): void
* Down Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-down-method
* https://book.cakephp.org/migrations/5/en/migrations.html#the-down-method
*
* @return void
*/
Expand Down