public function testExtraParameter()
 {
     $descriptor = new InstallerDescriptor('installer', 'Class\\Name');
     $this->assertEquals(array(new ConstraintViolation(ConstraintViolation::NO_SUCH_PARAMETER, 'foobar', 'installer', 'param')), $this->validator->validate(array('param' => 'foobar'), $descriptor));
 }
Пример #2
0
 private function validateParameterValues(array $parameterValues, InstallerDescriptor $installerDescriptor)
 {
     $validator = new InstallerParameterValidator();
     $violations = $validator->validate($parameterValues, $installerDescriptor);
     foreach ($violations as $violation) {
         switch ($violation->getCode()) {
             case ConstraintViolation::MISSING_PARAMETER:
                 throw NotInstallableException::missingParameter($violation->getParameterName(), $violation->getInstallerName());
             case ConstraintViolation::NO_SUCH_PARAMETER:
                 throw NotInstallableException::noSuchParameter($violation->getParameterName(), $violation->getInstallerName());
         }
     }
 }