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


PHP Mockery::parseShouldReturnArgs方法代码示例

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


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

示例1: shouldReceive

 /**
  * Set expected method calls
  *
  * @param mixed
  * @return \Mockery\Expectation
  */
 public function shouldReceive()
 {
     /** @var array $nonPublicMethods */
     $nonPublicMethods = $this->getNonPublicMethods();
     $self = $this;
     $allowMockingProtectedMethods = $this->_mockery_allowMockingProtectedMethods;
     $lastExpectation = \Mockery::parseShouldReturnArgs($this, func_get_args(), function ($method) use($self, $nonPublicMethods, $allowMockingProtectedMethods) {
         $rm = $self->mockery_getMethod($method);
         if ($rm) {
             if ($rm->isPrivate()) {
                 throw new \InvalidArgumentException("{$method}() cannot be mocked as it is a private method");
             }
             if (!$allowMockingProtectedMethods && $rm->isProtected()) {
                 throw new \InvalidArgumentException("{$method}() cannot be mocked as it a protected method and mocking protected methods is not allowed for this mock");
             }
         }
         $director = $self->mockery_getExpectationsFor($method);
         if (!$director) {
             $director = new \Mockery\ExpectationDirector($method, $self);
             $self->mockery_setExpectationsFor($method, $director);
         }
         $expectation = new \Mockery\Expectation($self, $method);
         $director->addExpectation($expectation);
         return $expectation;
     });
     return $lastExpectation;
 }
开发者ID:kr85,项目名称:SpartaPark,代码行数:33,代码来源:Mock.php

示例2: shouldReceive

 /**
  * Set expected method calls
  *
  * @param mixed
  * @return \Mockery\Expectation
  */
 public function shouldReceive()
 {
     $self =& $this;
     $lastExpectation = \Mockery::parseShouldReturnArgs($this, func_get_args(), function ($method) use($self) {
         $director = $self->mockery_getExpectationsFor($method);
         if (!$director) {
             $director = new \Mockery\ExpectationDirector($method, $self);
             $self->mockery_setExpectationsFor($method, $director);
         }
         $expectation = new \Mockery\Expectation($self, $method);
         $director->addExpectation($expectation);
         return $expectation;
     });
     return $lastExpectation;
 }
开发者ID:rdohms,项目名称:mockery,代码行数:21,代码来源:Mock.php

示例3: shouldReceive

 /**
  * Set expected method calls
  *
  * @param string $methodName,... one or many methods that are expected to be called in this mock
  * @return \Mockery\Expectation
  */
 public function shouldReceive($methodName)
 {
     if (func_num_args() < 1) {
         throw new \InvalidArgumentException("At least one method name is required");
     }
     foreach (func_get_args() as $method) {
         if ("" == $method) {
             throw new \InvalidArgumentException("Received empty method name");
         }
     }
     /** @var array $nonPublicMethods */
     $nonPublicMethods = $this->getNonPublicMethods();
     $self = $this;
     $allowMockingProtectedMethods = $this->_mockery_allowMockingProtectedMethods;
     $lastExpectation = \Mockery::parseShouldReturnArgs($this, func_get_args(), function ($method) use($self, $nonPublicMethods, $allowMockingProtectedMethods) {
         $rm = $self->mockery_getMethod($method);
         if ($rm) {
             if ($rm->isPrivate()) {
                 throw new \InvalidArgumentException("{$method}() cannot be mocked as it is a private method");
             }
             if (!$allowMockingProtectedMethods && $rm->isProtected()) {
                 throw new \InvalidArgumentException("{$method}() cannot be mocked as it is a protected method and mocking protected methods is not enabled for the currently used mock object.");
             }
         }
         $director = $self->mockery_getExpectationsFor($method);
         if (!$director) {
             $director = new \Mockery\ExpectationDirector($method, $self);
             $self->mockery_setExpectationsFor($method, $director);
         }
         $expectation = new \Mockery\Expectation($self, $method);
         $director->addExpectation($expectation);
         return $expectation;
     });
     return $lastExpectation;
 }
开发者ID:quizlet,项目名称:mockery,代码行数:41,代码来源:Mock.php


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