當前位置: 首頁>>代碼示例>>PHP>>正文


PHP InvalidArgumentException::getMessage方法代碼示例

本文整理匯總了PHP中InvalidArgumentException::getMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP InvalidArgumentException::getMessage方法的具體用法?PHP InvalidArgumentException::getMessage怎麽用?PHP InvalidArgumentException::getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在InvalidArgumentException的用法示例。


在下文中一共展示了InvalidArgumentException::getMessage方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testThrowError

 /**
  * @covers Gloubster\Server\GloubsterServer::throwError
  */
 public function testThrowError()
 {
     $server = $this->getServer();
     $exception = new \InvalidArgumentException('SHIT');
     $server['monolog']->expects($this->once())->method('addError')->with($this->equalTo($exception->getMessage()));
     try {
         $server->throwError($exception);
         $this->fail('Should have raised an exception');
     } catch (\Exception $e) {
         $this->assertEquals($exception, $e);
     }
 }
開發者ID:gloubster,項目名稱:server,代碼行數:15,代碼來源:GloubsterServerTest.php

示例2: validation

 public function validation($ruleName, $value)
 {
     Cascade::getLogger('bigc\\profile')->debug("ProfileData validation {$ruleName}, {$value}");
     try {
         $this->validRule[$ruleName]->assert($value);
     } catch (\Respect\Validation\Exceptions\NestedValidationException $ex) {
         $e = new \InvalidArgumentException($this->validMessage[$ruleName], 0, $ex);
         Cascade::getLogger('bigc\\profile')->warning($e->getMessage());
         throw $e;
     }
     return true;
 }
開發者ID:CrabHo,項目名稱:example-lib-profile,代碼行數:12,代碼來源:ProfileData.php

示例3: testCreateWithExceptionWithPrevious

 /**
  * Log events also take an exception as message argument (here with previous exception)
  */
 public function testCreateWithExceptionWithPrevious()
 {
     $logEvent = LogEvent::create(ILogger::LEVEL_ERROR, $this->invargEx, array(), 'PHPUnit');
     $logEventData = $logEvent->getArrayCopy();
     $this->assertNotEmpty($logEventData);
     $this->assertInternalType('array', $logEventData);
     $this->assertArrayHasKey('msg', $logEventData);
     $this->assertArrayHasKey('exception', $logEventData);
     $this->assertEquals($this->invargEx->getMessage(), $logEventData['msg']);
     $this->assertNotEmpty($logEventData['exception']);
     $this->assertInternalType('array', $logEventData['exception']);
     $exceptionArray = $logEventData['exception'];
     $this->assertArrayHasKey('file', $exceptionArray);
     $this->assertArrayHasKey('message', $exceptionArray);
     $this->assertArrayHasKey('code', $exceptionArray);
     $this->assertArrayHasKey('line', $exceptionArray);
     $this->assertArrayHasKey('trace', $exceptionArray);
     $this->assertArrayHasKey('previous', $exceptionArray);
     $this->assertEquals(__FILE__, $exceptionArray['file']);
     $this->assertEquals($this->invargEx->getMessage(), $exceptionArray['message']);
     $this->assertEquals($this->invargEx->getCode(), $exceptionArray['code']);
     $this->assertEquals($this->invargEx->getLine(), $exceptionArray['line']);
     $this->assertNotEmpty($exceptionArray['trace']);
     $previousArray = $exceptionArray['previous'];
     $this->assertArrayHasKey('file', $previousArray);
     $this->assertArrayHasKey('message', $previousArray);
     $this->assertArrayHasKey('code', $previousArray);
     $this->assertArrayHasKey('line', $previousArray);
     $this->assertArrayHasKey('trace', $previousArray);
     $this->assertArrayNotHasKey('previous', $previousArray);
     $this->assertEquals(__FILE__, $previousArray['file']);
     $this->assertEquals($this->runtimeEx->getMessage(), $previousArray['message']);
     $this->assertEquals($this->runtimeEx->getCode(), $previousArray['code']);
     $this->assertEquals($this->runtimeEx->getLine(), $previousArray['line']);
     $this->assertNotEmpty($previousArray['trace']);
 }
開發者ID:zalora,項目名稱:punyan,代碼行數:39,代碼來源:LogEventTest.php

示例4: wrap

 public static function wrap(\InvalidArgumentException $e)
 {
     return new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
 }
開發者ID:cs278,項目名稱:bank-modulus,代碼行數:4,代碼來源:Util.php

示例5: handleInvalidArgumentException

 /**
  * Handles cases where some bad parameters were passed to the intention.
  *
  * @param \InvalidArgumentException $exception
  *
  * @throws BadRequestHttpException
  */
 protected function handleInvalidArgumentException(\InvalidArgumentException $exception)
 {
     throw new BadRequestHttpException($exception->getMessage());
 }
開發者ID:algisimu,項目名稱:IntentionBundle,代碼行數:11,代碼來源:IntentionControllerTrait.php

示例6: fromInvalidArgumentExceptionAndPrototype

 /**
  * @param \InvalidArgumentException $exception
  * @param \Prooph\Processing\Type\Prototype $prototype
  * @return static
  */
 public static function fromInvalidArgumentExceptionAndPrototype(\InvalidArgumentException $exception, Prototype $prototype)
 {
     $invalidTypeException = new static($exception->getMessage(), $exception->getCode(), $exception);
     $invalidTypeException->relatedPrototypeOfType = $prototype;
     return $invalidTypeException;
 }
開發者ID:prooph,項目名稱:processing,代碼行數:11,代碼來源:InvalidTypeException.php


注:本文中的InvalidArgumentException::getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。