From f09f8812701cf4167275bdf4c62ec9774d997b91 Mon Sep 17 00:00:00 2001 From: Derek Stephen McLean Date: Thu, 31 Oct 2024 18:51:36 +0100 Subject: [PATCH] alter output so escaped namespace works update expected test output fix cs checks use " instead of ' amend test expectatioon to expect double quotes add escape slashes again fix expected testoutput --- src/Tools/Console/Command/DiffCommand.php | 5 ++--- src/Tools/Console/Command/DumpSchemaCommand.php | 4 ++-- tests/Tools/Console/Command/DiffCommandTest.php | 4 ++-- tests/Tools/Console/Command/DumpSchemaCommandTest.php | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Tools/Console/Command/DiffCommand.php b/src/Tools/Console/Command/DiffCommand.php index 3bebfc578..34d84c753 100644 --- a/src/Tools/Console/Command/DiffCommand.php +++ b/src/Tools/Console/Command/DiffCommand.php @@ -128,7 +128,6 @@ protected function execute( } $fqcn = $this->getDependencyFactory()->getClassNameGenerator()->generateClassName($namespace); - $diffGenerator = $this->getDependencyFactory()->getDiffGenerator(); try { @@ -154,12 +153,12 @@ protected function execute( sprintf('Generated new migration class to "%s"', $path), '', sprintf( - 'To run just this migration for testing purposes, you can use migrations:execute --up \'%s\'', + 'To run just this migration for testing purposes, you can use migrations:execute --up "%s"', addslashes($fqcn), ), '', sprintf( - 'To revert the migration you can use migrations:execute --down \'%s\'', + 'To revert the migration you can use migrations:execute --down "%s"', addslashes($fqcn), ), '', diff --git a/src/Tools/Console/Command/DumpSchemaCommand.php b/src/Tools/Console/Command/DumpSchemaCommand.php index 724d0cf34..963a32c9d 100644 --- a/src/Tools/Console/Command/DumpSchemaCommand.php +++ b/src/Tools/Console/Command/DumpSchemaCommand.php @@ -105,12 +105,12 @@ public function execute( sprintf('Dumped your schema to a new migration class at "%s"', $path), '', sprintf( - 'To run just this migration for testing purposes, you can use migrations:execute --up \'%s\'', + 'To run just this migration for testing purposes, you can use migrations:execute --up "%s"', addslashes($fqcn), ), '', sprintf( - 'To revert the migration you can use migrations:execute --down \'%s\'', + 'To revert the migration you can use migrations:execute --down "%s"', addslashes($fqcn), ), '', diff --git a/tests/Tools/Console/Command/DiffCommandTest.php b/tests/Tools/Console/Command/DiffCommandTest.php index c568e1b3f..282113376 100644 --- a/tests/Tools/Console/Command/DiffCommandTest.php +++ b/tests/Tools/Console/Command/DiffCommandTest.php @@ -82,9 +82,9 @@ public function testExecute(): void self::assertSame([ 'Generated new migration class to "/path/to/migration.php"', '', - 'To run just this migration for testing purposes, you can use migrations:execute --up \'FooNs\\\\Version1234\'', + 'To run just this migration for testing purposes, you can use migrations:execute --up "FooNs\\\\Version1234"', '', - 'To revert the migration you can use migrations:execute --down \'FooNs\\\\Version1234\'', + 'To revert the migration you can use migrations:execute --down "FooNs\\\\Version1234"', ], array_map(trim(...), explode("\n", trim($output)))); } diff --git a/tests/Tools/Console/Command/DumpSchemaCommandTest.php b/tests/Tools/Console/Command/DumpSchemaCommandTest.php index b37fca641..3724c4f7d 100644 --- a/tests/Tools/Console/Command/DumpSchemaCommandTest.php +++ b/tests/Tools/Console/Command/DumpSchemaCommandTest.php @@ -91,9 +91,9 @@ public function testExecute(): void [ 'Dumped your schema to a new migration class at ""', '', - 'To run just this migration for testing purposes, you can use migrations:execute --up \'FooNs\\\\Version1234\'', + 'To run just this migration for testing purposes, you can use migrations:execute --up "FooNs\\\\Version1234"', '', - 'To revert the migration you can use migrations:execute --down \'FooNs\\\\Version1234\'', + 'To revert the migration you can use migrations:execute --down "FooNs\\\\Version1234"', '', 'To use this as a rollup migration you can use the migrations:rollup command.', ],