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 $moduleContainer
  • param ?array $config

Module constructor.

Requires module container (to provide access between modules of suite) and config.

See source

_after()

public _after($test)

  • param \Codeception\TestInterface $test

HOOK executed after test

See source

_afterStep()

public _afterStep($step)

  • param \Codeception\Step $step

HOOK executed after step

See source

_afterSuite()

public _afterSuite()

HOOK executed after suite

See source

_before()

public _before($test)

  • param \Codeception\TestInterface $test

HOOK executed before test

See source

_beforeStep()

public _beforeStep($step)

  • param \Codeception\Step $step

HOOK executed before step

See source

_beforeSuite()

public _beforeSuite(array $settings = array ( ))

  • param array $settings

HOOK executed before suite

See source

_failed()

public _failed($test, $fail)

  • param \Codeception\TestInterface $test
  • param \Exception $fail

HOOK executed when test fails but before _after

See source

_getConfig()

public _getConfig($key = null)

  • param string|null $key
  • return mixed the config item’s value or null if it doesn’t exist

Get config values or specific config item.

See source

_getName()

public _getName()

  • return string

Returns a module name for a Module, a class name for Helper

See source

_hasRequiredFields()

public _hasRequiredFields()

  • return bool

Checks if a module has required fields

See source

_initialize()

public _initialize()

HOOK triggered after module is created and configuration is loaded

See source

_reconfigure()

public _reconfigure(array $config)

  • param array $config
  • throws ModuleConfigException|ModuleException
  • return 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]);
    }
}

See source

_resetConfig()

public _resetConfig()

  • return void

Reverts config changed by _reconfigure

See source

_setConfig()

public _setConfig(array $config)

  • param array $config
  • throws ModuleConfigException|ModuleException
  • return 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);
}

See source

assert()

protected assert(array $arguments, $not = false)

  • param array $arguments
  • param bool $not

See source

assertArrayHasKey()

protected assertArrayHasKey($key, $array, $message = β€˜β€™)

  • param int|string $key
  • param array|\ArrayAccess $array
  • param string $message

Asserts that an array has a specified key.

See source

assertArrayNotHasKey()

protected assertArrayNotHasKey($key, $array, $message = β€˜β€™)

  • param int|string $key
  • param array|\ArrayAccess $array
  • param string $message

Asserts that an array does not have a specified key.

See source

assertClassHasAttribute()

protected assertClassHasAttribute($attributeName, $className, $message = β€˜β€™)

  • param string $attributeName
  • param string $className
  • param string $message

Asserts that a class has a specified attribute.

See source

assertClassHasStaticAttribute()

protected assertClassHasStaticAttribute($attributeName, $className, $message = β€˜β€™)

  • param string $attributeName
  • param string $className
  • param string $message

Asserts that a class has a specified static attribute.

See source

assertClassNotHasAttribute()

protected assertClassNotHasAttribute($attributeName, $className, $message = β€˜β€™)

  • param string $attributeName
  • param string $className
  • param string $message

Asserts that a class does not have a specified attribute.

See source

assertClassNotHasStaticAttribute()

protected assertClassNotHasStaticAttribute($attributeName, $className, $message = β€˜β€™)

  • param string $attributeName
  • param string $className
  • param string $message

Asserts that a class does not have a specified static attribute.

See source

assertContains()

protected assertContains($needle, $haystack, $message = β€˜β€™)

  • param mixed $needle
  • param iterable $haystack
  • param string $message

Asserts that a haystack contains a needle.

See source

assertContainsEquals()

protected assertContainsEquals($needle, $haystack, $message = β€˜β€™)

  • param mixed $needle
  • param iterable $haystack
  • param string $message

See source

assertContainsOnly()

protected assertContainsOnly($type, $haystack, $isNativeType = null, $message = β€˜β€™)

  • param string $type
  • param iterable $haystack
  • param ?bool $isNativeType
  • param string $message

Asserts that a haystack contains only values of a given type.

See source

assertContainsOnlyInstancesOf()

protected assertContainsOnlyInstancesOf($className, $haystack, $message = β€˜β€™)

  • param string $className
  • param iterable $haystack
  • param string $message

Asserts that a haystack contains only instances of a given class name.

See source

assertCount()

protected assertCount($expectedCount, $haystack, $message = β€˜β€™)

  • param int $expectedCount
  • param \Countable|iterable $haystack
  • param string $message

Asserts the number of elements of an array, Countable or Traversable.

