当前位置: 首页>>代码示例>>PHP>>正文


PHP Mockery::getContainer方法代码示例

本文整理汇总了PHP中Mockery::getContainer方法的典型用法代码示例。如果您正苦于以下问题:PHP Mockery::getContainer方法的具体用法?PHP Mockery::getContainer怎么用?PHP Mockery::getContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mockery的用法示例。


在下文中一共展示了Mockery::getContainer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 public function tearDown()
 {
     if ($container = m::getContainer()) {
         $this->addToAssertionCount($container->mockery_getExpectationCount());
     }
     parent::tearDown();
 }
开发者ID:faulker,项目名称:laravel5-rackspace-cloudqueue,代码行数:7,代码来源:CloudQueueTest.php

示例2: assertPostConditions

 /**
  * Performs assertions shared by all tests of a test case. This method is
  * called before execution of a test ends and before the tearDown method.
  */
 protected function assertPostConditions()
 {
     parent::assertPostConditions();
     // Add Mockery expectations to assertion count.
     if (($container = Mock::getContainer()) !== null) {
         $this->addToAssertionCount($container->mockery_getExpectationCount());
     }
 }
开发者ID:narrowspark,项目名称:testing-helper,代码行数:12,代码来源:MockeryTrait.php

示例3: setUp

 protected function setUp()
 {
     // We intentionally test the static container here. That is what the
     // listener will check.
     $this->container = \Mockery::getContainer();
     $this->listener = new \Mockery\Adapter\Phpunit\TestListener();
     $this->testResult = new \PHPUnit_Framework_TestResult();
     $this->test = new \Mockery_Adapter_Phpunit_EmptyTestCase();
     $this->test->setTestResultObject($this->testResult);
     $this->testResult->addListener($this->listener);
     $this->assertTrue($this->testResult->wasSuccessful(), 'sanity check: empty test results should be considered successful');
 }
开发者ID:padraic,项目名称:mockery,代码行数:12,代码来源:TestListenerTest.php

示例4: endTest

 /**
  * After each test, perform Mockery verification tasks and cleanup the
  * statically stored Mockery container for the next test.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  float                  $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     try {
         $container = \Mockery::getContainer();
         if ($container != null) {
             $expectation_count = $container->mockery_getExpectationCount();
             $test->addToAssertionCount($expectation_count);
         }
         \Mockery::close();
     } catch (\Exception $e) {
         $result = $test->getTestResultObject();
         $result->addError($test, $e, $time);
     }
 }
开发者ID:deepakb,项目名称:test-driven-development-example,代码行数:21,代码来源:TestListener.php

示例5: endTest

 /**
  * After each test, perform Mockery verification tasks and cleanup the
  * statically stored Mockery container for the next test.
  *
  * @param PHPUnit_Framework_Test $test        	
  * @param float $time        	
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     try {
         $container = \Mockery::getContainer();
         // check addToAssertionCount is important to avoid mask test errors
         if ($container != null && method_exists($test, 'addToAssertionCount')) {
             $expectation_count = $container->mockery_getExpectationCount();
             $test->addToAssertionCount($expectation_count);
         }
         \Mockery::close();
     } catch (\Exception $e) {
         $result = $test->getTestResultObject();
         $result->addError($test, $e, $time);
     }
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:22,代码来源:TestListener.php

示例6: verifyMockObjects

 protected function verifyMockObjects()
 {
     $container = Mockery::getContainer();
     if (isset($container)) {
         $reflected_container = new ReflectionClass($container);
         $reflected_mocks = $reflected_container->getProperty('_mocks');
         $reflected_mocks->setAccessible(true);
         $mocks = $reflected_mocks->getValue($container);
         foreach ($mocks as $mock) {
             $reflected_mock = new ReflectionClass($mock);
             $reflected_expectations = $reflected_mock->getProperty('_mockery_expectations');
             $reflected_expectations->setAccessible(true);
             $expectations = $reflected_expectations->getValue($mock);
             foreach ($expectations as $director) {
                 $this->addToAssertionCount(count($director->getExpectations()));
             }
         }
         Mockery::close();
     }
     parent::verifyMockObjects();
 }
开发者ID:TheOnlyMerlin,项目名称:phpunit-extensions,代码行数:21,代码来源:TestCase.php

示例7: tearDown

 public function tearDown()
 {
     $this->addToAssertionCount(Mockery::getContainer()->mockery_getExpectationCount());
     Mockery::close();
 }
开发者ID:AdaptiveAds,项目名称:AdaptiveAds,代码行数:5,代码来源:TestCase.php

示例8: ignoreAssertionsWhenExpectations

 /**
  * Do not check assertions were executed when there are constrainted mocks
  */
 protected static function ignoreAssertionsWhenExpectations()
 {
     /** @var Mock $mock */
     foreach (\Mockery::getContainer()->getMocks() as $mock) {
         /** @var ExpectationDirector $expectationDirector */
         foreach ($mock->mockery_getExpectations() as $expectationDirector) {
             $expectations = $expectationDirector->getExpectations();
             if (method_exists($expectationDirector, 'getDefaultExpectations')) {
                 //mockery <=0.9.5 compatibility
                 $expectations = array_merge($expectations, $expectationDirector->getDefaultExpectations());
             }
             /** @var Expectation $expectation */
             foreach ($expectations as $expectation) {
                 if ($expectation->isCallCountConstrained()) {
                     Environment::$checkAssertions = FALSE;
                     return;
                 }
             }
         }
     }
 }
开发者ID:instante,项目名称:php-test-suite,代码行数:24,代码来源:TestBootstrap.php


注:本文中的Mockery::getContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。