From c4d142db9e7250411802076595e1f27772e52de4 Mon Sep 17 00:00:00 2001 From: Artem Henvald Date: Fri, 17 Jan 2020 14:11:25 +0000 Subject: [PATCH] Test improvements, use Nowdoc instead of Heredoc if possible --- tests/Command/DumpEnvCommandTest.php | 4 ++-- .../Configurator/BundlesConfiguratorTest.php | 6 ++--- .../ContainerConfiguratorTest.php | 24 +++++++++---------- tests/Configurator/EnvConfiguratorTest.php | 2 +- .../GitignoreConfiguratorTest.php | 8 +++---- .../Configurator/MakefileConfiguratorTest.php | 4 ++-- tests/FlexTest.php | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/Command/DumpEnvCommandTest.php b/tests/Command/DumpEnvCommandTest.php index 500d78a60..0b8daec66 100644 --- a/tests/Command/DumpEnvCommandTest.php +++ b/tests/Command/DumpEnvCommandTest.php @@ -28,7 +28,7 @@ public function testFileIsCreated() @unlink($env); @unlink($envLocal); - $envContent = << ['dev', 'test'], 'Symfony\Bundle\FrameworkBundle\FrameworkBundle' => ['all'], ], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' ['dev', 'test'], 'Symfony\Bundle\FrameworkBundle\FrameworkBundle' => ['all'], ], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' 'config', 'root-dir' => FLEX_TEST_DIR]) ); $configurator->configure($recipe, ['locale' => 'en'], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' # comment parameters: locale: 'en' @@ -53,7 +53,7 @@ public function testConfigure() , file_get_contents($config)); $configurator->unconfigure($recipe, ['locale' => 'en'], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' # comment parameters: @@ -81,7 +81,7 @@ public function testConfigureWithoutParametersKey() new Options(['config-dir' => 'config', 'root-dir' => FLEX_TEST_DIR]) ); $configurator->configure($recipe, ['locale' => 'en'], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' parameters: locale: 'en' @@ -91,7 +91,7 @@ public function testConfigureWithoutParametersKey() , file_get_contents($config)); $configurator->unconfigure($recipe, ['locale' => 'en'], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' parameters: services: @@ -121,7 +121,7 @@ public function testConfigureWithoutDuplicated() new Options(['config-dir' => 'config', 'root-dir' => FLEX_TEST_DIR]) ); $configurator->configure($recipe, ['locale' => 'en'], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' parameters: locale: es @@ -131,7 +131,7 @@ public function testConfigureWithoutDuplicated() , file_get_contents($config)); $configurator->unconfigure($recipe, ['locale' => 'en'], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' parameters: services: @@ -165,7 +165,7 @@ public function testConfigureWithComplexContent() new Options(['config-dir' => 'config', 'root-dir' => FLEX_TEST_DIR]) ); $configurator->configure($recipe, ['locale' => 'en', 'foobar' => 'baz'], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' parameters: # comment 1 locale: es @@ -180,7 +180,7 @@ public function testConfigureWithComplexContent() , file_get_contents($config)); $configurator->unconfigure($recipe, ['locale' => 'en', 'foobar' => 'baz'], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' parameters: # comment 1 @@ -215,7 +215,7 @@ public function testConfigureWithComplexContent2() new Options(['config-dir' => 'config', 'root-dir' => FLEX_TEST_DIR]) ); $configurator->configure($recipe, ['locale' => 'en', 'foobar' => 'baz', 'array' => ['key1' => 'value', 'key2' => "Escape ' one quote"], 'key1' => 'Keep It'], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' parameters: # comment 1 locale: es @@ -231,7 +231,7 @@ public function testConfigureWithComplexContent2() , file_get_contents($config)); $configurator->unconfigure($recipe, ['locale' => 'en', 'array' => ['key1' => 'value', 'key2' => "Escape ' one quote"]], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' parameters: # comment 1 foobar: 'baz' @@ -265,7 +265,7 @@ public function testConfigureWithEnvVariable() new Options(['config-dir' => 'config', 'root-dir' => FLEX_TEST_DIR]) ); $configurator->configure($recipe, ['env(APP_ENV)' => ''], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' # comment parameters: env(APP_ENV): '' @@ -276,7 +276,7 @@ public function testConfigureWithEnvVariable() , file_get_contents($config)); $configurator->unconfigure($recipe, ['env(APP_ENV)' => ''], $lock); - $this->assertEquals(<<assertEquals(<<<'EOF' # comment parameters: diff --git a/tests/Configurator/EnvConfiguratorTest.php b/tests/Configurator/EnvConfiguratorTest.php index bc6fd7943..3c4a0ecd3 100644 --- a/tests/Configurator/EnvConfiguratorTest.php +++ b/tests/Configurator/EnvConfiguratorTest.php @@ -137,7 +137,7 @@ public function testConfigure() $this->assertStringEqualsFile( $env, - << FooBundle ### .env /public/bundles/ ###< FooBundle ### EOF; - $gitignoreContents2 = << BarBundle ### /var/ /vendor/ @@ -97,7 +97,7 @@ public function testConfigureForce() touch($gitignore); file_put_contents($gitignore, "# preexisting content\n"); - $contentsConfigure = << FooBundle ### @@ -106,7 +106,7 @@ public function testConfigureForce() # new content EOF; - $contentsForce = << FooBundle ### diff --git a/tests/Configurator/MakefileConfiguratorTest.php b/tests/Configurator/MakefileConfiguratorTest.php index a00c5cb23..a4714486f 100644 --- a/tests/Configurator/MakefileConfiguratorTest.php +++ b/tests/Configurator/MakefileConfiguratorTest.php @@ -42,7 +42,7 @@ public function testConfigure() $makefile1 = explode( "\n", - <<assertSame($expected, $postInstallOutput); $this->assertSame( - <<=1.0): From github.com/symfony/recipes:master