/** * Make the assertion and report result to the test runner. * * @param $expectation boolean * @param $type string * @param $value */ private function assert($expectation, $type, $value) { $not = $this->negate ? " not " : " "; $subject = CLI::toString($this->subject); $value = CLI::toString($value); if (!$expectation) { $this->runner->addError("Expected {$subject} to{$not}contain {$type} {$value}."); $this->runner->markCurrentAsFailed(); } }
/** * Make the assertion and report result to the test runner. * * @param $type string Either property or method * @param $name string Name of the property/method * @param $expectation boolean */ private function assert($expectation, $type, $value) { if ($this->negate) { $expectation = !$expectation; $not = " not "; } else { $not = " "; } $subject = CLI::toString($this->subject); if (!$expectation) { $this->runner->addError("Expected {$subject} to{$not}have {$type} {$value}."); $this->runner->markCurrentAsFailed(); } }
/** * Make the assertion and report result to the test runner. */ private function assert() { if ($this->negate) { $expectation = $this->subject != $this->expectation; $not = " not "; } else { $expectation = $this->subject == $this->expectation; $not = " "; } $subject = CLI::toString($this->subject); $value = CLI::toString($this->expectation); if (!$expectation) { $this->runner->addError("Expected {$subject} to{$not}equal {$value}"); $this->runner->markCurrentAsFailed(); } }
/** * Make the assertion and report result to the test runner. * * @param $expectation boolean Success * @param $type string Subject type * @param $value string Expected type */ private function assert($expectation, $type, $value = "") { $subject = CLI::toString($this->subject); if ($this->negate) { $expectation = !$expectation; $not = " not "; } else { $not = " "; } if (!$expectation) { $message = "Expected {$subject} to{$not}be {$type}"; if ($value && !$this->negate) { $message .= ", but is a {$value}."; } else { $message .= "."; } $this->runner->addError($message); $this->runner->markCurrentAsFailed(); } }