コード例 #1
0
ファイル: __CONTRACT__.php プロジェクト: rkgladson/PHPixme
 /**
  * Checks the return of a callback to be of the expected type
  * @param string $classPath
  * @param mixed $returnValue
  * @return mixed
  * @throws \UnexpectedValueException
  */
 static function returnIsA($classPath, $returnValue)
 {
     if ($returnValue instanceof $classPath) {
         return $returnValue;
     }
     throw new invalidReturn($returnValue, "Expected return of {$classPath}, got " . __PRIVATE__::getDescriptor($returnValue));
 }
コード例 #2
0
ファイル: __PRIVATE__Test.php プロジェクト: rkgladson/PHPixme
 /**
  * @covers PHPixme\__PRIVATE__::getDescriptor
  * @requires extension curl
  */
 public function test_getDescriptor_resource()
 {
     $handle = curl_init('http://www.wikipedia.com/');
     self::assertEquals('curl', internal::getDescriptor($handle));
     curl_close($handle);
 }