FixtureHelper::_afterSuite()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace common\_support;
4
5
use common\fixtures\UserFixture;
0 ignored issues
show
Bug introduced by
The type common\fixtures\UserFixture was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Codeception\Module;
7
use yii\test\FixtureTrait;
8
use yii\test\InitDbFixture;
9
10
/**
11
 * This helper is used to populate the database with needed fixtures before any tests are run.
12
 * In this example, the database is populated with the demo login user, which is used in acceptance
13
 * and functional tests.  All fixtures will be loaded before the suite is started and unloaded after it
14
 * completes.
15
 */
16
class FixtureHelper extends Module
17
{
18
19
    /**
20
     * Redeclare visibility because codeception includes all public methods that do not start with "_"
21
     * and are not excluded by module settings, in actor class.
22
     */
23
    use FixtureTrait {
0 ignored issues
show
Bug introduced by
The trait yii\test\FixtureTrait requires the property $depends which is not provided by common\_support\FixtureHelper.
Loading history...
24
        loadFixtures as public;
25
        fixtures as public;
26
        globalFixtures as public;
27
        createFixtures as public;
28
        unloadFixtures as protected;
29
        getFixtures as protected;
30
        getFixture as protected;
31
    }
32
33
    /**
34
     * Method called before any suite tests run. Loads User fixture login user
35
     * to use in acceptance and functional tests.
36
     * @param array $settings
37
     */
38
    public function _beforeSuite($settings = [])
39
    {
40
        $this->loadFixtures();
41
    }
42
43
    /**
44
     * Method is called after all suite tests run
45
     */
46
    public function _afterSuite()
47
    {
48
        $this->unloadFixtures();
49
    }
50
51
    /**
52
     * @inheritdoc
53
     */
54
    public function globalFixtures()
55
    {
56
        return [
57
            InitDbFixture::class,
58
        ];
59
    }
60
61
    /**
62
     * @inheritdoc
63
     */
64
    public function fixtures()
65
    {
66
        return [
67
            'user' => [
68
                'class' => UserFixture::class,
69
                'dataFile' => '@tests/codeception/common/fixtures/data/init_login.php',
70
            ],
71
        ];
72
    }
73
}
74