Permalink
Browse files

- Merge [5098].

  • Loading branch information...
1 parent eb27c2c commit 32fcfa098b4734c022a5a9f30bd5124f21d37510 @sebastianbergmann committed Aug 17, 2009
Showing with 36 additions and 0 deletions.
  1. +36 −0 PHPUnit/Framework/Assert.php
@@ -1012,6 +1012,24 @@ public static function assertType($expected, $actual, $message = '')
}
/**
+ * Asserts that an attribute is of a given type.
+ *
+ * @param string $expected
+ * @param string $attributeName
+ * @param mixed $classOrObject
+ * @param string $message
+ * @since Method available since Release 3.4.0
+ */
+ public static function assertAttributeType($expected, $attributeName, $classOrObject, $message = '')
+ {
+ self::assertType(
+ $expected,
+ self::readAttribute($classOrObject, $attributeName),
+ $message
+ );
+ }
+
+ /**
* Asserts that a variable is not of a given type.
*
* @param string $expected
@@ -1047,6 +1065,24 @@ public static function assertNotType($expected, $actual, $message = '')
}
/**
+ * Asserts that an attribute is of a given type.
+ *
+ * @param string $expected
+ * @param string $attributeName
+ * @param mixed $classOrObject
+ * @param string $message
+ * @since Method available since Release 3.4.0
+ */
+ public static function assertAttributeNotType($expected, $attributeName, $classOrObject, $message = '')
+ {
+ self::assertNotType(
+ $expected,
+ self::readAttribute($classOrObject, $attributeName),
+ $message
+ );
+ }
+
+ /**
* Asserts that a string matches a given regular expression.
*
* @param string $pattern

0 comments on commit 32fcfa0

Please sign in to comment.