Example #1
0
 /**
  * @param boolean $isInstalled
  * @param boolean $isForced
  * @dataProvider provideCoreBuildTestCases
  */
 public function testCoreBuild($isInstalled, $isForced)
 {
     $shouldInstall = !$isInstalled || $isForced;
     $package = $this->getPackage('bcn/test1', '1.0.0', 'magento-core', self::SOURCE_DIR);
     $project = new Project();
     $project->addPackage($package);
     $project->setTargetDir(self::TARGET_DIR);
     $project->setStrategy('copy');
     $project->setForce($isForced);
     $filesystem = $this->getFilesystem();
     if (!$isForced) {
         $filesystem->expects($this->once())->method("exists")->with($this->equalTo(self::TARGET_DIR . DIRECTORY_SEPARATOR . "index.php"))->will($this->returnValue($isInstalled));
     }
     $strategy = $this->getStrategy();
     $builder = $this->getPackageBuilder();
     if ($shouldInstall) {
         $builder->expects($this->once())->method('build')->with($this->equalTo($package), $this->equalTo(self::TARGET_DIR), $this->equalTo($strategy));
     } else {
         $builder->expects($this->never())->method('build');
     }
     $manager = new Builder($builder);
     $manager->setFilesystem($filesystem);
     $manager->addStrategy('copy', $strategy);
     $manager->build($project);
 }
Example #2
0
 /**
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $targetDir = $input->getArgument('magento-root-path');
     $this->ensureDirectoryExists($targetDir);
     $project = new Project();
     $project->setTargetDir($targetDir);
     $project->setForce($input->getOption('force'));
     $project->setStrategy($input->getOption('strategy'));
     foreach ($this->getBuildPackages() as $package) {
         $project->addPackage($package);
     }
     $this->getBuilder()->build($project);
 }
Example #3
0
 public function testIsForce()
 {
     $project = new Project();
     $project->setForce(true);
     $this->assertTrue($project->isForce());
 }