From 234598f1d098418f1ee1baadbb39979ea84f1eb2 Mon Sep 17 00:00:00 2001 From: Ronen Lubin <63970571+ronenlu@users.noreply.github.com> Date: Wed, 27 Mar 2024 16:07:17 +0200 Subject: [PATCH] rename atlas:dump-sql cmd to atlas:schema (#26) --- README.md | 4 ++-- src/Command.php | 2 +- tests/BundleTest.php | 8 ++++---- tests/CommandTest.php | 6 +++--- tests/atlas.hcl | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 11d968d..41bcb53 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ data "external_schema" "doctrine" { program = [ "php", "bin/doctrine", // path to your Doctrine Console file - "atlas:dump-sql", + "atlas:schema", "--path", "./path/to/entities", "--dialect", "mysql" // mariadb | postgres | sqlite | sqlserver ] @@ -96,7 +96,7 @@ data "external_schema" "doctrine" { program = [ "php", "bin/console", - "atlas:dump-sql" + "atlas:schema" ] } diff --git a/src/Command.php b/src/Command.php index fd1dd9e..44275cb 100644 --- a/src/Command.php +++ b/src/Command.php @@ -23,7 +23,7 @@ public function __construct(Configuration $config = null) protected function configure(): void { $dialects = DialectsMapping::getInstance()->getDialects(); - $this->setName('atlas:dump-sql') + $this->setName('atlas:schema') ->addOption( 'dialect', null, diff --git a/tests/BundleTest.php b/tests/BundleTest.php index 90af813..cc2388c 100644 --- a/tests/BundleTest.php +++ b/tests/BundleTest.php @@ -18,10 +18,10 @@ public function testRegisterCommandsNoConfig(): void $bundle->setContainer($container); $application = new Application(); $bundle->registerCommands($application); - $this->assertTrue($application->has('atlas:dump-sql')); + $this->assertTrue($application->has('atlas:schema')); // run the command to check if it works - $command = $application->find('atlas:dump-sql'); + $command = $application->find('atlas:schema'); $commandTester = new CommandTester($command); $commandTester->execute([ 'command' => $command->getName(), @@ -55,10 +55,10 @@ public function testRegisterCommandsWithConfig(): void $bundle->setContainer($container); $application = new Application(); $bundle->registerCommands($application); - $this->assertTrue($application->has('atlas:dump-sql')); + $this->assertTrue($application->has('atlas:schema')); // run the command to check if it works with the underscore naming strategy - $command = $application->find('atlas:dump-sql'); + $command = $application->find('atlas:schema'); $commandTester = new CommandTester($command); $commandTester->execute([ 'command' => $command->getName(), diff --git a/tests/CommandTest.php b/tests/CommandTest.php index a97ad9f..050d105 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -9,7 +9,7 @@ final class CommandTest extends TestCase public function testCommand(): void { - $output = shell_exec("php tests/bin/doctrine atlas:dump-sql --dialect mysql --path ./tests/entities/regular"); + $output = shell_exec("php tests/bin/doctrine atlas:schema --dialect mysql --path ./tests/entities/regular"); $expected = 'CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)); CREATE TABLE bugs (id INT AUTO_INCREMENT NOT NULL, description VARCHAR(255) NOT NULL, created DATETIME NOT NULL, status VARCHAR(255) NOT NULL, engineer_id INT DEFAULT NULL, reporter_id INT DEFAULT NULL, INDEX IDX_1E197C9F8D8CDF1 (engineer_id), INDEX IDX_1E197C9E1CFE6F5 (reporter_id), PRIMARY KEY(id)); ALTER TABLE bugs ADD CONSTRAINT FK_1E197C9F8D8CDF1 FOREIGN KEY (engineer_id) REFERENCES users (id); @@ -20,7 +20,7 @@ public function testCommand(): void public function testCommandInvalidDialect(): void { - exec("php tests/bin/doctrine atlas:dump-sql --dialect bad_dialect --path ./tests/entities/regular", $output, $return_var); + exec("php tests/bin/doctrine atlas:schema --dialect bad_dialect --path ./tests/entities/regular", $output, $return_var); $this->assertEquals(1, $return_var); // check that stderr contains the expected error message $this->assertStringContainsString("Invalid dialect: bad_dialect", $output[1]); @@ -28,7 +28,7 @@ public function testCommandInvalidDialect(): void public function testCommandInvalidPath(): void { - exec("php tests/bin/doctrine atlas:dump-sql --dialect mysql --path /bad/path", $output, $return_var); + exec("php tests/bin/doctrine atlas:schema --dialect mysql --path /bad/path", $output, $return_var); $this->assertEquals(1, $return_var); $this->assertStringContainsString("Invalid path: /bad/path", $output[1]); } diff --git a/tests/atlas.hcl b/tests/atlas.hcl index f85b373..76ec318 100644 --- a/tests/atlas.hcl +++ b/tests/atlas.hcl @@ -15,7 +15,7 @@ data "external_schema" "doctrine" { program = [ "php", "tests/bin/doctrine", - "atlas:dump-sql", + "atlas:schema", "--path", "tests/entities/regular", "--dialect", var.dialect, ]