PHPUnit2
[ class tree: PHPUnit2 ] [ index: PHPUnit2 ] [ all elements ]

File: Assert.php

Source Location: /PHPUnit2-3.0.0alpha11/Framework/Assert.php

Classes:

PHPUnit2_Framework_Assert
A set of assert methods.

Page Details:

PHPUnit

Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Sebastian Bergmann nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Includes:

require_once('PHPUnit2/Extensions/MockObject/Mock.php') [line 51]
require_once('PHPUnit2/Util/Filter.php') [line 50]
require_once('PHPUnit2/Extensions/MockObject/Matcher/InvokedCount.php') [line 54]
require_once('PHPUnit2/Extensions/MockObject/Matcher/InvokedAtLeastOnce.php') [line 52]
require_once('PHPUnit2/Extensions/MockObject/Stub/Return.php') [line 56]
require_once('PHPUnit2/Extensions/MockObject/Matcher/InvokedAtIndex.php') [line 53]
require_once('PHPUnit2/Extensions/MockObject/Stub/ConsecutiveCalls.php') [line 55]
require_once('PHPUnit2/Framework.php') [line 49]

anything [line 651]

PHPUnit2_Framework_Constraint_IsAnything anything( )

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


[ Top ]



arrayContains [line 665]

PHPUnit2_Framework_Constraint_TraversableContains arrayContains( mixed $value)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

mixed   $value  
[ Top ]



arrayHasKey [line 679]

PHPUnit2_Framework_Constraint_ArrayHasKey arrayHasKey( mixed $key)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

mixed   $key  
[ Top ]



assertArrayNotHasKey [line 119]

