public function toBeLessThanOrEqualTo($expected) { if ($this->negate) { a::assertGreaterThan($expected, $this->actual); } else { a::assertLessThanOrEqual($expected, $this->actual); } }
public function colorAt($x, $y, $expectedColor) { $actualColor = (string) $this->image->getColorAt(new Point($x, $y)); $actualRgb = $this->rgb($actualColor); $expectedRgb = $this->rgb($expectedColor); for ($i = 0; $i < 3; $i++) { \PHPUnit_Framework_Assert::assertLessThanOrEqual(255 * 0.03, abs($actualRgb[$i] - $expectedRgb[$i]), 'expected color: ' . $expectedColor . ', but given: ' . $actualColor); } return $this; }
/** * Asserts that a value is smaller than or equal to another value. * * @param mixed $expected * @param mixed $actual * @param string $message * @since Method available since Release 3.1.0 */ function assertLessThanOrEqual($expected, $actual, $message = '') { return PHPUnit_Framework_Assert::assertLessThanOrEqual($expected, $actual, $message); }
public function lessOrEquals($expected) { a::assertLessThanOrEqual($expected, $this->actual, $this->description); }
/** * @Then the JSON node :node should be less than :value * * @param string $node * @param string $value */ public function theJsonNodeShouldBeLower($node, $value) { $json = $this->getJson(); $actual = $this->inspector->evaluate($json, $node); PHPUnit::assertLessThanOrEqual($value, $actual, sprintf('Expected `%s` to be less than `%s`.', $value, $actual)); }
/** * Expect that a value is smaller than or equal to another value. * * @param mixed $expected * @param string $message * * @return Expect */ public function toBeLessThanOrEqualTo($expected, $message = '') { Assert::assertLessThanOrEqual($expected, $this->value, $message); return $this; }
public function fread($socket, $len) { \PHPUnit_Framework_Assert::assertEquals($this->socketPath, $socket); if ($this->readBuffer === NULL) { assert(is_callable($this->execImplementation)); $retval = NULL; $output = NULL; call_user_func_array($this->execImplementation, array("fread", &$output, &$retval)); if (!is_array($output)) { return FALSE; } $data = implode("\n", $output); $this->readBuffer = pack("CN", (int) 0x11, (int) strlen($data)) . $data; } \PHPUnit_Framework_Assert::assertLessThanOrEqual(strlen($this->readBuffer), $len); $chunk = substr($this->readBuffer, 0, $len); $this->readBuffer = substr($this->readBuffer, $len); return $chunk; }
/** * @Then all process should have exited */ public function allProcessShouldHaveExited() { $count = trim(shell_exec("ps aux | grep -c '{$this->actualCommand}'")); // We expect atleast 2 matches, one from grep itself and its parent shell PHPUnit_Framework_Assert::assertLessThanOrEqual(2, $count); }
/** * @Then the email body should contain approximately :number :element elements * @Then the email body should contain ~ :number :element elements */ public function theEmailBodyShouldContainApproximatelyNumElements($num, $element) { $num = intval($num); $crawler = new Crawler($this->message->getBody()); $found = $crawler->filter($element); Assert::assertGreaterThanOrEqual($num - 1, $found->count()); Assert::assertLessThanOrEqual($num + 1, $found->count()); }
/** * @param $expected * @param $actual * @param $description */ protected function assertLessOrEquals($expected, $actual, $description) { \PHPUnit_Framework_Assert::assertLessThanOrEqual($expected, $actual, $description); }
/** * @Then I should have the maximum number of available suggestions */ public function iShouldHaveTheMaximumNumberOfAvailableSuggestions() { $results = $this->getResultForAddress($this->customerAddress); Assert::assertLessThanOrEqual($this->maxSuggestions, $results->getSuggestionCount()); }
public function isLessOrEqualTo($expected) { Assert::assertLessThanOrEqual($expected, $this->actual, $this->description); return $this; }