/** * @param Project $project * @param array $options * @return int */ public function createProject(Project $project, array $options = array()) { if (!$project->getBootstrap()) { throw new InvalidArgumentException('The bootstrap of the project is not defined'); } return $this->execute(trim(sprintf('composer create-project --prefer-dist %s %s %s', $project->getBootstrap()->getPackage(), $project->getDirectoryPath() ? '"' . $project->getDirectoryPath() . '"' : '', $project->getBootstrap()->getVersion())) . $this->mapOptions($options)); }
public function testDumpAutoload() { $project = new Project(); $project->setDirectoryPath(__DIR__ . '/../resources'); $executor = $this->getMockBuilder('TRex\\Cli\\Executor')->getMock(); $executor->expects($this->once())->method('flush')->with('composer dump-autoload', [STDIN, STDOUT, STDERR], [], __DIR__ . '/../resources')->will($this->returnValue(0)); $composer = new Composer($executor, new BalloonFactory(new DummyFileReaderFactory())); $this->assertSame(0, $composer->dumpAutoload($project->getDirectoryPath())); }