FBMock_Utils::enforce PHP Method

enforce() public static method

public static enforce ( $invariant, $msg )
    public static function enforce($invariant, $msg)
    {
        if (!$invariant) {
            self::assertString($msg);
            // TODO (#1913833): use FBMock_MockObjectException
            throw new Exception(vsprintf($msg, array_slice(func_get_args(), 2)));
        }
    }

Usage Example

Beispiel #1
0
 public function getCalls($double, $method)
 {
     FBMock_Utils::assertString($method);
     $this->assertMethodExists($double, $method);
     if ($this->isStrictMock) {
         FBMock_Utils::enforce($this->getStub($method), "Trying to fetch calls for unmocked method %s on strict mock of %s", $method, $this->className);
     }
     if (isset($this->methodsToCalls[strtolower($method)])) {
         return $this->methodsToCalls[strtolower($method)];
     }
     return array();
 }
All Usage Examples Of FBMock_Utils::enforce