See source

assertDirectoryDoesNotExist()

protected assertDirectoryDoesNotExist($directory, $message = β€˜β€™)

  • param string $directory
  • param string $message

Asserts that a directory does not exist.

See source

assertDirectoryExists()

protected assertDirectoryExists($directory, $message = β€˜β€™)

  • param string $directory
  • param string $message

Asserts that a directory exists.

See source

assertDirectoryIsNotReadable()

protected assertDirectoryIsNotReadable($directory, $message = β€˜β€™)

  • param string $directory
  • param string $message

Asserts that a directory exists and is not readable.

See source

assertDirectoryIsNotWritable()

protected assertDirectoryIsNotWritable($directory, $message = β€˜β€™)

  • param string $directory
  • param string $message

Asserts that a directory exists and is not writable.

See source

assertDirectoryIsReadable()

protected assertDirectoryIsReadable($directory, $message = β€˜β€™)

  • param string $directory
  • param string $message

Asserts that a directory exists and is readable.

See source

assertDirectoryIsWritable()

protected assertDirectoryIsWritable($directory, $message = β€˜β€™)

  • param string $directory
  • param string $message

Asserts that a directory exists and is writable.

See source

assertDoesNotMatchRegularExpression()

protected assertDoesNotMatchRegularExpression($pattern, $string, $message = β€˜β€™)

  • param string $pattern
  • param string $string
  • param string $message

Asserts that a string does not match a given regular expression.

See source

assertEmpty()

