protected function setUp()
 {
     $this->packageFileManager = $this->getMock('Puli\\Manager\\Api\\Package\\RootPackageFileManager');
     $this->installerManager = $this->getMock('Puli\\AssetPlugin\\Api\\Installer\\InstallerManager');
     $this->targetManager = new PackageFileInstallTargetManager($this->packageFileManager, $this->installerManager);
     $this->installerManager->expects($this->any())->method('hasInstallerDescriptor')->willReturnMap(array(array('symlink', true), array('rsync', true)));
 }
 /**
  * @expectedException \Puli\AssetPlugin\Api\Installation\NotInstallableException
  * @expectedExceptionMessage Puli\AssetPlugin\Tests\Installation\Fixtures\TestInstallerInvalid
  * @expectedExceptionCode 8
  */
 public function testFailIfInstallerClassInvalid()
 {
     $resources = new ArrayResourceCollection(array(new GenericResource('/path/css'), new GenericResource('/path/js')));
     $installerDescriptor = new InstallerDescriptor('rsync', self::INSTALLER_CLASS_INVALID, null, array(new InstallerParameter('param1', InstallerParameter::REQUIRED), new InstallerParameter('param2', InstallerParameter::OPTIONAL, 'default1'), new InstallerParameter('param3', InstallerParameter::OPTIONAL, 'default2')));
     $target = new InstallTarget('server', 'rsync', 'ssh://server/public_html', '/%s', array('param1' => 'custom1', 'param3' => 'custom2'));
     $mapping = new AssetMapping('/path/{css,js}', 'server', 'assets');
     $this->targets->add($target);
     $this->repo->expects($this->any())->method('find')->with('/path/{css,js}')->willReturn($resources);
     $this->installerManager->expects($this->any())->method('hasInstallerDescriptor')->with('rsync')->willReturn(true);
     $this->installerManager->expects($this->any())->method('getInstallerDescriptor')->with('rsync')->willReturn($installerDescriptor);
     $this->manager->prepareInstallation($mapping);
 }
 private function initDefaultInstallers()
 {
     $this->installerManager->expects($this->once())->method('getInstallerDescriptors')->willReturn(array(new InstallerDescriptor('symlink', 'Puli\\Installer\\SymlinkInstaller', 'Symlink description'), new InstallerDescriptor('copy', 'Puli\\Installer\\CopyInstaller', 'The copy description is significantly longer than all the other descriptions, although it doesn\'t bear any more information.'), new InstallerDescriptor('rsync', 'Puli\\Installer\\RsyncInstaller', 'Just a short description', array(new InstallerParameter('required', InstallerParameter::REQUIRED, null, 'The description of "required"'), new InstallerParameter('optional', InstallerParameter::OPTIONAL, 42, 'The description of "optional"')))));
 }