Beispiel #1
0
 /**
  * Checks a single property
  *
  * @param OutputInterface $output
  * @param CheckInterface $property
  * @return bool
  */
 protected function checkProperty(OutputInterface $output, CheckInterface $property)
 {
     $result = $property->check();
     if ($result === false) {
         $outputLevel = 'error';
         $sign = self::EMOJI_FAILURE;
         if ($property->isOptional() === true) {
             $outputLevel = 'comment';
             $sign = self::EMOJI_OPTIONAL;
         }
         $message = $property->getFailureMessage();
         // The default value from overallResult is true.
         // So it is enough to set it to false once.
         $this->overallResult = false;
     } elseif ($result === true) {
         $outputLevel = 'info';
         $sign = self::EMOJI_OK;
         $message = $property->getSuccessMessage();
     }
     $outputMessage = "  <info>%s</info>   <%s>%s</%s>";
     $outputMessage = sprintf($outputMessage, $sign, $outputLevel, $message, $outputLevel);
     $output->writeln($outputMessage);
     return $result;
 }
Beispiel #2
0
 public function testIsOptional()
 {
     $this->assertInternalType('bool', $this->checkInstance->isOptional());
 }