From 133a9c383b7e0a48574eceeb4caab824c68a69c9 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Fri, 6 Feb 2026 09:17:33 +0100 Subject: [PATCH] [MakefileConfigurator] Fix indentation of `help` target --- src/Configurator/MakefileConfigurator.php | 3 ++- .../Configurator/MakefileConfiguratorTest.php | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Configurator/MakefileConfigurator.php b/src/Configurator/MakefileConfigurator.php index 5c1d9ca73..8dbfaabf7 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'); + } }