diff --git a/composer.json b/composer.json index 3faccdc..b47cae3 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,8 @@ "codeception/codeception": "~2.2.4", "codeception/specify": "*", "codeception/verify": "*", - "phploc/phploc": "^3.0.1" + "phploc/phploc": "^3.0.1", + "mockery/mockery": "1.0.0-alpha1" }, "config": { "process-timeout": 1800 diff --git a/tests/codeception/api/unit.suite.yml b/tests/codeception/api/unit.suite.yml index 3d31363..e79108b 100644 --- a/tests/codeception/api/unit.suite.yml +++ b/tests/codeception/api/unit.suite.yml @@ -4,6 +4,7 @@ modules: - Yii2: part: [orm, email, fixtures] - tests\codeception\common\_support\amqp\Helper + - tests\codeception\common\_support\Mockery config: Yii2: configFile: '../config/api/unit.php' diff --git a/tests/codeception/api/unit/TestCase.php b/tests/codeception/api/unit/TestCase.php index 1d1cf88..91b79ad 100644 --- a/tests/codeception/api/unit/TestCase.php +++ b/tests/codeception/api/unit/TestCase.php @@ -1,6 +1,8 @@ assert_mocks) { + \Mockery::close(); + } else { + \Mockery::getContainer()->mockery_close(); + \Mockery::resetContainer(); + } + } + + public function _failed(TestInterface $test, $fail) { + $this->assert_mocks = false; + } + +} diff --git a/tests/codeception/common/unit.suite.yml b/tests/codeception/common/unit.suite.yml index 98fb59d..80ce5da 100644 --- a/tests/codeception/common/unit.suite.yml +++ b/tests/codeception/common/unit.suite.yml @@ -3,6 +3,7 @@ modules: enabled: - Yii2: part: [orm, email, fixtures] + - tests\codeception\common\_support\Mockery config: Yii2: configFile: '../config/common/unit.php' diff --git a/tests/codeception/common/unit/TestCase.php b/tests/codeception/common/unit/TestCase.php index ef1be1f..b3c1f9b 100644 --- a/tests/codeception/common/unit/TestCase.php +++ b/tests/codeception/common/unit/TestCase.php @@ -1,6 +1,8 @@