| CARVIEW |
Guides
- Introduction
- Getting Started
- Acceptance Tests
- Functional Tests
- Unit Tests
- Debugging
- Modules And Helpers
- Reusing Test Code
- Advanced Usage
- BDD
- Customization
- Data
- API Testing
- Codecoverage
- Reporting
- Continuous Integration
- Parallel Execution
Testomatio - Test Management for Codeception
Search
Codeception\Module
- Uses
Codeception\Util\Shared\Asserts
Basic class for Modules and Helpers. You must extend from it while implementing own helpers.
Public methods of this class start with _ prefix in order to ignore them in actor classes.
Module contains HOOKS which allow to handle test execution routine.
$includeInheritedActions
public static $includeInheritedActions
By setting it to false module wanβt inherit methods of parent class.
$onlyActions
public static $onlyActions
Allows to explicitly set what methods have this class.
$excludeActions
public static $excludeActions
Allows to explicitly exclude actions from module.
$aliases
public static $aliases
Allows to rename actions
__construct()
public __construct($moduleContainer, array $config = null)
param \Codeception\Lib\ModuleContainer$moduleContainerparam ?array$config
Module constructor.
Requires module container (to provide access between modules of suite) and config.
_after()
public _after($test)
param \Codeception\TestInterface$test
HOOK executed after test
_afterStep()
public _afterStep($step)
param \Codeception\Step$step
HOOK executed after step
_afterSuite()
public _afterSuite()
HOOK executed after suite
_before()
public _before($test)
param \Codeception\TestInterface$test
HOOK executed before test
_beforeStep()
public _beforeStep($step)
param \Codeception\Step$step
HOOK executed before step
_beforeSuite()
public _beforeSuite(array $settings = array ( ))
param array$settings
HOOK executed before suite
_failed()
public _failed($test, $fail)
param \Codeception\TestInterface$testparam \Exception$fail
HOOK executed when test fails but before _after
_getConfig()
public _getConfig($key = null)
param string|null$keyreturn mixedthe config itemβs value or null if it doesnβt exist
Get config values or specific config item.
_getName()
public _getName()
return string
Returns a module name for a Module, a class name for Helper
_hasRequiredFields()
public _hasRequiredFields()
return bool
Checks if a module has required fields
_initialize()
public _initialize()
HOOK triggered after module is created and configuration is loaded
_reconfigure()
public _reconfigure(array $config)
param array$configthrows ModuleConfigException|ModuleExceptionreturn void
Allows to redefine config for a specific test.
Config is restored at the end of a test.
<?php
// cleanup DB only for specific group of tests
public function _before(Test $test) {
if (in_array('cleanup', $test->getMetadata()->getGroups()) {
$this->getModule('Db')->_reconfigure(['cleanup' => true]);
}
}_resetConfig()
public _resetConfig()
return void
Reverts config changed by _reconfigure
_setConfig()
public _setConfig(array $config)
param array$configthrows ModuleConfigException|ModuleExceptionreturn void
Allows to define initial module config.
Can be used in _beforeSuite hook of Helpers or Extensions
<?php
public function _beforeSuite($settings = []) {
$this->getModule('otherModule')->_setConfig($this->myOtherConfig);
}assert()
protected assert(array $arguments, $not = false)
param array$argumentsparam bool$notreturn void
assertArrayHasKey()
protected assertArrayHasKey($key, $array, $message = ββ)
param string|int$keyparam \ArrayAccess|array$arrayparam string$messagereturn void
Asserts that an array has a specified key.
assertArrayNotHasKey()
protected assertArrayNotHasKey($key, $array, $message = ββ)
param string|int$keyparam \ArrayAccess|array$arrayparam string$messagereturn void
Asserts that an array does not have a specified key.
assertClassHasAttribute()
protected assertClassHasAttribute($attributeName, $className, $message = ββ)
param string$attributeNameparam class-string$classNameparam string$messagereturn void
Asserts that a class has a specified attribute.
assertClassHasStaticAttribute()
protected assertClassHasStaticAttribute($attributeName, $className, $message = ββ)
param string$attributeNameparam class-string$classNameparam string$messagereturn void
Asserts that a class has a specified static attribute.
assertClassNotHasAttribute()
protected assertClassNotHasAttribute($attributeName, $className, $message = ββ)
param string$attributeNameparam class-string$classNameparam string$messagereturn void
Asserts that a class does not have a specified attribute.
assertClassNotHasStaticAttribute()
protected assertClassNotHasStaticAttribute($attributeName, $className, $message = ββ)
param string$attributeNameparam class-string$classNameparam string$messagereturn void
Asserts that a class does not have a specified static attribute.
assertContains()
protected assertContains($needle, $haystack, $message = ββ)
param mixed$needleparam iterable<mixed>$haystackparam string$messagereturn void
Asserts that a haystack contains a needle.
assertContainsEquals()
protected assertContainsEquals($needle, $haystack, $message = ββ)
param mixed$needleparam iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyArray()
protected assertContainsNotOnlyArray($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyBool()
protected assertContainsNotOnlyBool($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyCallable()
protected assertContainsNotOnlyCallable($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyClosedResource()
protected assertContainsNotOnlyClosedResource($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyFloat()
protected assertContainsNotOnlyFloat($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyInstancesOf()
protected assertContainsNotOnlyInstancesOf($className, $haystack, $message = ββ)
param class-string$classNameparam iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyInt()
protected assertContainsNotOnlyInt($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyIterable()
protected assertContainsNotOnlyIterable($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyNull()
protected assertContainsNotOnlyNull($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyNumeric()
protected assertContainsNotOnlyNumeric($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyObject()
protected assertContainsNotOnlyObject($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyResource()
protected assertContainsNotOnlyResource($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyScalar()
protected assertContainsNotOnlyScalar($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsNotOnlyString()
protected assertContainsNotOnlyString($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnly()
protected assertContainsOnly($type, $haystack, $isNativeType = null, $message = ββ)
param string$typeparam iterable<mixed>$haystackparam ?bool$isNativeTypeparam string$messagereturn void
Asserts that a haystack contains only values of a given type.
assertContainsOnlyArray()
protected assertContainsOnlyArray($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyBool()
protected assertContainsOnlyBool($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyCallable()
protected assertContainsOnlyCallable($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyClosedResource()
protected assertContainsOnlyClosedResource($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyFloat()
protected assertContainsOnlyFloat($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyInstancesOf()
protected assertContainsOnlyInstancesOf($className, $haystack, $message = ββ)
param class-string$classNameparam iterable<mixed>$haystackparam string$messagereturn void
Asserts that a haystack contains only instances of a given class name.
assertContainsOnlyInt()
protected assertContainsOnlyInt($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyIterable()
protected assertContainsOnlyIterable($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyNull()
protected assertContainsOnlyNull($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyNumeric()
protected assertContainsOnlyNumeric($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyObject()
protected assertContainsOnlyObject($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyResource()
protected assertContainsOnlyResource($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyScalar()
protected assertContainsOnlyScalar($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertContainsOnlyString()
protected assertContainsOnlyString($haystack, $message = ββ)
param iterable<mixed>$haystackparam string$messagereturn void
assertCount()
protected assertCount($expectedCount, $haystack, $message = ββ)
param int$expectedCountparam \Countable|iterable<mixed>$haystackparam string$messagereturn void
Asserts the number of elements of an array, Countable or Traversable.
assertDirectoryDoesNotExist()
protected assertDirectoryDoesNotExist($directory, $message = ββ)
param string$directoryparam string$messagereturn void
Asserts that a directory does not exist.
assertDirectoryExists()
protected assertDirectoryExists($directory, $message = ββ)
param string$directoryparam string$messagereturn void
Asserts that a directory exists.
assertDirectoryIsNotReadable()
protected assertDirectoryIsNotReadable($directory, $message = ββ)
param string$directoryparam string$messagereturn void
Asserts that a directory exists and is not readable.
assertDirectoryIsNotWritable()
protected assertDirectoryIsNotWritable($directory, $message = ββ)
param string$directoryparam string$messagereturn void
Asserts that a directory exists and is not writable.
assertDirectoryIsReadable()
protected assertDirectoryIsReadable($directory, $message = ββ)
param string$directoryparam string$messagereturn void
Asserts that a directory exists and is readable.
assertDirectoryIsWritable()
protected assertDirectoryIsWritable($directory, $message = ββ)
param string$directoryparam string$messagereturn void
Asserts that a directory exists and is writable.
assertDoesNotMatchRegularExpression()
protected assertDoesNotMatchRegularExpression($pattern, $string, $message = ββ)
param string$patternparam string$stringparam string$messagereturn void
Asserts that a string does not match a given regular expression.
assertEmpty()
protected assertEmpty($actual, $message = ββ)
phpstan-assertempty $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is empty.
assertEquals()
protected assertEquals($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that two variables are equal.
assertEqualsCanonicalizing()
protected assertEqualsCanonicalizing($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that two variables are equal (canonicalizing).
assertEqualsIgnoringCase()
protected assertEqualsIgnoringCase($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that two variables are equal (ignoring case).
assertEqualsWithDelta()
protected assertEqualsWithDelta($expected, $actual, $delta, $message = ββ)
param mixed$expectedparam mixed$actualparam float$deltaparam string$messagereturn void
Asserts that two variables are equal (with delta).
assertFalse()
protected assertFalse($condition, $message = ββ)
phpstan-assertfalse $conditionparam mixed$conditionparam string$messagereturn void
Asserts that a condition is false.
assertFileDoesNotExist()
protected assertFileDoesNotExist($filename, $message = ββ)
param string$filenameparam string$messagereturn void
Asserts that a file does not exist.
assertFileEquals()
protected assertFileEquals($expected, $actual, $message = ββ)
param string$expectedparam string$actualparam string$messagereturn void
Asserts that the contents of one file is equal to the contents of another file.
assertFileEqualsCanonicalizing()
protected assertFileEqualsCanonicalizing($expected, $actual, $message = ββ)
param string$expectedparam string$actualparam string$messagereturn void
Asserts that the contents of one file is equal to the contents of another file (canonicalizing).
assertFileEqualsIgnoringCase()
protected assertFileEqualsIgnoringCase($expected, $actual, $message = ββ)
param string$expectedparam string$actualparam string$messagereturn void
Asserts that the contents of one file is equal to the contents of another file (ignoring case).
assertFileExists()
protected assertFileExists($filename, $message = ββ)
param string$filenameparam string$messagereturn void
Asserts that a file exists.
assertFileIsNotReadable()
protected assertFileIsNotReadable($file, $message = ββ)
param string$fileparam string$messagereturn void
Asserts that a file exists and is not readable.
assertFileIsNotWritable()
protected assertFileIsNotWritable($file, $message = ββ)
param string$fileparam string$messagereturn void
Asserts that a file exists and is not writable.
assertFileIsReadable()
protected assertFileIsReadable($file, $message = ββ)
param string$fileparam string$messagereturn void
Asserts that a file exists and is readable.
assertFileIsWritable()
protected assertFileIsWritable($file, $message = ββ)
param string$fileparam string$messagereturn void
Asserts that a file exists and is writable.
assertFileNotEquals()
protected assertFileNotEquals($expected, $actual, $message = ββ)
param string$expectedparam string$actualparam string$messagereturn void
Asserts that the contents of one file is not equal to the contents of another file.
assertFileNotEqualsCanonicalizing()
protected assertFileNotEqualsCanonicalizing($expected, $actual, $message = ββ)
param string$expectedparam string$actualparam string$messagereturn void
Asserts that the contents of one file is not equal to the contents of another file (canonicalizing).
assertFileNotEqualsIgnoringCase()
protected assertFileNotEqualsIgnoringCase($expected, $actual, $message = ββ)
param string$expectedparam string$actualparam string$messagereturn void
Asserts that the contents of one file is not equal to the contents of another file (ignoring case).
assertFileNotExists()
protected assertFileNotExists($filename, $message = ββ)
param string$filenameparam string$messagereturn void
Asserts that a file does not exist.
assertFinite()
protected assertFinite($actual, $message = ββ)
param mixed$actualparam string$messagereturn void
Asserts that a variable is finite.
assertGreaterOrEquals()
protected assertGreaterOrEquals($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that a value is greater than or equal to another value.
assertGreaterThan()
protected assertGreaterThan($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that a value is greater than another value.
assertGreaterThanOrEqual()
protected assertGreaterThanOrEqual($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that a value is greater than or equal to another value.
assertInfinite()
protected assertInfinite($actual, $message = ββ)
param mixed$actualparam string$messagereturn void
Asserts that a variable is infinite.
assertInstanceOf()
protected assertInstanceOf($expected, $actual, $message = ββ)
templateExpectedType of objectphpstan-assert=ExpectedType $actualparam class-string<ExpectedType>$expectedparam mixed$actualparam string$messagereturn void
Asserts that a variable is of a given type.
assertIsArray()
protected assertIsArray($actual, $message = ββ)
phpstan-assertarray$actual param mixed$actualparam string$messagereturn void
Asserts that a variable is of type array.
assertIsBool()
protected assertIsBool($actual, $message = ββ)
phpstan-assertbool $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type bool.
assertIsCallable()
protected assertIsCallable($actual, $message = ββ)
phpstan-assertcallable $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type callable.
assertIsClosedResource()
protected assertIsClosedResource($actual, $message = ββ)
phpstan-assertresource $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type resource and is closed.
assertIsEmpty()
protected assertIsEmpty($actual, $message = ββ)
param mixed$actualparam string$messagereturn void
Asserts that a variable is empty.
assertIsFloat()
protected assertIsFloat($actual, $message = ββ)
phpstan-assertfloat $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type float.
assertIsInt()
protected assertIsInt($actual, $message = ββ)
phpstan-assertint $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type int.
assertIsIterable()
protected assertIsIterable($actual, $message = ββ)
phpstan-assertiterable$actual param mixed$actualparam string$messagereturn void
Asserts that a variable is of type iterable.
assertIsNotArray()
protected assertIsNotArray($actual, $message = ββ)
phpstan-assert!array$actual param mixed$actualparam string$messagereturn void
Asserts that a variable is not of type array.
assertIsNotBool()
protected assertIsNotBool($actual, $message = ββ)
phpstan-assert!bool $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type bool.
assertIsNotCallable()
protected assertIsNotCallable($actual, $message = ββ)
phpstan-assert!callable $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type callable.
assertIsNotClosedResource()
protected assertIsNotClosedResource($actual, $message = ββ)
phpstan-assert!resource $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type resource.
assertIsNotFloat()
protected assertIsNotFloat($actual, $message = ββ)
phpstan-assert!float $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type float.
assertIsNotInt()
protected assertIsNotInt($actual, $message = ββ)
phpstan-assert!int $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type int.
assertIsNotIterable()
protected assertIsNotIterable($actual, $message = ββ)
phpstan-assert!iterable$actual param mixed$actualparam string$messagereturn void
Asserts that a variable is not of type iterable.
assertIsNotNumeric()
protected assertIsNotNumeric($actual, $message = ββ)
phpstan-assert!numeric $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type numeric.
assertIsNotObject()
protected assertIsNotObject($actual, $message = ββ)
phpstan-assert!object $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type object.
assertIsNotReadable()
protected assertIsNotReadable($filename, $message = ββ)
param string$filenameparam string$messagereturn void
Asserts that a file/dir exists and is not readable.
assertIsNotResource()
protected assertIsNotResource($actual, $message = ββ)
phpstan-assert!resource $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type resource.
assertIsNotScalar()
protected assertIsNotScalar($actual, $message = ββ)
psalm-assert!scalar $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type scalar.
assertIsNotString()
protected assertIsNotString($actual, $message = ββ)
phpstan-assert!string $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of type string.
assertIsNotWritable()
protected assertIsNotWritable($filename, $message = ββ)
param string$filenameparam string$messagereturn void
Asserts that a file/dir exists and is not writable.
assertIsNumeric()
protected assertIsNumeric($actual, $message = ββ)
phpstan-assertnumeric $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type numeric.
assertIsObject()
protected assertIsObject($actual, $message = ββ)
phpstan-assertobject $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type object.
assertIsReadable()
protected assertIsReadable($filename, $message = ββ)
param string$filenameparam string$messagereturn void
Asserts that a file/dir is readable.
assertIsResource()
protected assertIsResource($actual, $message = ββ)
phpstan-assertresource $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type resource.
assertIsScalar()
protected assertIsScalar($actual, $message = ββ)
phpstan-assertscalar $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type scalar.
assertIsString()
protected assertIsString($actual, $message = ββ)
phpstan-assertstring $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is of type string.
assertIsWritable()
protected assertIsWritable($filename, $message = ββ)
param string$filenameparam string$messagereturn void
Asserts that a file/dir exists and is writable.
assertJson()
protected assertJson($actualJson, $message = ββ)
param string$actualJsonparam string$messagereturn void
Asserts that a string is a valid JSON string.
assertJsonFileEqualsJsonFile()
protected assertJsonFileEqualsJsonFile($expectedFile, $actualFile, $message = ββ)
param string$expectedFileparam string$actualFileparam string$messagereturn void
Asserts that two JSON files are equal.
assertJsonFileNotEqualsJsonFile()
protected assertJsonFileNotEqualsJsonFile($expectedFile, $actualFile, $message = ββ)
param string$expectedFileparam string$actualFileparam string$messagereturn void
Asserts that two JSON files are not equal.
assertJsonStringEqualsJsonFile()
protected assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = ββ)
param string$expectedFileparam string$actualJsonparam string$messagereturn void
Asserts that the generated JSON encoded object and the content of the given file are equal.
assertJsonStringEqualsJsonString()
protected assertJsonStringEqualsJsonString($expectedJson, $actualJson, $message = ββ)
param string$expectedJsonparam string$actualJsonparam string$messagereturn void
Asserts that two given JSON encoded objects or arrays are equal.
assertJsonStringNotEqualsJsonFile()
protected assertJsonStringNotEqualsJsonFile($expectedFile, $actualJson, $message = ββ)
param string$expectedFileparam string$actualJsonparam string$messagereturn void
Asserts that the generated JSON encoded object and the content of the given file are not equal.
assertJsonStringNotEqualsJsonString()
protected assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, $message = ββ)
param string$expectedJsonparam string$actualJsonparam string$messagereturn void
Asserts that two given JSON encoded objects or arrays are not equal.
assertLessOrEquals()
protected assertLessOrEquals($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that a value is smaller than or equal to another value.
assertLessThan()
protected assertLessThan($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that a value is smaller than another value.
assertLessThanOrEqual()
protected assertLessThanOrEqual($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that a value is smaller than or equal to another value.
assertMatchesRegularExpression()
protected assertMatchesRegularExpression($pattern, $string, $message = ββ)
param string$patternparam string$stringparam string$messagereturn void
Asserts that a string matches a given regular expression.
assertNan()
protected assertNan($actual, $message = ββ)
param mixed$actualparam string$messagereturn void
Asserts that a variable is nan.
assertNot()
protected assertNot(array $arguments)
param array$argumentsreturn void
assertNotContains()
protected assertNotContains($needle, $haystack, $message = ββ)
param mixed$needleparam iterable<mixed>$haystackparam string$messagereturn void
Asserts that a haystack does not contain a needle.
assertNotContainsEquals()
protected assertNotContainsEquals($needle, $haystack, $message = ββ)
param mixed$needleparam iterable<mixed>$haystackparam string$messagereturn void
assertNotContainsOnly()
protected assertNotContainsOnly($type, $haystack, $isNativeType = null, $message = ββ)
param string$typeparam iterable<mixed>$haystackparam ?bool$isNativeTypeparam string$messagereturn void
Asserts that a haystack does not contain only values of a given type.
assertNotCount()
protected assertNotCount($expectedCount, $haystack, $message = ββ)
param int$expectedCountparam \Countable|iterable<mixed>$haystackparam string$messagereturn void
Asserts the number of elements of an array, Countable or Traversable.
assertNotEmpty()
protected assertNotEmpty($actual, $message = ββ)
phpstan-assert!empty $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not empty.
assertNotEquals()
protected assertNotEquals($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that two variables are not equal.
assertNotEqualsCanonicalizing()
protected assertNotEqualsCanonicalizing($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that two variables are not equal (canonicalizing).
assertNotEqualsIgnoringCase()
protected assertNotEqualsIgnoringCase($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that two variables are not equal (ignoring case).
assertNotEqualsWithDelta()
protected assertNotEqualsWithDelta($expected, $actual, $delta, $message = ββ)
param mixed$expectedparam mixed$actualparam float$deltaparam string$messagereturn void
Asserts that two variables are not equal (with delta).
assertNotFalse()
protected assertNotFalse($condition, $message = ββ)
phpstan-assert!false $conditionparam mixed$conditionparam string$messagereturn void
Asserts that a condition is not false.
assertNotInstanceOf()
protected assertNotInstanceOf($expected, $actual, $message = ββ)
templateExpectedType of objectphpstan-assert!ExpectedType $actualparam class-string<ExpectedType>$expectedparam mixed$actualparam string$messagereturn void
Asserts that a variable is not of a given type.
assertNotNull()
protected assertNotNull($actual, $message = ββ)
phpstan-assert!null $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is not null.
assertNotRegExp()
protected assertNotRegExp($pattern, $string, $message = ββ)
param string$patternparam string$stringparam string$messagereturn void
Asserts that a string does not match a given regular expression.
assertNotSame()
protected assertNotSame($expected, $actual, $message = ββ)
param mixed$expectedparam mixed$actualparam string$messagereturn void
Asserts that two variables do not have the same type and value.
assertNotSameSize()
protected assertNotSameSize($expected, $actual, $message = ββ)
param \Countable|iterable<mixed>$expectedparam \Countable|iterable<mixed>$actualparam string$messagereturn void
Assert that the size of two arrays (or Countable or Traversable objects) is not the same.
assertNotTrue()
protected assertNotTrue($condition, $message = ββ)
phpstan-assert!true $conditionparam mixed$conditionparam string$messagereturn void
Asserts that a condition is not true.
assertNull()
protected assertNull($actual, $message = ββ)
phpstan-assertnull $actualparam mixed$actualparam string$messagereturn void
Asserts that a variable is null.
assertObjectHasAttribute()
protected assertObjectHasAttribute($attributeName, $object, $message = ββ)
param string$attributeNameparam object$objectparam string$messagereturn void
Asserts that an object has a specified attribute.
assertObjectNotHasAttribute()
protected assertObjectNotHasAttribute($attributeName, $object, $message = ββ)
param string$attributeNameparam object$objectparam string$messagereturn void
Asserts that an object does not have a specified attribute.
assertRegExp()
protected assertRegExp($pattern, $string, $message = ββ)
param string$patternparam string$stringparam string$messagereturn void
Asserts that a string matches a given regular expression.
assertSame()
protected assertSame($expected, $actual, $message = ββ)
templateExpectedTypephpstan-assert=ExpectedType $actualparam ExpectedType$expectedparam mixed$actualparam string$messagereturn void
Asserts that two variables have the same type and value.
Used on objects, it asserts that two variables reference the same object.
assertSameSize()
protected assertSameSize($expected, $actual, $message = ββ)
param \Countable|iterable<mixed>$expectedparam \Countable|iterable<mixed>$actualparam string$messagereturn void
Assert that the size of two arrays (or Countable or Traversable objects) is the same.
assertStringContainsString()
protected assertStringContainsString($needle, $haystack, $message = ββ)
param string$needleparam string$haystackparam string$messagereturn void
assertStringContainsStringIgnoringCase()
protected assertStringContainsStringIgnoringCase($needle, $haystack, $message = ββ)
param string$needleparam string$haystackparam string$messagereturn void
assertStringEndsNotWith()
protected assertStringEndsNotWith($suffix, $string, $message = ββ)
param non-empty-string$suffixparam string$stringparam string$messagereturn void
Asserts that a string ends not with a given suffix.
assertStringEndsWith()
protected assertStringEndsWith($suffix, $string, $message = ββ)
param non-empty-string$suffixparam string$stringparam string$messagereturn void
Asserts that a string ends with a given suffix.
assertStringEqualsFile()
protected assertStringEqualsFile($expectedFile, $actualString, $message = ββ)
param string$expectedFileparam string$actualStringparam string$messagereturn void
Asserts that the contents of a string is equal to the contents of a file.
assertStringEqualsFileCanonicalizing()
protected assertStringEqualsFileCanonicalizing($expectedFile, $actualString, $message = ββ)
param string$expectedFileparam string$actualStringparam string$messagereturn void
Asserts that the contents of a string is equal to the contents of a file (canonicalizing).
assertStringEqualsFileIgnoringCase()
protected assertStringEqualsFileIgnoringCase($expectedFile, $actualString, $message = ββ)
param string$expectedFileparam string$actualStringparam string$messagereturn void
Asserts that the contents of a string is equal to the contents of a file (ignoring case).
assertStringMatchesFormat()
protected assertStringMatchesFormat($format, $string, $message = ββ)
param string$formatparam string$stringparam string$messagereturn void
Asserts that a string matches a given format string.
assertStringMatchesFormatFile()
protected assertStringMatchesFormatFile($formatFile, $string, $message = ββ)
param string$formatFileparam string$stringparam string$messagereturn void
Asserts that a string matches a given format file.
assertStringNotContainsString()
protected assertStringNotContainsString($needle, $haystack, $message = ββ)
param string$needleparam string$haystackparam string$messagereturn void
assertStringNotContainsStringIgnoringCase()
protected assertStringNotContainsStringIgnoringCase($needle, $haystack, $message = ββ)
param string$needleparam string$haystackparam string$messagereturn void
assertStringNotEqualsFile()
protected assertStringNotEqualsFile($expectedFile, $actualString, $message = ββ)
param string$expectedFileparam string$actualStringparam string$messagereturn void
Asserts that the contents of a string is not equal to the contents of a file.
assertStringNotEqualsFileCanonicalizing()
protected assertStringNotEqualsFileCanonicalizing($expectedFile, $actualString, $message = ββ)
param string$expectedFileparam string$actualStringparam string$messagereturn void
Asserts that the contents of a string is not equal to the contents of a file (canonicalizing).
assertStringNotEqualsFileIgnoringCase()
protected assertStringNotEqualsFileIgnoringCase($expectedFile, $actualString, $message = ββ)
param string$expectedFileparam string$actualStringparam string$messagereturn void
Asserts that the contents of a string is not equal to the contents of a file (ignoring case).
assertStringNotMatchesFormat()
protected assertStringNotMatchesFormat($format, $string, $message = ββ)
param string$formatparam string$stringparam string$messagereturn void
Asserts that a string does not match a given format string.
assertStringNotMatchesFormatFile()
protected assertStringNotMatchesFormatFile($formatFile, $string, $message = ββ)
param string$formatFileparam string$stringparam string$messagereturn void
Asserts that a string does not match a given format string.
assertStringStartsNotWith()
protected assertStringStartsNotWith($prefix, $string, $message = ββ)
param non-empty-string$prefixparam string$stringparam string$messagereturn void
Asserts that a string starts not with a given prefix.
assertStringStartsWith()
protected assertStringStartsWith($prefix, $string, $message = ββ)
param non-empty-string$prefixparam string$stringparam string$messagereturn void
Asserts that a string starts with a given prefix.
assertThat()
protected assertThat($value, $constraint, $message = ββ)
param mixed$valueparam \PHPUnit\Framework\Constraint\Constraint$constraintparam string$messagereturn void
Evaluates a PHPUnit\Framework\Constraint matcher object.
assertThatItsNot()
protected assertThatItsNot($value, $constraint, $message = ββ)
param mixed$valueparam \PHPUnit\Framework\Constraint\Constraint$constraintparam string$messagereturn void
Evaluates a PHPUnit\Framework\Constraint matcher object.
assertTrue()
protected assertTrue($condition, $message = ββ)
phpstan-asserttrue $conditionparam mixed$conditionparam string$messagereturn void
Asserts that a condition is true.
assertXmlFileEqualsXmlFile()
protected assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = ββ)
param string$expectedFileparam string$actualFileparam string$messagereturn void
Asserts that two XML files are equal.
assertXmlFileNotEqualsXmlFile()
protected assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile, $message = ββ)
param string$expectedFileparam string$actualFileparam string$messagereturn void
Asserts that two XML files are not equal.
assertXmlStringEqualsXmlFile()
protected assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $message = ββ)
param string$expectedFileparam \DOMDocument|string$actualXmlparam string$messagereturn void
Asserts that two XML documents are equal.
assertXmlStringEqualsXmlString()
protected assertXmlStringEqualsXmlString($expectedXml, $actualXml, $message = ββ)
param \DOMDocument|string$expectedXmlparam \DOMDocument|string$actualXmlparam string$messagereturn void
Asserts that two XML documents are equal.
assertXmlStringNotEqualsXmlFile()
protected assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml, $message = ββ)
param string$expectedFileparam \DOMDocument|string$actualXmlparam string$messagereturn void
Asserts that two XML documents are not equal.
assertXmlStringNotEqualsXmlString()
protected assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = ββ)
param \DOMDocument|string$expectedXmlparam \DOMDocument|string$actualXmlparam string$messagereturn void
Asserts that two XML documents are not equal.
debug()
protected debug($message)
param mixed$messagereturn void
Print debug message to the screen.
debugSection()
protected debugSection($title, $msg)
param string$titleparam mixed$msgreturn void
Print debug message with a title
fail()
protected fail($message = ββ)
param string$messagereturn never
Fails a test with the given message.
getModule()
protected getModule($name)
param string$namethrows ModuleExceptionreturn \Codeception\Module
Get another module by its name:
<?php
$this->getModule('WebDriver')->_findElements('.items');getModules()
protected getModules()
return array
Get all enabled modules
hasModule()
protected hasModule($name)
param string$namereturn bool
Checks that module is enabled.
hasStaticAttribute()
private static hasStaticAttribute($attributeName, $className)
seehttps://github.com/sebastianbergmann/phpunit/blob/9.6/src/Framework/Constraint/Object/ClassHasStaticAttribute.phpparam string$attributeNameparam class-string$classNamereturn bool
markTestIncomplete()
protected markTestIncomplete($message = ββ)
param string$messagereturn never
Mark the test as incomplete.
markTestSkipped()
protected markTestSkipped($message = ββ)
param string$messagereturn never
Mark the test as skipped.
onReconfigure()
protected onReconfigure()
HOOK to be executed when config changes with _reconfigure.
scalarizeArray()
protected scalarizeArray(array $array)
param array$arrayreturn array
shortenMessage()
protected shortenMessage($message, $chars = 150)
param string$messageparam int$charsreturn string
Short text message to an amount of chars
validateConfig()
protected validateConfig()
throws ModuleConfigException|ModuleExceptionreturn void
Validates current config for required fields and required packages.
Codeception is a BDD-styled PHP testing framework, brought to you by Codeception Team. OpenSource MIT Licensed.

