本文整理汇总了PHP中Zend_Exception::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Exception::getMessage方法的具体用法?PHP Zend_Exception::getMessage怎么用?PHP Zend_Exception::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Exception
的用法示例。
在下文中一共展示了Zend_Exception::getMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkModifyException
public function checkModifyException(Zend_Exception $exception)
{
if (preg_match('/Duplicate entry.*for key (2|\'nickname\')/i', $exception->getMessage())) {
$this->_setError('nicknameExists');
return false;
}
if (preg_match('/Duplicate entry.*for key (3|\'name\')/i', $exception->getMessage())) {
$this->_setError('nameExists');
return false;
}
return true;
}
示例2: testExceptions
public function testExceptions()
{
// Ohne Mail
$exception = new Kwf_Exception();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertTrue($view->debug);
$this->assertEquals($view->template, 'error.tpl');
// Mit Mail
Zend_Registry::get('config')->debug->error->log = true;
Kwf_Config::deleteValueCache('debug.error.log');
$exception = new Kwf_Exception();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertFalse($view->debug);
$this->assertEquals($view->template, 'error.tpl');
// Nicht-Kwf_Exception mit Mail
Zend_Registry::get('config')->debug->error->log = true;
Kwf_Config::deleteValueCache('debug.error.log');
$e = new Zend_Exception();
$exception = new Kwf_Exception_Other($e);
$view = $this->_processException($exception);
$this->assertEquals($view->message, $e->getMessage());
$this->assertFalse($view->debug);
$this->assertEquals($view->template, 'error.tpl');
Zend_Registry::get('config')->debug->error->log = false;
Kwf_Config::deleteValueCache('debug.error.log');
// Kwf_Exception_NoLog mit Debug
Zend_Registry::get('config')->debug->error->log = true;
Kwf_Config::deleteValueCache('debug.error.log');
$exception = new Kwf_Exception_NoLog();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertFalse($view->debug);
Zend_Registry::get('config')->debug->error->log = false;
Kwf_Config::deleteValueCache('debug.error.log');
$this->assertEquals($view->template, 'error.tpl');
// Kwf_Exception_NoLog ohne Debug
$exception = new Kwf_Exception_NoLog();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertTrue($view->debug);
$this->assertEquals($view->template, 'error.tpl');
// Kwf_Exception_NotFound
$exception = new Kwf_Exception_NotFound();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertEquals($view->template, 'error404.tpl');
// Nicht-Kwf_Exception
$exception = new Exception();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertEquals($view->template, 'error.tpl');
// ClientException
$exception = new Kwf_ClientException();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertEquals($view->template, 'error-client.tpl');
}
示例3: testExceptions
public function testExceptions()
{
// Ohne Mail
$exception = new Kwf_Exception();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertTrue($view->debug);
$this->assertEquals($view->template, 'error.tpl');
// Mit Mail
Kwf_Exception_Abstract::$logErrors = true;
$exception = new Kwf_Exception();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertFalse($view->debug);
$this->assertEquals($view->template, 'error.tpl');
// Nicht-Kwf_Exception mit Mail
Kwf_Exception_Abstract::$logErrors = true;
$e = new Zend_Exception();
$exception = new Kwf_Exception_Other($e);
$view = $this->_processException($exception);
$this->assertEquals($view->message, $e->getMessage());
$this->assertFalse($view->debug);
$this->assertEquals($view->template, 'error.tpl');
Kwf_Exception_Abstract::$logErrors = null;
// Kwf_Exception_NoLog mit Debug
Kwf_Exception_Abstract::$logErrors = true;
$exception = new Kwf_Exception_NoLog();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertFalse($view->debug);
Kwf_Exception_Abstract::$logErrors = null;
$this->assertEquals($view->template, 'error.tpl');
// Kwf_Exception_NoLog ohne Debug
$exception = new Kwf_Exception_NoLog();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertTrue($view->debug);
$this->assertEquals($view->template, 'error.tpl');
// Kwf_Exception_NotFound
$exception = new Kwf_Exception_NotFound();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertEquals($view->template, 'error404.tpl');
// Nicht-Kwf_Exception
$exception = new Exception();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertEquals($view->template, 'error.tpl');
// ClientException
$exception = new Kwf_ClientException();
$view = $this->_processException($exception);
$this->assertEquals($view->message, $exception->getMessage());
$this->assertEquals($view->template, 'error-client.tpl');
}
示例4: testMessage
public function testMessage()
{
$e = new Zend_Exception('msg');
$this->assertEquals('msg', $e->getMessage());
}