From 1ec5fe0db6a19a9f7432a82e991296cbaa937cfc Mon Sep 17 00:00:00 2001 From: ADmad Date: Mon, 27 Oct 2014 11:44:34 +0530 Subject: [PATCH] Test for case when directory for plugin assets already exists. --- .../TestCase/Shell/PluginAssetsShellTest.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/TestCase/Shell/PluginAssetsShellTest.php b/tests/TestCase/Shell/PluginAssetsShellTest.php index 8ddf505227c..f1e5a301692 100644 --- a/tests/TestCase/Shell/PluginAssetsShellTest.php +++ b/tests/TestCase/Shell/PluginAssetsShellTest.php @@ -100,6 +100,27 @@ public function testSymlinkWhenVendorDirectoryExits() { $folder->delete(); } +/** + * testSymlinkWhenTargetAlreadyExits + * + * @return void + */ + public function testSymlinkWhenTargetAlreadyExits() { + Plugin::load('TestTheme'); + + $shell = $this->getMock( + 'Cake\Shell\PluginAssetsShell', + array('in', 'out', 'err', '_stop', '_createSymlink', '_copyDirectory'), + array($this->io) + ); + + $this->assertTrue(is_dir(WWW_ROOT . 'test_theme')); + + $shell->expects($this->never())->method('_createSymlink'); + $shell->expects($this->never())->method('_copyDirectory'); + $shell->symlink(); + } + /** * test that plugins without webroot are not processed *