Fixed issues with PR

main
MakiCode 9 years ago
parent 0d00338bdb
commit 63ede6c9dd

@ -40,9 +40,9 @@ class ArchiveCommand extends Command
->setDefinition(array(
new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
new InputOption('format', 'f', InputOption::VALUE_OPTIONAL, 'Format of the resulting archive: tar or zip'),
new InputOption('dir', false, InputOption::VALUE_OPTIONAL, 'Write the archive to this directory'),
new InputOption('file', false, InputOption::VALUE_OPTIONAL, 'Write the archive with the given file name.'
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
new InputOption('dir', false, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
new InputOption('file', false, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
.' Note that the format will be appended.'),
))
->setHelp(<<<EOT
@ -81,7 +81,7 @@ EOT
$input->getArgument('version'),
$input->getOption('format'),
$input->getOption('dir'),
$input->getOption("file")
$input->getOption('file')
);
if (0 === $returnCode && $composer) {

@ -108,7 +108,7 @@ class ArchiveManager
if (empty($format)) {
throw new \InvalidArgumentException('Format must be specified');
}
if(!is_null($fileName) && !is_string($fileName)) {
if (null !== $fileName && !is_string($fileName)) {
throw new \InvalidArgumentException('fileName must be a string');
}
@ -127,7 +127,7 @@ class ArchiveManager
}
$filesystem = new Filesystem();
if(null === $fileName) {
if (null !== $fileName) {
$packageName = $this->getPackageFilename($package);
} else {
$packageName = $fileName;

@ -66,11 +66,11 @@ class ArchiveManagerTest extends ArchiverTest
$package = $this->setupPackage();
$fileName = "testArchiveName";
$fileName = 'testArchiveName';
$this->manager->archive($package, 'tar', $this->targetDir, $fileName);
$target = $this->targetDir . "/" . $fileName . ".tar";
$target = $this->targetDir . '/' . $fileName . '.tar';
$this->assertFileExists($target);
@ -80,8 +80,9 @@ class ArchiveManagerTest extends ArchiverTest
unlink($target);
}
public function testNonStringFileName() {
$this->setExpectedException("InvalidArgumentException");
public function testNonStringFileName()
{
$this->setExpectedException('InvalidArgumentException');
$package = $this->setupPackage();

Loading…
Cancel
Save