Overview

Namespaces

  • Budovy
  • Kdyby
    • BootstrapFormRenderer
      • DI
      • Latte
  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Diagnostics
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
      • Diagnostics
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • PhpGenerator
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
  • NetteModule
  • Nextras
    • Datagrid
  • None
  • PHP
  • Tester
    • CodeCoverage
    • Runner
      • Output
  • Vodacek
    • Forms
      • Controls
  • WebLoader
    • Filter
    • Nette

Classes

  • Assert
  • DataProvider
  • DomQuery
  • Dumper
  • Environment
  • Helpers
  • TestCase

Exceptions

  • AssertException
  • TestCaseException
  • Overview
  • Namespace
  • Class
  • Tree

Class Assert

Assertion test helpers.

Namespace: Tester
Author: David Grudl
Located at vendor/nette/tester/Tester/Framework/Assert.php
Methods summary
public static
# same( mixed $expected, mixed $actual )

Checks assertion. Values must be exactly the same.

Checks assertion. Values must be exactly the same.

public static
# notSame( mixed $expected, mixed $actual )

Checks assertion. Values must not be exactly the same.

Checks assertion. Values must not be exactly the same.

public static
# equal( mixed $expected, mixed $actual )

Checks assertion. The identity of objects and the order of keys in the arrays are ignored.

Checks assertion. The identity of objects and the order of keys in the arrays are ignored.

public static
# notEqual( mixed $expected, mixed $actual )

Checks assertion. The identity of objects and the order of keys in the arrays are ignored.

Checks assertion. The identity of objects and the order of keys in the arrays are ignored.

public static
# contains( mixed $needle, mixed $actual )

Checks assertion. Values must contains expected needle.

Checks assertion. Values must contains expected needle.

public static
# notContains( mixed $needle, mixed $actual )

Checks assertion. Values must not contains expected needle.

Checks assertion. Values must not contains expected needle.

public static
# true( mixed $actual )

Checks TRUE assertion.

Checks TRUE assertion.

Parameters

$actual
mixed
actual
public static
# false( mixed $actual )

Checks FALSE assertion.

Checks FALSE assertion.

Parameters

$actual
mixed
actual
public static
# null( mixed $actual )

Checks NULL assertion.

Checks NULL assertion.

Parameters

$actual
mixed
actual
public static
# truthy( mixed $actual )

Checks truthy assertion.

Checks truthy assertion.

Parameters

$actual
mixed
actual
public static
# falsey( mixed $actual )

Checks falsey (empty) assertion.

Checks falsey (empty) assertion.

Parameters

$actual
mixed
actual
public static
# type( mixed $type, mixed $value )

Checks assertion.

Checks assertion.

public static Exception
# exception( callable $function, string $class, string $message = NULL )

Checks if the function throws exception.

Checks if the function throws exception.

Parameters

$function
callable
$class
string
class
$message
string
message

Returns

Exception
public static Exception
# throws( mixed $function, mixed $class, mixed $message = NULL )

Checks if the function throws exception, alias for exception().

Checks if the function throws exception, alias for exception().

Returns

Exception
public static null|Exception
# error( callable $function, integer|string|array $expectedType, string $expectedMessage = NULL )

Checks if the function generates PHP error or throws exception.

Checks if the function generates PHP error or throws exception.

Parameters

$function
callable
$expectedType
integer|string|array
$expectedMessage
string
message

Returns

null|Exception
public static
# match( string $pattern, string $actual )

Compares result using regular expression or mask:
%a% one or more of anything except the end of line characters
%a?% zero or more of anything except the end of line characters
%A% one or more of anything including the end of line characters
%A?% zero or more of anything including the end of line characters
%s% one or more white space characters except the end of line characters
%s?% zero or more white space characters except the end of line characters
%S% one or more of characters except the white space
%S?% zero or more of characters except the white space
%c% a single character of any sort (except the end of line)
%d% one or more digits
%d?% zero or more digits
%i% signed integer value
%f% floating point number
%h% one or more HEX digits

Compares result using regular expression or mask: %a% one or more of anything except the end of line characters %a?% zero or more of anything except the end of line characters %A% one or more of anything including the end of line characters %A?% zero or more of anything including the end of line characters %s% one or more white space characters except the end of line characters %s?% zero or more white space characters except the end of line characters %S% one or more of characters except the white space %S?% zero or more of characters except the white space %c% a single character of any sort (except the end of line) %d% one or more digits %d?% zero or more digits %i% signed integer value %f% floating point number %h% one or more HEX digits

Parameters

$pattern
string
mask|regexp; only delimiters ~ and # are supported for regexp
$actual
string
public static
# matchFile( mixed $file, mixed $actual )

Compares results using mask sorted in file.

Compares results using mask sorted in file.

public static
# fail( mixed $message, mixed $actual = NULL, mixed $expected = NULL )

Failed assertion

Failed assertion

public static
# with( mixed $obj, Closure $closure )
Constants summary
float EPSILON 1e-10
#

used by equal() for comparing floats

used by equal() for comparing floats

Properties summary
public static array $patterns array( '%a%' => '[^\r\n]+', // one or more of anything except the end of line characters '%a\?%'=> '[^\r\n]*', // zero or more of anything except the end of line characters '%A%' => '.+', // one or more of anything including the end of line characters '%A\?%'=> '.*', // zero or more of anything including the end of line characters '%s%' => '[\t ]+', // one or more white space characters except the end of line characters '%s\?%'=> '[\t ]*', // zero or more white space characters except the end of line characters '%S%' => '\S+', // one or more of characters except the white space '%S\?%'=> '\S*', // zero or more of characters except the white space '%c%' => '[^\r\n]', // a single character of any sort (except the end of line) '%d%' => '[0-9]+', // one or more digits '%d\?%'=> '[0-9]*', // zero or more digits '%i%' => '[+-]?[0-9]+', // signed integer value '%f%' => '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?', // floating point number '%h%' => '[0-9a-fA-F]+',// one or more HEX digits '%ds%'=> '[\\\\/]', // directory separator '%(\[.*\].*)%'=> '$1', // range )
#

used by match(); in values, each $ followed by number is backreference

used by match(); in values, each $ followed by number is backreference

public static callable $onFailure
#

function(AssertException $exception)

function(AssertException $exception)

API documentation generated by ApiGen 2.8.0