Example #1
0
 /**
  * @covers MicrosoftAzure\Storage\Common\Internal\Validate::isObject
  */
 public function testIsObjectNotObject()
 {
     // Setup
     $this->setExpectedException(get_class(new InvalidArgumentTypeException('')));
     $value = 'test string';
     // Test
     $result = Validate::isObject($value, 'value');
     // Assert
 }
Example #2
0
 /**
  * Validate if method exists in object
  *
  * @param object $objectInstance An object that requires method existing
  *                               validation
  * @param string $method         Method name
  * @param string $name           The parameter name
  *
  * @return boolean
  */
 public static function methodExists($objectInstance, $method, $name)
 {
     Validate::isString($method, 'method');
     Validate::notNull($objectInstance, 'objectInstance');
     Validate::isObject($objectInstance, 'objectInstance');
     if (method_exists($objectInstance, $method)) {
         return true;
     } else {
         throw new \InvalidArgumentException(sprintf(Resources::ERROR_METHOD_NOT_FOUND, $method, $name));
     }
 }