Cake TestCase class
Cake\TestSuite\TestCase _assertAttributes( array $assertions , string $string , boolean $fullDebug false , array $regex '' )
Check the attributes as part of an assertTags() check.
$assertions $string $fullDebug optional false $regex optional '' assertHtml
string_normalizePath( string $path )
Normalize a path for comparison.
$path stringassertHtml( array $expected , string $string , boolean $fullDebug false )
Asserts HTML tags.
Takes an array $expected and generates a regex from it to match the provided $string. Samples for $expected:
Checks for an input tag with a name attribute (contains any non-empty value) and an id attribute that contains 'my-input':
['input' => ['name', 'id' => 'my-input']]
Checks for two p elements with some text in them:
[ ['p' => true], 'textA', '/p', ['p' => true], 'textB', '/p' ]
You can also specify a pattern expression as part of the attribute values, or the tag being defined, if you prepend the value with preg: and enclose it with slashes, like so:
[ ['input' => ['name', 'id' => 'preg:/FieldName\d+/']], 'preg:/My\s+field/' ]
Important: This function is very forgiving about whitespace and also accepts any permutation of attribute order. It will also allow whitespace between specified tags.
$expected $string $fullDebug optional false booleanassertNotWithinRange( float $expected , float $result , float $margin , string $message '' )
Compatibility function to test if a value is not between an acceptable range.
$expected $result $margin $message optional '' assertPathEquals( string $expected , string $result , string $message '' )
Compatibility function to test paths.
$expected $result $message optional '' assertTags( string $string , array $expected , boolean $fullDebug false )
Asserts HTML tags.
$string $expected $fullDebug optional false assertTextContains( string $needle , string $haystack , string $message '' , boolean $ignoreCase false )
Assert that a string contains another string, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
$needle $haystack $message optional '' $ignoreCase optional false assertTextEndsNotWith( string $suffix , string $string , string $message '' )
Asserts that a string ends not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
$suffix $string $message optional '' assertTextEndsWith( string $suffix , string $string , string $message '' )
Asserts that a string ends with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
$suffix $string $message optional '' assertTextEquals( string $expected , string $result , string $message '' )
Assert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
$expected $result $message optional '' assertTextNotContains( string $needle , string $haystack , string $message '' , boolean $ignoreCase false )
Assert that a text doesn't contain another text, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
$needle $haystack $message optional '' $ignoreCase optional false assertTextNotEquals( string $expected , string $result , string $message '' )
Assert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
$expected $result $message optional '' assertTextStartsNotWith( string $prefix , string $string , string $message '' )
Asserts that a string starts not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
$prefix $string $message optional '' assertTextStartsWith( string $prefix , string $string , string $message '' )
Asserts that a string starts with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
$prefix $string $message optional '' assertWithinRange( float $expected , float $result , float $margin , string $message '' )
Compatibility function to test if a value is between an acceptable range.
$expected $result $margin $message optional '' getMockForModel( string $alias , array $methods [] , array $options [] )
Mock a model, maintain fixtures and table association
$alias $methods optional [] $options optional [] Cake\ORM\Table|PHPUnit_Framework_MockObject_MockObjectCake\ORM\Exception\MissingTableClassExceptionloadFixtures( )
Chooses which fixtures to load for a given test
Each parameter is a model name that corresponds to a fixture, i.e. 'Posts', 'Authors', etc.
ExceptionCake\TestSuite\TestCase::$autoFixturessetUp( )
Setup the test case, backup the static object values so they can be restored. Specifically backs up the contents of Configure and paths in App if they have not already been backed up.
skipIf( boolean $shouldSkip , string $message '' )
Overrides SimpleTestCase::skipIf to provide a boolean return value
$shouldSkip $message optional '' booleanskipUnless( boolean $condition , string $message '' )
Compatibility function for skipping.
$condition $message optional '' boolean
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/3.1/class-Cake.TestSuite.TestCase.html