Esempio n. 1
0
 /**
  * Initialize Exception.
  *
  * @param   Definition  $step2  duplicate step definition
  * @param   Definition  $step1  firstly matched step definition
  */
 public function __construct(Definition $step2, Definition $step1)
 {
     parent::__construct();
     $this->step1 = $step1;
     $this->step2 = $step2;
     $this->message = sprintf("Step \"%s\" is already defined in %s:%d\n\n%s:%d\n%s:%d", $this->step2->getRegex(), Formatter::trimFilename($this->step1->getFile()), $this->step1->getLine(), Formatter::trimFilename($this->step1->getFile()), $this->step1->getLine(), Formatter::trimFilename($this->step2->getFile()), $this->step2->getLine());
 }
Esempio n. 2
0
 /**
  * Initialize Error handler exception.
  *
  * @param   string  $code       error code
  * @param   string  $message    error message
  * @param   string  $file       error file
  * @param   string  $line       error line
  */
 public function __construct($code, $message, $file, $line)
 {
     parent::__construct();
     switch ($code) {
         case E_WARNING:
         case E_USER_WARNING:
             $type = 'Warning';
             break;
         case E_NOTICE:
         case E_USER_NOTICE:
             $type = 'Notice';
             break;
         case E_STRICT:
             $type = 'Strict';
             break;
         case E_DEPRECATED:
             $type = 'Deprecated';
             break;
         case E_ERROR:
         case E_USER_ERROR:
         default:
             $type = 'Error';
     }
     $this->code = $code;
     $this->message = $type . ': ' . $message;
     $this->file = $file;
     $this->line = $line;
 }
Esempio n. 3
0
 /**
  * Initialize exception.
  *
  * @param   string  $text       step description
  * @param   array   $matches    ambigious matches (array of StepDefinition's)
  */
 public function __construct($text, array $matches)
 {
     parent::__construct();
     $this->text = $text;
     $this->matches = $matches;
     $this->message = sprintf("Ambiguous match of \"%s\":", $this->text);
     foreach ($this->matches as $definition) {
         $this->message .= sprintf("\n%s:%d:in `%s`", Formatter::trimFilename($definition->getFile()), $definition->getLine(), $definition->getRegex());
     }
 }
 /**
  * Initializes ambiguous exception.
  *
  * @param string $text    step description
  * @param array  $matches ambigious matches (array of Definition's)
  */
 public function __construct($text, array $matches)
 {
     $this->text = $text;
     $this->matches = $matches;
     $message = sprintf("Ambiguous match of \"%s\":", $text);
     foreach ($matches as $definition) {
         $message .= sprintf("\nto `%s` from %s", $definition->getRegex(), $definition->getPath());
     }
     parent::__construct($message);
 }
Esempio n. 5
0
 /**
  * Initializes redundant exception.
  *
  * @param   Behat\Behat\Definition\Definition   $step2    duplicate step definition
  * @param   Behat\Behat\Definition\Definition   $step1    firstly matched step definition
  */
 public function __construct(Definition $step2, Definition $step1)
 {
     $message = sprintf("Step \"%s\" is already defined in %s:%d\n\n%s:%d\n%s:%d", $step2->getRegex(), $step1->getFile(), $step1->getLine(), $step1->getFile(), $step1->getLine(), $step2->getFile(), $step2->getLine());
     parent::__construct($message);
 }
 /**
  * Initializes redundant exception.
  *
  * @param DefinitionInterface $step2 duplicate step definition
  * @param DefinitionInterface $step1 firstly matched step definition
  */
 public function __construct(DefinitionInterface $step2, DefinitionInterface $step1)
 {
     $message = sprintf("Step \"%s\" is already defined in %s\n\n%s\n%s", $step2->getRegex(), $step1->getPath(), $step1->getPath(), $step2->getPath());
     parent::__construct($message);
 }
Esempio n. 7
0
 /**
  * Initialize Exception.
  *
  * @param   string  $text   step description
  */
 public function __construct($text)
 {
     parent::__construct();
     $this->text = $text;
     $this->message = sprintf('Undefined step "%s"', $this->text);
 }
Esempio n. 8
0
 /**
  * Initialize undefined exception.
  *
  * @param   string  $text   step text
  */
 public function __construct($text)
 {
     $this->text = $text;
     parent::__construct(sprintf('Undefined step "%s"', $text));
 }
Esempio n. 9
0
 /**
  * Initializes pending exception.
  *
  * @param string $text TODO text
  */
 public function __construct($text = 'write pending definition')
 {
     parent::__construct(sprintf('TODO: %s', $text));
 }
Esempio n. 10
0
 /**
  * Initializes error handler exception.
  *
  * @param string $level   error level
  * @param string $message error message
  * @param string $file    error file
  * @param string $line    error line
  */
 public function __construct($level, $message, $file, $line)
 {
     parent::__construct(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line));
 }
Esempio n. 11
0
 /**
  * Initialize Exception.
  *
  * @param   string  $text   step description
  */
 public function __construct($text = 'write pending definition')
 {
     parent::__construct();
     $this->message = sprintf('TODO: %s', $text);
 }