Since: 3.1
Author: Bernhard Schussek (bschussek@gmail.com)
Example #1
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     $this->storage = new FilesystemStorage();
     $this->path = $this->tempDir . '/test-file';
     file_put_contents($this->path, self::CONTENTS);
 }
Example #2
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('webmozart-glob', __CLASS__);
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures', $this->tempDir);
     TestStreamWrapper::register('globtest', __DIR__ . '/Fixtures');
 }
Example #3
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('webmozart-glob', __CLASS__);
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/../Fixtures', $this->tempDir);
     $this->tempFile = tempnam(sys_get_temp_dir(), 'webmozart_GlobIteratorTest');
 }
Example #4
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     $this->class = new Clazz('MyClass');
     $this->class->setDirectory($this->tempDir);
     $this->writer = new ClassWriter();
 }
 protected function setUp()
 {
     $this->rootDirectory = TestUtil::makeTempDir('bartfeenstra-composer-package-locator', __CLASS__);
     $vendorDirectoryName = 'the-vendor';
     $vendorDirectory = $this->rootDirectory . '/' . $vendorDirectoryName;
     $fileSystem = new Filesystem();
     $fileSystem->mirror(__DIR__ . '/../fixtures/dependentRoot', $this->rootDirectory);
     define('BARTFEENSTRA_COMPOSER_PACKAGE_LOCATOR_VENDOR_DIR', $vendorDirectory);
     $this->sut = new InstalledFileSystemRepository();
 }
Example #6
0
 protected function setUp()
 {
     $this->tempBaseDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     $this->tempDir = $this->tempBaseDir . '/workspace';
     $this->fixturesDir = $this->tempBaseDir . '/fixtures';
     mkdir($this->tempDir);
     mkdir($this->fixturesDir);
     // Mirror the fixtures so that we can test the relative paths
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures', $this->fixturesDir);
     $this->installer = new SymlinkInstaller();
     $this->installerDescriptor = new InstallerDescriptor('symlink', get_class($this->installer), null, array(new InstallerParameter('relative', InstallerParameter::OPTIONAL, true)));
 }
Example #7
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     $this->tempRoot = $this->tempDir . '/root';
     $this->tempHome = $this->tempDir . '/home';
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures/root', $this->tempRoot);
     $filesystem->mirror(__DIR__ . '/Fixtures/home', $this->tempHome);
     TestPlugin::reset();
     putenv('PULI_HOME=' . $this->tempHome);
     // Make sure "HOME" is not set
     putenv('HOME');
     $this->puli = new Puli();
 }
Example #8
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     $this->rootDir = $this->tempDir . '/root';
     $this->outputDir = $this->rootDir . '/out';
     $this->outputPath = $this->outputDir . '/generated.php';
     $this->registry = new DefaultGeneratorRegistry();
     $this->writer = new ClassWriter();
     $this->class = new Clazz('Puli\\Test\\GeneratedFactory');
     $this->class->setFilePath($this->outputPath);
     $this->method = new Method('createService');
     $this->class->addMethod($this->method);
     mkdir($this->rootDir);
     mkdir($this->outputDir);
 }
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures', $this->tempDir);
     $this->packageDir1 = $this->tempDir . '/package1';
     $this->packageDir2 = $this->tempDir . '/package2';
     $this->packageDir3 = $this->tempDir . '/package3';
     $this->packageFile1 = new PackageFile('vendor/package1');
     $this->packageFile2 = new PackageFile('vendor/package2');
     $this->packageFile3 = new PackageFile('vendor/package3');
     $this->packages = new PackageCollection();
     $this->packageFileStorage = $this->getMockBuilder('Puli\\Manager\\Package\\PackageFileStorage')->disableOriginalConstructor()->getMock();
     $this->initContext($this->tempDir . '/home', $this->tempDir . '/root');
 }
