Browse files

- Merge [876].

  • Loading branch information...
1 parent e6c7aed commit f8d2a26520ebca893c3f6c20ecd55928356a1839 @sebastianbergmann committed Jul 31, 2007
Showing with 20 additions and 16 deletions.
  1. +20 −16 PHPUnit/Framework/Assert.php
View
36 PHPUnit/Framework/Assert.php
@@ -604,41 +604,45 @@ public static function assertFileNotExists($filename, $message = '')
*
* @param boolean $condition
* @param string $message
- * @throws PHPUnit_Framework_ComparisonFailure
- * @throws InvalidArgumentException
+ * @throws PHPUnit_Framework_AssertionFailedError
* @access public
* @static
*/
public static function assertTrue($condition, $message = '')
{
- if (!is_bool($condition)) {
- throw new InvalidArgumentException;
- }
+ if ($condition !== TRUE) {
+ throw new PHPUnit_Framework_AssertionFailedError(
+ sprintf(
+ '%sFailed asserting that %s is true.',
- $constraint = new PHPUnit_Framework_Constraint_IsIdentical(TRUE);
-
- self::assertThat($condition, $constraint, $message);
+ $message != '' ? $message . "\n" : '',
+ PHPUnit_Util_Type::toString($condition)
+ )
+ );
+ }
}
/**
* Asserts that a condition is false.
*
* @param boolean $condition
* @param string $message
- * @throws PHPUnit_Framework_ComparisonFailure
- * @throws InvalidArgumentException
+ * @throws PHPUnit_Framework_AssertionFailedError
* @access public
* @static
*/
public static function assertFalse($condition, $message = '')
{
- if (!is_bool($condition)) {
- throw new InvalidArgumentException;
- }
+ if ($condition !== FALSE) {
+ throw new PHPUnit_Framework_AssertionFailedError(
+ sprintf(
+ '%sFailed asserting that %s is false.',
- $constraint = new PHPUnit_Framework_Constraint_IsIdentical(FALSE);
-
- self::assertThat($condition, $constraint, $message);
+ $message != '' ? $message . "\n" : '',
+ PHPUnit_Util_Type::toString($condition)
+ )
+ );
+ }
}
/**

0 comments on commit f8d2a26

Please sign in to comment.