1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-28 16:19:50 +02:00
This commit is contained in:
Oliver Vogel
2014-12-12 16:45:28 +01:00
parent ab3b4750da
commit e012301c85
2 changed files with 14 additions and 1 deletions

View File

@@ -52,8 +52,10 @@ class Argument
$arguments = $this->command->arguments;
if (is_array($arguments)) {
return array_key_exists($this->key, $arguments) ? $arguments[$this->key] : $default;
return isset($arguments[$this->key]) ? $arguments[$this->key] : $default;
}
return $default;
}
/**

View File

@@ -397,6 +397,17 @@ class ArgumentTest extends PHPUnit_Framework_TestCase
$arg->max(10);
}
public function testValueDefault()
{
$arg = new Argument($this->getMockedCommand());
$value = $arg->value('foo');
$this->assertEquals('foo', $value);
$arg = new Argument($this->getMockedCommand(array(null)));
$value = $arg->value('foo');
$this->assertEquals('foo', $value);
}
private function validateArgument($argument, $value)
{
$this->assertInstanceOf('\Intervention\Image\Commands\Argument', $argument);