Example #10
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     @mkdir($this->tempDir . '/home');
     @mkdir($this->tempDir . '/root');
     $this->initContext($this->tempDir . '/home', $this->tempDir . '/root');
     $this->context->getConfig()->set(Config::FACTORY_OUT_FILE, 'MyFactory.php');
     $this->context->getConfig()->set(Config::FACTORY_OUT_CLASS, 'Puli\\MyFactory');
     $this->context->getConfig()->set(Config::FACTORY_IN_FILE, 'MyFactory.php');
     $this->context->getConfig()->set(Config::FACTORY_IN_CLASS, 'Puli\\MyFactory');
     $this->registry = new DefaultGeneratorRegistry();
     $this->realWriter = new ClassWriter();
     $this->fakeWriter = $this->getMockBuilder('Puli\\Manager\\Php\\ClassWriter')->disableOriginalConstructor()->getMock();
     $this->servers = new ServerCollection(array(new Server('localhost', 'symlink', 'public_html', '/%s'), new Server('example.com', 'rsync', 'ssh://example.com', 'http://example.com/%s')));
     $this->manager = new FactoryManagerImpl($this->context, $this->registry, $this->realWriter, $this->servers);
 }
 /**
  * @covers ::storeVendorDir
  */
 public function testStoreVendorDir()
 {
     $rootDirectory = TestUtil::makeTempDir('bartfeenstra-composer-package-locator', __CLASS__);
     $vendorDirectoryName = 'the-vendor';
     $vendorDirectory = $rootDirectory . '/' . $vendorDirectoryName;
     $fileSystem = new Filesystem();
     $fileSystem->mirror(__DIR__ . '/../fixtures/dependentRoot', $rootDirectory);
     $io = $this->prophesize(IOInterface::class);
     $config = new Config(false, $rootDirectory);
     $config->merge(['config' => ['home' => $rootDirectory, 'vendor-dir' => $vendorDirectoryName]]);
     $composer = $this->prophesize(Composer::class);
     $composer->getConfig()->willReturn($config);
     $event = $this->prophesize(Event::class);
     $event->getComposer()->willReturn($composer);
     $event->getIO()->willReturn($io);
     $this->sut->storeVendorDir($event->reveal());
     $this->assertConstant('BARTFEENSTRA_COMPOSER_PACKAGE_LOCATOR_VENDOR_DIR', $vendorDirectory, $vendorDirectory);
     $this->assertConstant('BARTFEENSTRA_COMPOSER_PACKAGE_LOCATOR_HOME_FILE', $rootDirectory . '/./composer.json', $vendorDirectory);
     $fileSystem->remove($rootDirectory);
 }
Example #12
0
 protected function setUp()
 {
     $this->tempHome = TestUtil::makeTempDir('puli-manager', __CLASS__);
 }
Example #13
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     $this->packageDir1 = __DIR__ . '/Fixtures/package1';
     $this->packageDir2 = __DIR__ . '/Fixtures/package2';
     $this->packageDir3 = __DIR__ . '/Fixtures/package3';
     $this->packageFile1 = new PackageFile();
     $this->packageFile2 = new PackageFile();
     $this->packageFile3 = new PackageFile('vendor/package3');
     $this->installInfo1 = new InstallInfo('vendor/package1', '../package1');
     $this->installInfo2 = new InstallInfo('vendor/package2', '../package2');
     $this->installInfo3 = new InstallInfo('vendor/package3', '../package3');
     $this->packageFileStorage = $this->getMockBuilder('Puli\\Manager\\Package\\PackageFileStorage')->disableOriginalConstructor()->getMock();
     $this->packageFileStorage->expects($this->any())->method('loadPackageFile')->willReturnMap(array(array($this->packageDir1 . '/puli.json', $this->packageFile1), array($this->packageDir2 . '/puli.json', $this->packageFile2), array($this->packageDir3 . '/puli.json', $this->packageFile3)));
     $this->initContext(__DIR__ . '/Fixtures/home', __DIR__ . '/Fixtures/root');
 }
Example #14
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     $this->installer = new CopyInstaller();
     $this->installerDescriptor = new InstallerDescriptor('copy', get_class($this->installer));
 }
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('webmozart-glob', __CLASS__);
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/../Fixtures', $this->tempDir);
 }
Example #16
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-composer-plugin', __CLASS__);
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures/root', $this->tempDir);
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
     $this->config = new Config(false, $this->tempDir);
     $this->config->merge(array('config' => array('vendor-dir' => 'the-vendor')));
     $this->installationManager = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->installationManager->expects($this->any())->method('getInstallPath')->will($this->returnCallback(array($this, 'getInstallPath')));
     $this->rootPackage = new RootPackage('vendor/root', '1.0', '1.0');
     $this->rootPackage->setRequires(array('vendor/package1' => new Link('vendor/root', 'vendor/package1'), 'vendor/package2' => new Link('vendor/root', 'vendor/package2')));
     $this->localRepository = new TestLocalRepository(array(new Package('vendor/package1', '1.0', '1.0'), new Package('vendor/package2', '1.0', '1.0')));
     $this->repositoryManager = new RepositoryManager($this->io, $this->config);
     $this->repositoryManager->setLocalRepository($this->localRepository);
     $this->installPaths = array();
     $this->composer = new Composer();
     $this->composer->setRepositoryManager($this->repositoryManager);
     $this->composer->setInstallationManager($this->installationManager);
     $this->composer->setConfig($this->config);
     $this->composer->setPackage($this->rootPackage);
     $this->puliRunner = $this->getMockBuilder('Puli\\ComposerPlugin\\PuliRunner')->disableOriginalConstructor()->getMock();
     $this->previousWd = getcwd();
     chdir($this->tempDir);
     $this->plugin = new PuliPlugin($this->puliRunner);
 }