protected assertEmpty($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is empty.

See source

assertEquals()

protected assertEquals($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that two variables are equal.

See source

assertEqualsCanonicalizing()

protected assertEqualsCanonicalizing($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that two variables are equal (canonicalizing).

See source

assertEqualsIgnoringCase()

protected assertEqualsIgnoringCase($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that two variables are equal (ignoring case).

See source

assertEqualsWithDelta()

protected assertEqualsWithDelta($expected, $actual, $delta, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param float $delta
  • param string $message

Asserts that two variables are equal (with delta).

See source

assertFalse()

protected assertFalse($condition, $message = β€˜β€™)

  • param mixed $condition
  • param string $message

Asserts that a condition is false.

See source

assertFileDoesNotExist()

protected assertFileDoesNotExist($filename, $message = β€˜β€™)

  • param string $filename
  • param string $message

Asserts that a file does not exist.

See source

assertFileEquals()

protected assertFileEquals($expected, $actual, $message = β€˜β€™)

  • param string $expected
  • param string $actual
  • param string $message

Asserts that the contents of one file is equal to the contents of another file.

See source

assertFileEqualsCanonicalizing()

protected assertFileEqualsCanonicalizing($expected, $actual, $message = β€˜β€™)

  • param string $expected
  • param string $actual
  • param string $message

Asserts that the contents of one file is equal to the contents of another file (canonicalizing).

See source

assertFileEqualsIgnoringCase()

protected assertFileEqualsIgnoringCase($expected, $actual, $message = β€˜β€™)

  • param string $expected
  • param string $actual
  • param string $message

Asserts that the contents of one file is equal to the contents of another file (ignoring case).

See source

assertFileExists()

protected assertFileExists($filename, $message = β€˜β€™)

  • param string $filename
  • param string $message

Asserts that a file exists.

See source

assertFileIsNotReadable()

protected assertFileIsNotReadable($file, $message = β€˜β€™)

  • param string $file
  • param string $message

Asserts that a file exists and is not readable.

See source

assertFileIsNotWritable()

protected assertFileIsNotWritable($file, $message = β€˜β€™)

  • param string $file
  • param string $message

Asserts that a file exists and is not writable.

See source

assertFileIsReadable()

protected assertFileIsReadable($file, $message = β€˜β€™)

  • param string $file
  • param string $message

Asserts that a file exists and is readable.

See source

assertFileIsWritable()

protected assertFileIsWritable($file, $message = β€˜β€™)

  • param string $file
  • param string $message

Asserts that a file exists and is writable.

See source

assertFileNotEquals()

protected assertFileNotEquals($expected, $actual, $message = β€˜β€™)

  • param string $expected
  • param string $actual
  • param string $message

Asserts that the contents of one file is not equal to the contents of another file.

See source

assertFileNotEqualsCanonicalizing()

protected assertFileNotEqualsCanonicalizing($expected, $actual, $message = β€˜β€™)

  • param string $expected
  • param string $actual
  • param string $message

Asserts that the contents of one file is not equal to the contents of another file (canonicalizing).

See source

assertFileNotEqualsIgnoringCase()

protected assertFileNotEqualsIgnoringCase($expected, $actual, $message = β€˜β€™)

  • param string $expected
  • param string $actual
  • param string $message

Asserts that the contents of one file is not equal to the contents of another file (ignoring case).

See source

assertFileNotExists()

protected assertFileNotExists($filename, $message = β€˜β€™)

  • param string $filename
  • param string $message

Asserts that a file does not exist.

See source

assertFinite()

protected assertFinite($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is finite.

See source

assertGreaterOrEquals()

protected assertGreaterOrEquals($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that a value is greater than or equal to another value.

See source

assertGreaterThan()

protected assertGreaterThan($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that a value is greater than another value.

See source

assertGreaterThanOrEqual()

protected assertGreaterThanOrEqual($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that a value is greater than or equal to another value.

See source

assertInfinite()

protected assertInfinite($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is infinite.

See source

assertInstanceOf()

protected assertInstanceOf($expected, $actual, $message = β€˜β€™)

  • param string $expected
  • param mixed $actual
  • param string $message

Asserts that a variable is of a given type.

See source

assertIsArray()

protected assertIsArray($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type array.

See source

assertIsBool()

protected assertIsBool($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type bool.

See source

assertIsCallable()

protected assertIsCallable($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type callable.

See source

assertIsClosedResource()

protected assertIsClosedResource($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type resource and is closed.

See source

assertIsEmpty()

protected assertIsEmpty($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is empty.

See source

assertIsFloat()

protected assertIsFloat($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type float.

See source

assertIsInt()

protected assertIsInt($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type int.

See source

assertIsIterable()

protected assertIsIterable($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type iterable.

See source

assertIsNotArray()

protected assertIsNotArray($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type array.

See source

assertIsNotBool()

protected assertIsNotBool($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type bool.

See source

assertIsNotCallable()

protected assertIsNotCallable($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type callable.

See source

assertIsNotClosedResource()

protected assertIsNotClosedResource($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type resource.

See source

assertIsNotFloat()

protected assertIsNotFloat($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type float.

See source

assertIsNotInt()

protected assertIsNotInt($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type int.

See source

assertIsNotIterable()

protected assertIsNotIterable($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type iterable.

See source

assertIsNotNumeric()

protected assertIsNotNumeric($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type numeric.

See source

assertIsNotObject()

protected assertIsNotObject($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type object.

See source

assertIsNotReadable()

protected assertIsNotReadable($filename, $message = β€˜β€™)

  • param string $filename
  • param string $message

Asserts that a file/dir exists and is not readable.

See source

assertIsNotResource()

protected assertIsNotResource($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type resource.

See source

assertIsNotScalar()

protected assertIsNotScalar($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type scalar.

See source

assertIsNotString()

protected assertIsNotString($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not of type string.

See source

assertIsNotWritable()

protected assertIsNotWritable($filename, $message = β€˜β€™)

  • param string $filename
  • param string $message

Asserts that a file/dir exists and is not writable.

See source

assertIsNumeric()

protected assertIsNumeric($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type numeric.

See source

assertIsObject()

protected assertIsObject($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type object.

See source

assertIsReadable()

protected assertIsReadable($filename, $message = β€˜β€™)

  • param string $filename
  • param string $message

Asserts that a file/dir is readable.

See source

assertIsResource()

protected assertIsResource($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type resource.

See source

assertIsScalar()

protected assertIsScalar($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type scalar.

See source

assertIsString()

protected assertIsString($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is of type string.

See source

assertIsWritable()

protected assertIsWritable($filename, $message = β€˜β€™)

  • param string $filename
  • param string $message

Asserts that a file/dir exists and is writable.

See source

assertJson()

protected assertJson($actualJson, $message = β€˜β€™)

  • param string $actualJson
  • param string $message

Asserts that a string is a valid JSON string.

See source

assertJsonFileEqualsJsonFile()

protected assertJsonFileEqualsJsonFile($expectedFile, $actualFile, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualFile
  • param string $message

Asserts that two JSON files are equal.

See source

assertJsonFileNotEqualsJsonFile()

protected assertJsonFileNotEqualsJsonFile($expectedFile, $actualFile, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualFile
  • param string $message

Asserts that two JSON files are not equal.

See source

assertJsonStringEqualsJsonFile()

protected assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualJson
  • param string $message

Asserts that the generated JSON encoded object and the content of the given file are equal.

See source

assertJsonStringEqualsJsonString()

protected assertJsonStringEqualsJsonString($expectedJson, $actualJson, $message = β€˜β€™)

  • param string $expectedJson
  • param string $actualJson
  • param string $message

Asserts that two given JSON encoded objects or arrays are equal.

See source

assertJsonStringNotEqualsJsonFile()

protected assertJsonStringNotEqualsJsonFile($expectedFile, $actualJson, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualJson
  • param string $message

Asserts that the generated JSON encoded object and the content of the given file are not equal.

See source

assertJsonStringNotEqualsJsonString()

protected assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, $message = β€˜β€™)

  • param string $expectedJson
  • param string $actualJson
  • param string $message

Asserts that two given JSON encoded objects or arrays are not equal.

See source

assertLessOrEquals()

protected assertLessOrEquals($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that a value is smaller than or equal to another value.

See source

assertLessThan()

protected assertLessThan($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that a value is smaller than another value.

See source

assertLessThanOrEqual()

protected assertLessThanOrEqual($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that a value is smaller than or equal to another value.

See source

assertMatchesRegularExpression()

protected assertMatchesRegularExpression($pattern, $string, $message = β€˜β€™)

  • param string $pattern
  • param string $string
  • param string $message

Asserts that a string matches a given regular expression.

See source

assertNan()

protected assertNan($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is nan.

See source

assertNot()

protected assertNot($arguments)

  • param $arguments

See source

assertNotContains()

protected assertNotContains($needle, $haystack, $message = β€˜β€™)

  • param mixed $needle
  • param iterable $haystack
  • param string $message

Asserts that a haystack does not contain a needle.

See source

assertNotContainsEquals()

protected assertNotContainsEquals($needle, $haystack, $message = β€˜β€™)

  • param $needle
  • param iterable $haystack
  • param string $message

See source

assertNotContainsOnly()

protected assertNotContainsOnly($type, $haystack, $isNativeType = null, $message = β€˜β€™)

  • param string $type
  • param iterable $haystack
  • param ?bool $isNativeType
  • param string $message

Asserts that a haystack does not contain only values of a given type.

See source

assertNotCount()

protected assertNotCount($expectedCount, $haystack, $message = β€˜β€™)

  • param int $expectedCount
  • param \Countable|iterable $haystack
  • param string $message

Asserts the number of elements of an array, Countable or Traversable.

See source

assertNotEmpty()

protected assertNotEmpty($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not empty.

See source

assertNotEquals()

protected assertNotEquals($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that two variables are not equal.

See source

assertNotEqualsCanonicalizing()

protected assertNotEqualsCanonicalizing($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that two variables are not equal (canonicalizing).

See source

assertNotEqualsIgnoringCase()

protected assertNotEqualsIgnoringCase($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that two variables are not equal (ignoring case).

See source

assertNotEqualsWithDelta()

protected assertNotEqualsWithDelta($expected, $actual, $delta, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param float $delta
  • param string $message

Asserts that two variables are not equal (with delta).

See source

assertNotFalse()

protected assertNotFalse($condition, $message = β€˜β€™)

  • param mixed $condition
  • param string $message

Asserts that a condition is not false.

See source

assertNotInstanceOf()

protected assertNotInstanceOf($expected, $actual, $message = β€˜β€™)

  • param string $expected
  • param mixed $actual
  • param string $message

Asserts that a variable is not of a given type.

See source

assertNotNull()

protected assertNotNull($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is not null.

See source

assertNotRegExp()

protected assertNotRegExp($pattern, $string, $message = β€˜β€™)

  • param string $pattern
  • param string $string
  • param string $message

Asserts that a string does not match a given regular expression.

See source

assertNotSame()

protected assertNotSame($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

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

See source

assertNotSameSize()

protected assertNotSameSize($expected, $actual, $message = β€˜β€™)

  • param \Countable|iterable $expected
  • param \Countable|iterable $actual
  • param string $message

Assert that the size of two arrays (or Countable or Traversable objects) is not the same.

See source

assertNotTrue()

protected assertNotTrue($condition, $message = β€˜β€™)

  • param mixed $condition
  • param string $message

Asserts that a condition is not true.

See source

assertNull()

protected assertNull($actual, $message = β€˜β€™)

  • param mixed $actual
  • param string $message

Asserts that a variable is null.

See source

assertObjectHasAttribute()

protected assertObjectHasAttribute($attributeName, $object, $message = β€˜β€™)

  • param string $attributeName
  • param object $object
  • param string $message

Asserts that an object has a specified attribute.

See source

assertObjectNotHasAttribute()

protected assertObjectNotHasAttribute($attributeName, $object, $message = β€˜β€™)

  • param string $attributeName
  • param object $object
  • param string $message

Asserts that an object does not have a specified attribute.

See source

assertRegExp()

protected assertRegExp($pattern, $string, $message = β€˜β€™)

  • param string $pattern
  • param string $string
  • param string $message

Asserts that a string matches a given regular expression.

See source

assertSame()

protected assertSame($expected, $actual, $message = β€˜β€™)

  • param mixed $expected
  • param mixed $actual
  • param string $message

Asserts that two variables have the same type and value.

See source

assertSameSize()

protected assertSameSize($expected, $actual, $message = β€˜β€™)

  • param \Countable|iterable $expected
  • param \Countable|iterable $actual
  • param string $message

Assert that the size of two arrays (or Countable or Traversable objects) is the same.

See source

assertStringContainsString()

protected assertStringContainsString($needle, $haystack, $message = β€˜β€™)

  • param string $needle
  • param string $haystack
  • param string $message

See source

assertStringContainsStringIgnoringCase()

protected assertStringContainsStringIgnoringCase($needle, $haystack, $message = β€˜β€™)

  • param string $needle
  • param string $haystack
  • param string $message

See source

assertStringEndsNotWith()

protected assertStringEndsNotWith($suffix, $string, $message = β€˜β€™)

  • param string $suffix
  • param string $string
  • param string $message

Asserts that a string ends not with a given suffix.

See source

assertStringEndsWith()

protected assertStringEndsWith($suffix, $string, $message = β€˜β€™)

  • param string $suffix
  • param string $string
  • param string $message

Asserts that a string ends with a given suffix.

See source

assertStringEqualsFile()

protected assertStringEqualsFile($expectedFile, $actualString, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualString
  • param string $message

Asserts that the contents of a string is equal to the contents of a file.

See source

assertStringEqualsFileCanonicalizing()

protected assertStringEqualsFileCanonicalizing($expectedFile, $actualString, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualString
  • param string $message

Asserts that the contents of a string is equal to the contents of a file (canonicalizing).

See source

assertStringEqualsFileIgnoringCase()

protected assertStringEqualsFileIgnoringCase($expectedFile, $actualString, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualString
  • param string $message

Asserts that the contents of a string is equal to the contents of a file (ignoring case).

See source

assertStringMatchesFormat()

protected assertStringMatchesFormat($format, $string, $message = β€˜β€™)

  • param string $format
  • param string $string
  • param string $message

Asserts that a string matches a given format string.

See source

assertStringMatchesFormatFile()

protected assertStringMatchesFormatFile($formatFile, $string, $message = β€˜β€™)

  • param string $formatFile
  • param string $string
  • param string $message

Asserts that a string matches a given format file.

See source

assertStringNotContainsString()

protected assertStringNotContainsString($needle, $haystack, $message = β€˜β€™)

  • param string $needle
  • param string $haystack
  • param string $message

See source

assertStringNotContainsStringIgnoringCase()

protected assertStringNotContainsStringIgnoringCase($needle, $haystack, $message = β€˜β€™)

  • param string $needle
  • param string $haystack
  • param string $message

See source

assertStringNotEqualsFile()

protected assertStringNotEqualsFile($expectedFile, $actualString, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualString
  • param string $message

Asserts that the contents of a string is not equal to the contents of a file.

See source

assertStringNotEqualsFileCanonicalizing()

protected assertStringNotEqualsFileCanonicalizing($expectedFile, $actualString, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualString
  • param string $message

Asserts that the contents of a string is not equal to the contents of a file (canonicalizing).

See source

assertStringNotEqualsFileIgnoringCase()

protected assertStringNotEqualsFileIgnoringCase($expectedFile, $actualString, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualString
  • param string $message

Asserts that the contents of a string is not equal to the contents of a file (ignoring case).

See source

assertStringNotMatchesFormat()

protected assertStringNotMatchesFormat($format, $string, $message = β€˜β€™)

  • param string $format
  • param string $string
  • param string $message

Asserts that a string does not match a given format string.

See source

assertStringNotMatchesFormatFile()

protected assertStringNotMatchesFormatFile($formatFile, $string, $message = β€˜β€™)

  • param string $formatFile
  • param string $string
  • param string $message

Asserts that a string does not match a given format string.

See source

assertStringStartsNotWith()

protected assertStringStartsNotWith($prefix, $string, $message = β€˜β€™)

  • param string $prefix
  • param string $string
  • param string $message

Asserts that a string starts not with a given prefix.

See source

assertStringStartsWith()

protected assertStringStartsWith($prefix, $string, $message = β€˜β€™)

  • param string $prefix
  • param string $string
  • param string $message

Asserts that a string starts with a given prefix.

See source

assertThat()

protected assertThat($value, $constraint, $message = β€˜β€™)

  • param mixed $value
  • param \PHPUnit\Framework\Constraint\Constraint $constraint
  • param string $message

Evaluates a PHPUnit\Framework\Constraint matcher object.

See source

assertThatItsNot()

protected assertThatItsNot($value, $constraint, $message = β€˜β€™)

  • param mixed $value
  • param \PHPUnit\Framework\Constraint\Constraint $constraint
  • param string $message

Evaluates a PHPUnit\Framework\Constraint matcher object.

See source

assertTrue()

protected assertTrue($condition, $message = β€˜β€™)

  • param mixed $condition
  • param string $message

Asserts that a condition is true.

See source

assertXmlFileEqualsXmlFile()

protected assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualFile
  • param string $message

Asserts that two XML files are equal.

See source

assertXmlFileNotEqualsXmlFile()

protected assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile, $message = β€˜β€™)

  • param string $expectedFile
  • param string $actualFile
  • param string $message

Asserts that two XML files are not equal.

See source

assertXmlStringEqualsXmlFile()

protected assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $message = β€˜β€™)

  • param string $expectedFile
  • param \DOMDocument|string $actualXml
  • param string $message

Asserts that two XML documents are equal.

See source

assertXmlStringEqualsXmlString()

protected assertXmlStringEqualsXmlString($expectedXml, $actualXml, $message = β€˜β€™)

  • param \DOMDocument|string $expectedXml
  • param \DOMDocument|string $actualXml
  • param string $message

Asserts that two XML documents are equal.

See source

assertXmlStringNotEqualsXmlFile()

protected assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml, $message = β€˜β€™)

  • param string $expectedFile
  • param \DOMDocument|string $actualXml
  • param string $message

Asserts that two XML documents are not equal.

See source

assertXmlStringNotEqualsXmlString()

protected assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = β€˜β€™)

  • param \DOMDocument|string $expectedXml
  • param \DOMDocument|string $actualXml
  • param string $message

Asserts that two XML documents are not equal.

See source

debug()

protected debug($message)

  • param mixed $message
  • return void

Print debug message to the screen.

See source

debugSection()

protected debugSection($title, $message)

  • param string $title
  • param mixed $message
  • return void

Print debug message with a title

See source

fail()

protected fail($message = β€˜β€™)

  • param string $message

Fails a test with the given message.

See source

getModule()

protected getModule($name)

  • param string $name
  • throws ModuleException
  • return \Codeception\Module

Get another module by its name:

<?php
$this->getModule('WebDriver')->_findElements('.items');

See source

getModules()

protected getModules()

  • return array

Get all enabled modules

See source

hasModule()

protected hasModule($name)

  • param string $name
  • return bool

Checks that module is enabled.

See source

markTestIncomplete()

protected markTestIncomplete($message = β€˜β€™)

  • param string $message

Mark the test as incomplete.

See source

markTestSkipped()

protected markTestSkipped($message = β€˜β€™)

  • param string $message

Mark the test as skipped.

See source

onReconfigure()

protected onReconfigure()

HOOK to be executed when config changes with _reconfigure.

See source

scalarizeArray()

protected scalarizeArray(array $array)

  • param array $array
  • return array

See source

shortenMessage()

protected shortenMessage($message, $chars = 150)

  • param string $message
  • param int $chars
  • return string

Short text message to an amount of chars

See source

validateConfig()

protected validateConfig()

  • throws ModuleConfigException|ModuleException
  • return void

Validates current config for required fields and required packages.

See source

 

Reference is taken from the source code. Help us to improve documentation. Edit module reference
Don't know how to write tests on your own? We will build or improve them for you. Request a quote for official enterprise support or trainings