diff --git a/src/Configurator/MakefileConfigurator.php b/src/Configurator/MakefileConfigurator.php index 5c1d9ca7..8dbfaabf 100644 --- a/src/Configurator/MakefileConfigurator.php +++ b/src/Configurator/MakefileConfigurator.php @@ -73,6 +73,7 @@ private function configureMakefile(Recipe $recipe, array $definitions, bool $upd if (!file_exists($makefile)) { $envKey = $this->options->get('runtime')['env_var_name'] ?? 'APP_ENV'; $dotenvPath = $this->options->get('runtime')['dotenv_path'] ?? '.env'; + $tab = "\t"; file_put_contents( $this->options->get('root-dir').'/Makefile', <<getNewFiles()); } + + public function testConfigureCreatesBoilerplateWithTabIndentation() + { + $configurator = new MakefileConfigurator( + $this->getMockBuilder(Composer::class)->getMock(), + $this->getMockBuilder(IOInterface::class)->getMock(), + new Options(['root-dir' => FLEX_TEST_DIR]) + ); + $lock = $this->getMockBuilder(Lock::class)->disableOriginalConstructor()->getMock(); + + $recipe = $this->getMockBuilder(Recipe::class)->disableOriginalConstructor()->getMock(); + $recipe->expects($this->any())->method('getName')->willReturn('FooBundle'); + + $makefile = FLEX_TEST_DIR.'/Makefile'; + @unlink($makefile); + + $configurator->configure($recipe, ['foo: ## Do foo'], $lock); + + $this->assertFileExists($makefile); + $contents = file_get_contents($makefile); + $this->assertStringContainsString("ifndef APP_ENV\n include .env\nendif", $contents); + $this->assertStringContainsString('.DEFAULT_GOAL := help', $contents); + $this->assertStringContainsString('.PHONY: help', $contents); + $this->assertStringContainsString("help:\n\t@awk", $contents, 'The help target must use a tab for indentation, not spaces'); + } }