Skip to content

Commit

Permalink
Fix #8, create no symlink for dev-tool in no dev-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-muehle committed Sep 13, 2016
1 parent e85d2d5 commit be34f34
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Script/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 17 additions & 0 deletions tests/Script/Processor/SymlinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit be34f34

Please sign in to comment.