mirror of
https://github.com/elyby/accounts.git
synced 2024-12-26 07:09:46 +05:30
32 lines
693 B
PHP
32 lines
693 B
PHP
<?php
|
|
namespace tests\codeception\common\_support;
|
|
|
|
use Codeception\Module;
|
|
use Codeception\TestInterface;
|
|
|
|
class Mockery extends Module {
|
|
|
|
/**
|
|
* @var bool Run mockery expectations after test or not
|
|
*/
|
|
private $assert_mocks = true;
|
|
|
|
public function _before(TestInterface $test) {
|
|
\Mockery::globalHelpers();
|
|
}
|
|
|
|
public function _after(TestInterface $test) {
|
|
if ($this->assert_mocks) {
|
|
\Mockery::close();
|
|
} else {
|
|
\Mockery::getContainer()->mockery_close();
|
|
\Mockery::resetContainer();
|
|
}
|
|
}
|
|
|
|
public function _failed(TestInterface $test, $fail) {
|
|
$this->assert_mocks = false;
|
|
}
|
|
|
|
}
|