diff --git a/src/Script/Processor.php b/src/Script/Processor.php index 77b7951..4e1e349 100644 --- a/src/Script/Processor.php +++ b/src/Script/Processor.php @@ -93,6 +93,10 @@ public function process(Tool $tool) */ public function symlink(Tool $tool) { + if (true === $tool->isOnlyDev() && false === $this->configuration->isDevMode()) { + return; + } + $filename = $tool->getFilename(); $composerDir = $this->configuration->getComposerBinDirectory(); $composerPath = $composerDir . DIRECTORY_SEPARATOR . basename($filename); diff --git a/tests/Script/Processor/SymlinkTest.php b/tests/Script/Processor/SymlinkTest.php index dc129e1..7345ab0 100644 --- a/tests/Script/Processor/SymlinkTest.php +++ b/tests/Script/Processor/SymlinkTest.php @@ -63,4 +63,21 @@ public function testCanCreateASymlink() $processor = new Processor($this->io, $this->helper, $this->configuration); $processor->symlink($tool); } + + public function testNoSymlinkCreatedIfOnlyDevToolInNoDevMode() + { + $this->configuration + ->expects($this->once()) + ->method('isDevMode') + ->willReturn(false); + + $this->helper + ->expects($this->never()) + ->method('getFilesystem'); + + $tool = ToolFactory::createTool('tool', __DIR__, []); + + $processor = new Processor($this->io, $this->helper, $this->configuration); + $processor->symlink($tool); + } }