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
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.
Method Details
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 |
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 |
Destroys the application instance created by mockApplication().
| protected void destroyApplication ( ) |
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 |
| protected void setUp ( ) |
| protected void tearDown ( ) |