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

Class: PHPUnit2_Framework_Assert

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

Class Overview


A set of assert methods.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>

Methods


Child classes:

PHPUnit2_Framework_TestCase
A TestCase defines the fixture to run multiple tests.
PHPUnit2_Extensions_TestDecorator
A Decorator for Tests.

Inherited Variables

Inherited Methods


Class Details

[line 75]
A set of assert methods.


[ Top ]


Method Detail

__construct (Constructor)   [line 82]

PHPUnit2_Framework_Assert __construct( )

Protect constructor since it is a static only class.
  • Access: protected

Overridden in child classes as:

PHPUnit2_Framework_TestCase::__construct()
Constructs a test case with the given name.
PHPUnit2_Framework_Warning::__construct()
PHPUnit2_Extensions_TestDecorator::__construct()
Constructor.
PHPUnit2_Extensions_RepeatedTest::__construct()
Constructor.

[ Top ]

anything   [line 651]

PHPUnit2_Framework_Constraint_IsAnything anything( )

  • Since: Method available since Release 3.0.0
  • Access: public

[ Top ]

arrayContains   [line 665]

PHPUnit2_Framework_Constraint_TraversableContains arrayContains( mixed $value)

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

mixed   $value   — 

[ Top ]

arrayHasKey   [line 679]

PHPUnit2_Framework_Constraint_ArrayHasKey arrayHasKey( mixed $key)

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

mixed   $key   — 

[ Top ]

assertArrayHasKey   [line 96]

void assertArrayHasKey( mixed $key, Array $array, [string $message = ''])

Asserts that an array has a specified key.
  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

mixed   $key   — 
array   $array   — 
string   $message   — 

[ Top ]

assertArrayNotHasKey   [line 119]

void assertArrayNotHasKey( mixed $key, Array $array, [string $message = ''])

Asserts that an array does not have a specified key.
  • Since: Method available since Release 3.0.0
  • 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
  • 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.
  • 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.
  • Throws: PHPUnit2_Framework_ComparisonFailure
  • Throws: InvalidArgumentException
  • Access: public

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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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.
  • 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
  • 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.

  • 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
  • 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.
  • 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.
  • 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.

  • Access: public

Parameters:

mixed   $expected   — 
mixed   $actual   — 
string   $message   — 

[ Top ]

assertThat   [line 586]

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

  • Since: Method available since Release 3.0.0
  • 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.
  • Throws: PHPUnit2_Framework_ComparisonFailure
  • Throws: InvalidArgumentException
  • Access: public

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.
  • Access: public

Parameters:

string   $expected   — 
mixed   $actual   — 
string   $message   — 

[ Top ]

equalTo   [line 694]

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

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

mixed   $value   — 
mixed   $delta   — 

[ Top ]

fail   [line 834]

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

Fails a test with the given message.
  • Throws: PHPUnit2_Framework_AssertionFailedError
  • Access: public

Parameters:

string   $message   — 

[ Top ]

failConstraint   [line 851]

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

Fails a test based on a failed constraint.
  • Since: Method available since Release 3.0.0
  • Throws: PHPUnit2_Framework_ExpectationFailedException
  • Access: public

Parameters:

PHPUnit2_Framework_Constraint   $constraint   — 
mixed   $value   — 
string   $message   — 
boolean   $type   — 

[ Top ]

fileExists   [line 707]

PHPUnit2_Framework_Constraint_FileExists fileExists( )

  • 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
  • Throws: InvalidArgumentException
  • Access: public

Parameters:

object   $object   — 
string   $propertyName   — 

[ Top ]

greaterThan   [line 721]

PHPUnit2_Framework_Constraint_GreaterThan greaterThan( mixed $value)

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

mixed   $value   — 

[ Top ]

hasProperty   [line 735]

PHPUnit2_Framework_Constraint_HasProperty hasProperty( string $property)

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

string   $property   — 

[ Top ]

identicalTo   [line 749]

PHPUnit2_Framework_Constraint_IsIdentical identicalTo( mixed $value)

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

mixed   $value   — 

[ Top ]

isInstanceOf   [line 763]

PHPUnit2_Framework_Constraint_IsInstanceOf isInstanceOf( string $className)

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

string   $className   — 

[ Top ]

isType   [line 777]

PHPUnit2_Framework_Constraint_IsType isType( string $type)

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

string   $type   — 

[ Top ]

lessThan   [line 791]

PHPUnit2_Framework_Constraint_LessThan lessThan( mixed $value)

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

mixed   $value   — 

[ Top ]

logicalAnd   [line 601]

PHPUnit2_Framework_Constraint_And logicalAnd( )

Logical AND.
  • Since: Method available since Release 3.0.0
  • Access: public

[ Top ]

logicalNot   [line 638]

PHPUnit2_Framework_Constraint_Not logicalNot( PHPUnit2_Framework_Constraint $constraint)

Logical NOT.
  • 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.
  • 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
  • Throws: PHPUnit2_Framework_IncompleteTestError
  • Access: public

Parameters:

string   $message   — 

[ Top ]

markTestSkipped   [line 935]

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

Mark the test as skipped.
  • Since: Method available since Release 3.0.0
  • Throws: PHPUnit2_Framework_SkippedTestError
  • Access: public

Parameters:

string   $message   — 

[ Top ]

matchesRegularExpression   [line 805]

PHPUnit2_Framework_Constraint_PCREMatch matchesRegularExpression( string $pattern)

  • 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)

  • Since: Method available since Release 3.0.0
  • Access: public

Parameters:

string   $string   — 
boolean   $case   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:40:37 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.