void assertArrayNotHasKey( mixed $key, mixed {if(!(is_integer($key, array $array, string $message)

Asserts that an array does not have a specified key.
  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $key  
array   $array  
string   $message  
[ Top ]



assertContains [line 144]

void assertContains( mixed $needle, mixed $haystack, [string $message = ''])

Asserts that a haystack contains a needle.
  • Since: Method available since Release 2.1.0
  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $needle  
mixed   $haystack  
string   $message  
[ Top ]



assertEquals [line 208]

void assertEquals( mixed $expected, mixed $actual, [string $message = ''], [mixed $delta = 0])

Asserts that two variables are equal.
  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $expected  
mixed   $actual  
string   $message  
mixed   $delta  
[ Top ]



assertFalse [line 366]

void assertFalse( boolean $condition, [string $message = ''])

Asserts that a condition is false.
  • Static: This method can be called statically
  • Access: public
  • Throws: InvalidArgumentException
  • Throws: PHPUnit2_Framework_ComparisonFailure


Parameters

boolean   $condition  
string   $message  
[ Top ]



assertFileExists [line 248]

void assertFileExists( string $filename, [string $message = ''])

Asserts that a file exists.
  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public


Parameters

string   $filename  
string   $message  
[ Top ]



assertFileNotExists [line 270]

void assertFileNotExists( string $filename, [string $message = ''])

Asserts that a file does not exist.
  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public


Parameters

string   $filename  
string   $message  
[ Top ]



assertHasProperty [line 295]

void assertHasProperty( string $property, object $object, [string $message = ''])

Asserts that an object has a specified property.
  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public


Parameters

string   $property  
object   $object  
string   $message  
[ Top ]



assertNotContains [line 174]

void assertNotContains( mixed $needle, mixed $haystack, [string $message = ''])

Asserts that a haystack does not contain a needle.
  • Since: Method available since Release 2.1.0
  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $needle  
mixed   $haystack  
string   $message  
[ Top ]



assertNotEquals [line 228]

void assertNotEquals( mixed $expected, mixed $actual, [string $message = ''], [mixed $delta = 0])

Asserts that two variables are not equal.
  • Since: Method available since Release 2.3.0
  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $expected  
mixed   $actual  
string   $message  
mixed   $delta  
[ Top ]



assertNotHasProperty [line 318]

void assertNotHasProperty( string $property, object $object, [string $message = ''])

Asserts that an object does not have a specified property.
  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public


Parameters

string   $property  
object   $object  
string   $message  
[ Top ]



assertNotNull [line 387]

void assertNotNull( mixed $actual, [string $message = ''])

Asserts that a variable is not NULL.
  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $actual  
string   $message  
[ Top ]



assertNotRegExp [line 561]

void assertNotRegExp( string $pattern, string $string, [string $message = ''])

Asserts that a string does not match a given regular expression.
  • Since: Method available since Release 2.1.0
  • Static: This method can be called statically
  • Access: public


Parameters

string   $pattern  
string   $string  
string   $message  
[ Top ]



assertNotSame [line 446]

void assertNotSame( mixed $expected, mixed $actual, [string $message = ''])

Asserts that two variables do not have the same type and value.

Used on objects, it asserts that two variables do not reference the same object.

  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $expected  
mixed   $actual  
string   $message  
[ Top ]



assertNotType [line 496]

void assertNotType( string $expected, mixed $actual, [string $message = ''])

Asserts that a variable is not of a given type.
  • Since: Method available since Release 2.2.0
  • Static: This method can be called statically
  • Access: public


Parameters

string   $expected  
mixed   $actual  
string   $message  
[ Top ]



assertNull [line 406]

void assertNull( mixed $actual, [string $message = ''])

Asserts that a variable is NULL.
  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $actual  
string   $message  
[ Top ]



assertRegExp [line 529]

void assertRegExp( string $pattern, string $string, [string $message = ''])

Asserts that a string matches a given regular expression.
  • Static: This method can be called statically
  • Access: public


Parameters

string   $pattern  
string   $string  
string   $message  
[ Top ]



assertSame [line 426]

void assertSame( mixed $expected, mixed $actual, [string $message = ''])

Asserts that two variables have the same type and value.

Used on objects, it asserts that two variables reference the same object.

  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $expected  
mixed   $actual  
string   $message  
[ Top ]



assertThat [line 586]

void assertThat( mixed $value, mixed PHPUnit2_Framework_Constraint$constraint, [string $message = ''], PHPUnit2_Framework_Constraint $constraint)

  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public


Parameters

mixed   $value  
PHPUnit2_Framework_Constraint   $constraint  
string   $message  
[ Top ]



assertTrue [line 343]

void assertTrue( boolean $condition, [string $message = ''])

Asserts that a condition is true.
  • Static: This method can be called statically
  • Access: public
  • Throws: InvalidArgumentException
  • Throws: PHPUnit2_Framework_ComparisonFailure


Parameters

boolean   $condition  
string   $message  
[ Top ]



assertType [line 466]

void assertType( string $expected, mixed $actual, [string $message = ''])

Asserts that a variable is of a given type.
  • Static: This method can be called statically
  • Access: public


Parameters

string   $expected  
mixed   $actual  
string   $message  
[ Top ]



equalTo [line 694]

PHPUnit2_Framework_Constraint_IsEqual equalTo( mixed $value, [mixed $delta = 0])

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

mixed   $value  
mixed   $delta  
[ Top ]



failConstraint [line 851]

void failConstraint( mixed PHPUnit2_Framework_Constraint$constraint, mixed $value, string $message, [boolean $type = FALSE], PHPUnit2_Framework_Constraint $constraint)

Fails a test based on a failed constraint.
  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public
  • Throws: PHPUnit2_Framework_ExpectationFailedException


Parameters

PHPUnit2_Framework_Constraint   $constraint  
mixed   $value  
string   $message  
boolean   $type  
[ Top ]



fileExists [line 707]

PHPUnit2_Framework_Constraint_FileExists fileExists( )

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


[ Top ]



getNonPublicProperty [line 878]

mixed getNonPublicProperty( object $object, string $propertyName)

Returns the value of an object's property that is declared protected or private.
  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public
  • Throws: InvalidArgumentException


Parameters

object   $object  
string   $propertyName  
[ Top ]



greaterThan [line 721]

PHPUnit2_Framework_Constraint_GreaterThan greaterThan( mixed $value)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

mixed   $value  
[ Top ]



hasProperty [line 735]

PHPUnit2_Framework_Constraint_HasProperty hasProperty( string $property)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

string   $property  
[ Top ]



identicalTo [line 749]

PHPUnit2_Framework_Constraint_IsIdentical identicalTo( mixed $value)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

mixed   $value  
[ Top ]



isInstanceOf [line 763]

PHPUnit2_Framework_Constraint_IsInstanceOf isInstanceOf( string $className)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

string   $className  
[ Top ]



isType [line 777]

PHPUnit2_Framework_Constraint_IsType isType( string $type)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

string   $type  
[ Top ]



lessThan [line 791]

PHPUnit2_Framework_Constraint_LessThan lessThan( mixed $value)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

mixed   $value  
[ Top ]



logicalAnd [line 601]

PHPUnit2_Framework_Constraint_And logicalAnd( )

Logical AND.
  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


[ Top ]



logicalNot [line 638]

PHPUnit2_Framework_Constraint_Not logicalNot( mixed PHPUnit2_Framework_Constraint$constraint, PHPUnit2_Framework_Constraint $constraint)

Logical NOT.
  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

PHPUnit2_Framework_Constraint   $constraint  
[ Top ]



logicalOr [line 619]

PHPUnit2_Framework_Constraint_Or logicalOr( )

Logical OR.
  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


[ Top ]



markTestIncomplete [line 921]

void markTestIncomplete( [string $message = ''])

Mark the test as incomplete.
  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public
  • Throws: PHPUnit2_Framework_IncompleteTestError


Parameters

string   $message  
[ Top ]



markTestSkipped [line 935]

void markTestSkipped( [string $message = ''])

Mark the test as skipped.
  • Since: Method available since Release 3.0.0
  • Static: This method can be called statically
  • Access: public
  • Throws: PHPUnit2_Framework_SkippedTestError


Parameters

string   $message  
[ Top ]



matchesRegularExpression [line 805]

PHPUnit2_Framework_Constraint_PCREMatch matchesRegularExpression( string $pattern)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

string   $pattern  
[ Top ]



stringContains [line 820]

PHPUnit2_Framework_Constraint_StringContains stringContains( string $string, boolean $case)

  • Static: This method can be called statically
  • Since: Method available since Release 3.0.0
  • Access: public


Parameters

string   $string  
boolean   $case  
[ Top ]



Documentation generated on Tue, 12 Sep 2006 09:36:45 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.