示例#1
0
    /**
     * Validates Input Options
     *
     * @param array $inputOptions
     * @return array
     */
    public function validate(array $inputOptions)
    {
        $errors = [];

        //Basic types validation
        $options = $this->getAvailableOptions();
        foreach ($options as $option) {
            try {
                if ($inputOptions[$option->getName()] !== null) {
                    $option->validate($inputOptions[$option->getName()]);
                }
            } catch (\InvalidArgumentException $e) {
                $errors[] = $e->getMessage();
            }
        }

        // validate ConfigOptionsList
        $options = $this->collector->collectOptionsLists();

        foreach ($options as $option) {
            $errors = array_merge($errors, $option->validate($inputOptions, $this->deploymentConfig));
        }

        return $errors;
    }
示例#2
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage In module : Fake_ModuleConfigOption::createConfig
  */
 public function testProcessException()
 {
     $configOption = $this->configOptionsList;
     $configOption->expects($this->once())->method('createConfig')->will($this->returnValue([null]));
     $wrongData = ['Fake_Module' => $configOption];
     $this->collector->expects($this->once())->method('collectOptionsLists')->will($this->returnValue($wrongData));
     $this->configModel->process([]);
 }