mirror of
				https://github.com/elyby/accounts.git
				synced 2025-05-31 14:11:46 +05:30 
			
		
		
		
	Добавлен Mockery
This commit is contained in:
		@@ -40,7 +40,8 @@
 | 
				
			|||||||
        "codeception/codeception": "~2.2.4",
 | 
					        "codeception/codeception": "~2.2.4",
 | 
				
			||||||
        "codeception/specify": "*",
 | 
					        "codeception/specify": "*",
 | 
				
			||||||
        "codeception/verify": "*",
 | 
					        "codeception/verify": "*",
 | 
				
			||||||
        "phploc/phploc": "^3.0.1"
 | 
					        "phploc/phploc": "^3.0.1",
 | 
				
			||||||
 | 
					        "mockery/mockery": "1.0.0-alpha1"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "config": {
 | 
					    "config": {
 | 
				
			||||||
        "process-timeout": 1800
 | 
					        "process-timeout": 1800
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ modules:
 | 
				
			|||||||
        - Yii2:
 | 
					        - Yii2:
 | 
				
			||||||
            part: [orm, email, fixtures]
 | 
					            part: [orm, email, fixtures]
 | 
				
			||||||
        - tests\codeception\common\_support\amqp\Helper
 | 
					        - tests\codeception\common\_support\amqp\Helper
 | 
				
			||||||
 | 
					        - tests\codeception\common\_support\Mockery
 | 
				
			||||||
    config:
 | 
					    config:
 | 
				
			||||||
        Yii2:
 | 
					        Yii2:
 | 
				
			||||||
            configFile: '../config/api/unit.php'
 | 
					            configFile: '../config/api/unit.php'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
namespace tests\codeception\api\unit;
 | 
					namespace tests\codeception\api\unit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Mockery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestCase extends \Codeception\Test\Unit  {
 | 
					class TestCase extends \Codeception\Test\Unit  {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -19,4 +21,9 @@ class TestCase extends \Codeception\Test\Unit  {
 | 
				
			|||||||
        return [];
 | 
					        return [];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected function tearDown() {
 | 
				
			||||||
 | 
					        parent::tearDown();
 | 
				
			||||||
 | 
					        Mockery::close();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										31
									
								
								tests/codeception/common/_support/Mockery.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								tests/codeception/common/_support/Mockery.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					<?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;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -3,6 +3,7 @@ modules:
 | 
				
			|||||||
    enabled:
 | 
					    enabled:
 | 
				
			||||||
        - Yii2:
 | 
					        - Yii2:
 | 
				
			||||||
            part: [orm, email, fixtures]
 | 
					            part: [orm, email, fixtures]
 | 
				
			||||||
 | 
					        - tests\codeception\common\_support\Mockery
 | 
				
			||||||
    config:
 | 
					    config:
 | 
				
			||||||
        Yii2:
 | 
					        Yii2:
 | 
				
			||||||
            configFile: '../config/common/unit.php'
 | 
					            configFile: '../config/common/unit.php'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
namespace tests\codeception\common\unit;
 | 
					namespace tests\codeception\common\unit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Mockery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestCase extends \Codeception\Test\Unit  {
 | 
					class TestCase extends \Codeception\Test\Unit  {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -19,4 +21,9 @@ class TestCase extends \Codeception\Test\Unit  {
 | 
				
			|||||||
        return [];
 | 
					        return [];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected function tearDown() {
 | 
				
			||||||
 | 
					        parent::tearDown();
 | 
				
			||||||
 | 
					        Mockery::close();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ modules:
 | 
				
			|||||||
    enabled:
 | 
					    enabled:
 | 
				
			||||||
        - Yii2:
 | 
					        - Yii2:
 | 
				
			||||||
            part: [orm, email, fixtures]
 | 
					            part: [orm, email, fixtures]
 | 
				
			||||||
 | 
					        - tests\codeception\common\_support\Mockery
 | 
				
			||||||
    config:
 | 
					    config:
 | 
				
			||||||
        Yii2:
 | 
					        Yii2:
 | 
				
			||||||
            configFile: '../config/console/unit.php'
 | 
					            configFile: '../config/console/unit.php'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,7 @@
 | 
				
			|||||||
namespace tests\codeception\console\unit;
 | 
					namespace tests\codeception\console\unit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Codeception\Test\Unit;
 | 
					use Codeception\Test\Unit;
 | 
				
			||||||
 | 
					use Mockery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestCase extends Unit {
 | 
					class TestCase extends Unit {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,4 +22,9 @@ class TestCase extends Unit {
 | 
				
			|||||||
        return [];
 | 
					        return [];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected function tearDown() {
 | 
				
			||||||
 | 
					        parent::tearDown();
 | 
				
			||||||
 | 
					        Mockery::close();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user