Skip to content
Browse files

Fix TRAC-1038.

  • Loading branch information...
1 parent 9906524 commit b5eb24b6e346acb9021016312570f9948e3d221c @sebastianbergmann committed Apr 14, 2010
Showing with 11 additions and 10 deletions.
  1. +10 −10 PHPUnit/Framework/Assert.php
  2. +1 −0 README.markdown
View
20 PHPUnit/Framework/Assert.php
@@ -983,21 +983,21 @@ public static function assertAttributeNotSame($expected, $actualAttributeName, $
public static function assertType($expected, $actual, $message = '')
{
if (is_string($expected)) {
- if (PHPUnit_Util_Type::isType($expected)) {
- $constraint = new PHPUnit_Framework_Constraint_IsType(
+ if (class_exists($expected) || interface_exists($expected)) {
+ $constraint = new PHPUnit_Framework_Constraint_IsInstanceOf(
$expected
);
}
- else if (class_exists($expected) || interface_exists($expected)) {
- $constraint = new PHPUnit_Framework_Constraint_IsInstanceOf(
+ else if (PHPUnit_Util_Type::isType($expected)) {
+ $constraint = new PHPUnit_Framework_Constraint_IsType(
$expected
);
}
else {
throw PHPUnit_Util_InvalidArgumentHelper::factory(
- 1, 'class or interface name'
+ 1, 'class, interface or type name'
);
}
} else {
@@ -1036,21 +1036,21 @@ public static function assertAttributeType($expected, $attributeName, $classOrOb
public static function assertNotType($expected, $actual, $message = '')
{
if (is_string($expected)) {
- if (PHPUnit_Util_Type::isType($expected)) {
+ if (class_exists($expected) || interface_exists($expected)) {
$constraint = new PHPUnit_Framework_Constraint_Not(
- new PHPUnit_Framework_Constraint_IsType($expected)
+ new PHPUnit_Framework_Constraint_IsInstanceOf($expected)
);
}
- else if (class_exists($expected) || interface_exists($expected)) {
+ else if (PHPUnit_Util_Type::isType($expected)) {
$constraint = new PHPUnit_Framework_Constraint_Not(
- new PHPUnit_Framework_Constraint_IsInstanceOf($expected)
+ new PHPUnit_Framework_Constraint_IsType($expected)
);
}
else {
throw PHPUnit_Util_InvalidArgumentHelper::factory(
- 1, 'class or interface name'
+ 1, 'class, interface or type name'
);
}
} else {
View
1 README.markdown
@@ -7,6 +7,7 @@ PHPUnit 3.4.13
--------------
* Fixed TRAC-1035: PostgreSQL MetaData queries are incorrect.
+* Fixed TRAC-1038: `assertType()` and user-defined classes/interfaces.
* The `--repeat` switch is no longer deprecated.
PHPUnit 3.4.12

0 comments on commit b5eb24b

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