Permalink
Browse files

- Add assertGreaterThan(), assertAttributeGreaterThan(),

  assertGreaterThanOrEqual(), assertAttributeGreaterThanOrEqual(),
  assertLessThan(), assertAttributeLessThan(),
  assertLessThanOrEqual(), and assertAttributeLessThanOrEqual().
  • Loading branch information...
1 parent a9bf0eb commit 4d743bda6d918c06ec23d770e713a24cc362fd22 @sebastianbergmann committed Apr 30, 2007
Showing with 140 additions and 0 deletions.
  1. +140 −0 PHPUnit/Framework/Assert.php
@@ -315,6 +315,146 @@ public static function assertAttributeNotEquals($expected, $actualAttributeName,
);
}
+ /**
+ * Asserts that a value is greater than another value.
+ *
+ * @param mixed $expected
+ * @param mixed $actual
+ * @param string $message
+ * @access public
+ * @static
+ * @since Method available since Release 3.1.0
+ */
+ public static function assertGreaterThan($expected, $actual, $message = '')
+ {
+ self::assertThat($actual, $this->greaterThan($expected), $message);
+ }
+
+ /**
+ * Asserts that an attribute is greater than another value.
+ *
+ * @param mixed $expected
+ * @param string $actualAttributeName
+ * @param string $actualClassOrObject
+ * @param string $message
+ * @access public
+ * @static
+ * @since Method available since Release 3.1.0
+ */
+ public static function assertAttributeGreaterThan($expected, $actualAttributeName, $actualClassOrObject, $message = '')
+ {
+ self::assertGreaterThan(
+ $expected,
+ self::getAttribute($actualClassOrObject, $actualAttributeName),
+ $message
+ );
+ }
+
+ /**
+ * Asserts that a value is greater than or equal to another value.
+ *
+ * @param mixed $expected
+ * @param mixed $actual
+ * @param string $message
+ * @access public
+ * @static
+ * @since Method available since Release 3.1.0
+ */
+ public static function assertGreaterThanOrEqual($expected, $actual, $message = '')
+ {
+ self::assertThat($actual, $this->greaterThanOrEqual($expected), $message);
+ }
+
+ /**
+ * Asserts that an attribute is greater than or equal to another value.
+ *
+ * @param mixed $expected
+ * @param string $actualAttributeName
+ * @param string $actualClassOrObject
+ * @param string $message
+ * @access public
+ * @static
+ * @since Method available since Release 3.1.0
+ */
+ public static function assertAttributeGreaterThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = '')
+ {
+ self::assertGreaterThanOrEqual(
+ $expected,
+ self::getAttribute($actualClassOrObject, $actualAttributeName),
+ $message
+ );
+ }
+
+ /**
+ * Asserts that a value is smaller than another value.
+ *
+ * @param mixed $expected
+ * @param mixed $actual
+ * @param string $message
+ * @access public
+ * @static
+ * @since Method available since Release 3.1.0
+ */
+ public static function assertLessThan($expected, $actual, $message = '')
+ {
+ self::assertThat($actual, $this->lessThan($expected), $message);
+ }
+
+ /**
+ * Asserts that an attribute is smaller than another value.
+ *
+ * @param mixed $expected
+ * @param string $actualAttributeName
+ * @param string $actualClassOrObject
+ * @param string $message
+ * @access public
+ * @static
+ * @since Method available since Release 3.1.0
+ */
+ public static function assertAttributeLessThan($expected, $actualAttributeName, $actualClassOrObject, $message = '')
+ {
+ self::assertLessThan(
+ $expected,
+ self::getAttribute($actualClassOrObject, $actualAttributeName),
+ $message
+ );
+ }
+
+ /**
+ * Asserts that a value is smaller than or equal to another value.
+ *
+ * @param mixed $expected
+ * @param mixed $actual
+ * @param string $message
+ * @access public
+ * @static
+ * @since Method available since Release 3.1.0
+ */
+ public static function assertLessThanOrEqual($expected, $actual, $message = '')
+ {
+ self::assertThat($actual, $this->lessThanOrEqual($expected), $message);
+ }
+
+ /**
+ * Asserts that an attribute is smaller than or equal to another value.
+ *
+ * @param mixed $expected
+ * @param string $actualAttributeName
+ * @param string $actualClassOrObject
+ * @param string $message
+ * @access public
+ * @static
+ * @since Method available since Release 3.1.0
+ */
+ public static function assertAttributeLessThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = '')
+ {
+ self::assertLessThanOrEqual(
+ $expected,
+ self::getAttribute($actualClassOrObject, $actualAttributeName),
+ $message
+ );
+ }
+
/**
* Asserts that a file exists.
*

0 comments on commit 4d743bd

Please sign in to comment.