Skip to content
Browse files

- Merge [876].

  • Loading branch information...
1 parent 97519be commit 8daf4aaf6dc284836522e0a5c33b0bc6248f330a @sebastianbergmann committed Aug 3, 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 8daf4aa

Please sign in to comment.
Something went wrong with that request. Please try again.