W3cubDocs

/Yii 2.0

Class yii\codeception\TestCase

Inheritance yii\codeception\TestCase » Codeception\TestCase\Test
Uses Traits yii\test\FixtureTrait
Subclasses yii\codeception\DbTestCase
Available since version 2.0
Source Code https://github.com/yiisoft/yii2-codeception/blob/master/TestCase.php

TestCase is the base class for all codeception unit tests

Public Properties

Property Type Description Defined By
$appConfig array|string The application configuration that will be used for creating an application instance for each test. yii\codeception\TestCase

Public Methods

Method Description Defined By
__call() Calls the named method which is not a class method. yii\codeception\TestCase
__get() Returns the value of an object property. yii\codeception\TestCase
fixtures() Declares the fixtures that are needed by the current test case. yii\test\FixtureTrait
getFixture() Returns the named fixture. yii\test\FixtureTrait
getFixtures() Returns the fixture objects as specified in globalFixtures() and fixtures(). yii\test\FixtureTrait
globalFixtures() Declares the fixtures shared required by different test cases. yii\test\FixtureTrait
initFixtures() Initialize the fixtures yii\test\FixtureTrait
loadFixtures() Loads the specified fixtures. yii\test\FixtureTrait
unloadFixtures() Unloads the specified fixtures. yii\test\FixtureTrait

Protected Methods

Method Description Defined By
createFixtures() Creates the specified fixture instances. yii\test\FixtureTrait
destroyApplication() Destroys the application instance created by mockApplication(). yii\codeception\TestCase
mockApplication() Mocks up the application instance. yii\codeception\TestCase
setUp() yii\codeception\TestCase
tearDown() yii\codeception\TestCase

Property Details

$appConfig public property

The application configuration that will be used for creating an application instance for each test. You can use a string to represent the file path or path alias of a configuration file. The application configuration array may contain an optional class element which specifies the class name of the application instance to be created. By default, a yii\web\Application instance will be created.

public array|string $appConfig = '@tests/codeception/config/unit.php'

Method Details

__call() public method

Calls the named method which is not a class method.

Do not call this method directly as it is a PHP magic method that will be implicitly called when an unknown method is being invoked.

public mixed __call ( $name, $params )
$name string

The method name

$params array

Method parameters

return mixed

The method return value

throws yii\base\UnknownMethodException

when calling unknown method

__get() public method

Returns the value of an object property.

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $value = $object->property;.

public mixed __get ( $name )
$name string

The property name

return mixed

The property value

throws yii\base\UnknownPropertyException

if the property is not defined

destroyApplication() protected method

Destroys the application instance created by mockApplication().

protected void destroyApplication ( )

mockApplication() protected method

Mocks up the application instance.

protected yii\web\Application|yii\console\Application mockApplication ( $config = null )
$config array

The configuration that should be used to generate the application instance. If null, $appConfig will be used.

return yii\web\Application|yii\console\Application

The application instance

throws yii\base\InvalidConfigException

if the application configuration is invalid

setUp() protected method

protected void setUp ( )

tearDown() protected method

protected void tearDown ( )

© 2008–2017 by Yii Software LLC
Licensed under the three clause BSD license.
http://www.yiiframework.com/doc-2.0/yii-codeception-testcase.html