本文整理汇总了PHP中Symfony\Component\Console\Input\ArrayInput::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayInput::validate方法的具体用法?PHP ArrayInput::validate怎么用?PHP ArrayInput::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Input\ArrayInput
的用法示例。
在下文中一共展示了ArrayInput::validate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testValidate
public function testValidate()
{
$input = new ArrayInput(array());
$input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED))));
try {
$input->validate();
$this->fail('->validate() throws a \\RuntimeException if not enough arguments are given');
} catch (\Exception $e) {
$this->assertInstanceOf('\\RuntimeException', $e, '->validate() throws a \\RuntimeException if not enough arguments are given');
$this->assertEquals('Not enough arguments.', $e->getMessage());
}
$input = new ArrayInput(array('name' => 'foo'));
$input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED))));
try {
$input->validate();
} catch (\RuntimeException $e) {
$this->fail('->validate() does not throw a \\RuntimeException if enough arguments are given');
}
}
示例2: validate
/**
* Do some additional validation of options
*
* @throws \Exception
* @return boolean
*/
public function validate()
{
parent::validate();
// s($this->getFullSchemaPath());
// file_exists($this->getFullSchemaPath());
// exit;
# GinnyInputException::100
if (strpos($this->getOption('schema_filename'), ',') === false && !file_exists($this->getFullSchemaPath())) {
throw new \Foote\Ginny\Exception\GinnyInputException('GinnyInput::getFullSchemaPath invalid: ' . $this->getFullSchemaPath(), 100);
}
# GinnyInputException::101
if (!file_exists($this->getFullTemplatePath())) {
throw new \Foote\Ginny\Exception\GinnyInputException('GinnyInput::getFullTemplatePath invalid: ' . $this->getFullTemplatePath(), 101);
}
# GinnyInputException::102
if (!file_exists($this->getFullTargetPath())) {
throw new \Foote\Ginny\Exception\GinnyInputException('GinnyInput::getFullTargetPath invalid: ' . $this->getFullTargetPath(), 102);
}
# GinnyInputException::103
if (!class_exists($this->getOption('generator_class'))) {
throw new \Foote\Ginny\Exception\GinnyInputException('GinnyInput::getOption(\'generator_class\') invalid: ' . $this->getOption('generator_class'), 103);
}
}
示例3: testValidate
public function testValidate()
{
$input = new ArrayInput(array('name' => 'foo'));
$input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED))));
$this->assertNull($input->validate());
}