예제 #1
0
 protected function setUp()
 {
     parent::setUp();
     $this->repo = $this->getMock('Puli\\Repository\\Api\\ResourceRepository');
     $this->discovery = $this->getMock('Puli\\Discovery\\Api\\ResourceDiscovery');
     $this->handler = new FindCommandHandler($this->repo, $this->discovery);
 }
예제 #2
0
 protected function setUp()
 {
     parent::setUp();
     $this->environment = $this->getMockBuilder('Puli\\Manager\\Api\\Environment\\ProjectEnvironment')->disableOriginalConstructor()->getMock();
     $this->packageManager = $this->getMock('Puli\\Manager\\Api\\Package\\PackageManager');
     $this->handler = new PackageCommandHandler($this->packageManager);
     $this->environment->expects($this->any())->method('getRootDirectory')->willReturn(__DIR__ . '/Fixtures/root');
     $this->packageManager->expects($this->any())->method('getEnvironment')->willReturn($this->environment);
     $installInfo1 = new InstallInfo('vendor/package1', 'packages/package1');
     $installInfo2 = new InstallInfo('vendor/package2', 'packages/package2');
     $installInfo3 = new InstallInfo('vendor/package3', 'packages/package3');
     $installInfo4 = new InstallInfo('vendor/package4', 'packages/package4');
     $installInfo1->setInstallerName('spock');
     $installInfo2->setInstallerName('spock');
     $installInfo3->setInstallerName('kirk');
     $installInfo4->setInstallerName('spock');
     $rootPackage = new RootPackage(new RootPackageFile('vendor/root'), __DIR__ . '/Fixtures/root');
     $package1 = new Package(new PackageFile('vendor/package1'), __DIR__ . '/Fixtures/root/packages/package1', $installInfo1);
     $package2 = new Package(new PackageFile('vendor/package2'), __DIR__ . '/Fixtures/root/packages/package2', $installInfo2);
     $package3 = new Package(new PackageFile('vendor/package3'), __DIR__ . '/Fixtures/root/packages/package3', $installInfo3);
     $package4 = new Package(null, __DIR__ . '/Fixtures/root/packages/package4', $installInfo4, array(new RuntimeException('Load error')));
     $this->packageManager->expects($this->any())->method('findPackages')->willReturnCallback($this->returnFromMap(array(array($this->all(), new PackageCollection(array($rootPackage, $package1, $package2, $package3, $package4))), array($this->installer('spock'), new PackageCollection(array($package1, $package2, $package4))), array($this->state(PackageState::ENABLED), new PackageCollection(array($rootPackage, $package1, $package2))), array($this->state(PackageState::NOT_FOUND), new PackageCollection(array($package3))), array($this->state(PackageState::NOT_LOADABLE), new PackageCollection(array($package4))), array($this->states(array(PackageState::ENABLED, PackageState::NOT_FOUND)), new PackageCollection(array($rootPackage, $package1, $package2, $package3))), array($this->installerAndState('spock', PackageState::ENABLED), new PackageCollection(array($package1, $package2))), array($this->installerAndState('spock', PackageState::NOT_FOUND), new PackageCollection(array())), array($this->installerAndState('spock', PackageState::NOT_LOADABLE), new PackageCollection(array($package4))))));
     $this->previousWd = getcwd();
     $this->wd = __DIR__;
     chdir($this->wd);
 }
예제 #3
0
 protected function setUp()
 {
     parent::setUp();
     $this->repoManager = $this->getMock('Puli\\Manager\\Api\\Repository\\RepositoryManager');
     $this->packages = new PackageCollection(array(new RootPackage(new RootPackageFile('vendor/root'), '/root'), new Package(new PackageFile('vendor/package1'), '/package1'), new Package(new PackageFile('vendor/package2'), '/package2')));
     $this->handler = new MapCommandHandler($this->repoManager, $this->packages);
 }
예제 #4
0
 protected function setUp()
 {
     parent::setUp();
     $this->discoveryManager = $this->getMock('Puli\\Manager\\Api\\Discovery\\DiscoveryManager');
     $this->packages = new PackageCollection(array(new RootPackage(new RootPackageFile('vendor/root'), '/root'), new Package(new PackageFile('vendor/package1'), '/package1'), new Package(new PackageFile('vendor/package2'), '/package2')));
     $this->handler = new TypeCommandHandler($this->discoveryManager, $this->packages);
     $this->discoveryManager->expects($this->any())->method('findBindingTypes')->willReturnCallback($this->returnFromMap(array(array($this->packageAndState('vendor/root', BindingTypeState::ENABLED), array(new BindingTypeDescriptor('root/enabled1', 'Description of root/enabled1', array(new BindingParameterDescriptor('req-param', BindingParameterDescriptor::REQUIRED, null, 'Description of req-param'), new BindingParameterDescriptor('opt-param', BindingParameterDescriptor::OPTIONAL, 'default', 'Description of opt-param'))), new BindingTypeDescriptor('root/enabled2', 'Description of root/enabled2'))), array($this->packageAndState('vendor/root', BindingTypeState::DUPLICATE), array(new BindingTypeDescriptor('root/duplicate'))), array($this->packageAndState('vendor/package1', BindingTypeState::ENABLED), array(new BindingTypeDescriptor('package1/enabled'))), array($this->packageAndState('vendor/package1', BindingTypeState::DUPLICATE), array(new BindingTypeDescriptor('package1/duplicate'))), array($this->packageAndState('vendor/package2', BindingTypeState::ENABLED), array(new BindingTypeDescriptor('package2/enabled'))), array($this->packageAndState('vendor/package2', BindingTypeState::DUPLICATE), array(new BindingTypeDescriptor('package2/duplicate'))))));
 }
예제 #5
0
 protected function setUp()
 {
     parent::setUp();
     $this->repoManager = $this->getMock('Puli\\Manager\\Api\\Repository\\RepositoryManager');
     $this->discoveryManager = $this->getMock('Puli\\Manager\\Api\\Discovery\\DiscoveryManager');
     $this->factoryManager = $this->getMock('Puli\\Manager\\Api\\Factory\\FactoryManager');
     $this->handler = new BuildCommandHandler($this->repoManager, $this->discoveryManager, $this->factoryManager);
 }
예제 #6
0
 protected function setUp()
 {
     parent::setUp();
     $this->manager = $this->getMock('Puli\\Manager\\Api\\Package\\RootPackageFileManager');
     $this->handler = new PluginCommandHandler($this->manager);
 }
예제 #7
0
 protected function setUp()
 {
     parent::setUp();
     $this->assetManager = $this->getMock('Puli\\Manager\\Api\\Asset\\AssetManager');
     $this->installationManager = $this->getMock('Puli\\Manager\\Api\\Installation\\InstallationManager');
     $this->serverManager = $this->getMock('Puli\\Manager\\Api\\Server\\ServerManager');
     $this->handler = new PublishCommandHandler($this->assetManager, $this->installationManager, $this->serverManager);
 }
예제 #8
0
 protected function setUp()
 {
     parent::setUp();
     $this->repo = new InMemoryRepository();
     $this->handler = new TreeCommandHandler($this->repo);
 }
예제 #9
0
 protected function setUp()
 {
     parent::setUp();
     $this->installerManager = $this->getMock('Puli\\Manager\\Api\\Installer\\InstallerManager');
     $this->handler = new InstallerCommandHandler($this->installerManager);
 }