Exemple #1
0
 /**
  * @covers Assimp\Command\Command::execute
  */
 public function testExecute()
 {
     $verb = $this->getMock('\\Assimp\\Command\\Verbs\\VersionVerb', array('getCommand'));
     $verb->expects($this->once())->method('getCommand')->will($this->returnValue('help'));
     $result = $this->object->execute($verb, true);
     $this->assertTrue($result->isSuccess());
 }
 public function validate($value, Constraint $constraint)
 {
     $verb = new KnowExtensionVerb();
     $verb->setFormat($value);
     $exec = new Command();
     $result = $exec->execute($verb);
     if (!$result->isSuccess()) {
         $this->context->addViolation($constraint->message, array('%ext%' => $value));
     }
 }
 public function validate($value, Constraint $constraint)
 {
     $verb = new ListExportVerb();
     $exec = new Command();
     $result = $exec->execute($verb);
     if ($result->isSuccess()) {
         if (!in_array($value, $result->getOutput())) {
             $this->context->addViolation($constraint->message, array('%ext%' => $value));
         }
     }
 }
 public function validate($value, Constraint $constraint)
 {
     $verb = new VersionVerb();
     $exec = new Command();
     $result = $exec->execute($verb);
     if ($result->isSuccess()) {
         $version = $result->getOutputLine(0);
         if (!version_compare($value, $version, '>=')) {
             $this->context->addViolation($constraint->message, array('%version%' => $value, '%available_version%' => $version));
         }
     }
 }