Mockery\Container::self PHP 메소드

self() 공개 메소드

Retrieve the last remembered mock object, which is the same as saying retrieve the current mock being programmed where you have yet to call mock() to change it - thus why the method name is "self" since it will be be used during the programming of the same mock.
public self ( ) : Mock
리턴 Mock
    public function self()
    {
        $mocks = array_values($this->_mocks);
        $index = count($mocks) - 1;
        return $mocks[$index];
    }

Usage Example

예제 #1
0
 /**
  * Static shortcut to \Mockery\Container::self()
  *
  * @return \Mockery\MockInterface
  */
 public static function self()
 {
     if (is_null(self::$_container)) {
         throw new \LogicException("You have not declared any mocks yet");
     }
     return self::$_container->self();
 }