当前位置: 首页>>代码示例>>PHP>>正文


PHP JController::setMessage方法代码示例

本文整理汇总了PHP中JController::setMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP JController::setMessage方法的具体用法?PHP JController::setMessage怎么用?PHP JController::setMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JController的用法示例。


在下文中一共展示了JController::setMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetRedirect

 /**
  * Test JController::setRedirect
  *
  * @covers  JController::setRedirect
  */
 public function testSetRedirect()
 {
     // Set the URL only
     $this->class->setRedirect('index.php?option=com_foobar');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect.');
     $this->assertAttributeEquals(null, 'message', $this->class, 'Checks the message.');
     $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type.');
     // Set the URL and message
     $this->class->setRedirect('index.php?option=com_foobar', 'Hello World');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (2).');
     $this->assertAttributeEquals('Hello World', 'message', $this->class, 'Checks the message (2).');
     $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (2).');
     // URL, message and message type
     $this->class->setRedirect('index.php?option=com_foobar', 'Morning Universe', 'notice');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (3).');
     $this->assertAttributeEquals('Morning Universe', 'message', $this->class, 'Checks the message (3).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (3).');
     // With previously set message
     // URL
     $this->class->setMessage('Hi all');
     $this->class->setRedirect('index.php?option=com_foobar');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (4).');
     $this->assertAttributeEquals('Hi all', 'message', $this->class, 'Checks the message (4).');
     $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (4).');
     // URL and message
     $this->class->setMessage('Hi all');
     $this->class->setRedirect('index.php?option=com_foobar', 'Bye all');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (5).');
     $this->assertAttributeEquals('Bye all', 'message', $this->class, 'Checks the message (5).');
     $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (5).');
     // URL, message and message type
     $this->class->setMessage('Hi all');
     $this->class->setRedirect('index.php?option=com_foobar', 'Bye all', 'notice');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (6).');
     $this->assertAttributeEquals('Bye all', 'message', $this->class, 'Checks the message (6).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (6).');
     // URL and message type
     $this->class->setMessage('Hi all');
     $this->class->setRedirect('index.php?option=com_foobar', null, 'notice');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (7).');
     $this->assertAttributeEquals('Hi all', 'message', $this->class, 'Checks the message (7).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (7).');
     // With previously set message and message type
     // URL
     $this->class->setMessage('Hello folks', 'notice');
     $this->class->setRedirect('index.php?option=com_foobar');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (8).');
     $this->assertAttributeEquals('Hello folks', 'message', $this->class, 'Checks the message (8).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (8).');
     // URL and message
     $this->class->setMessage('Hello folks', 'notice');
     $this->class->setRedirect('index.php?option=com_foobar', 'Bye, Folks');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (9).');
     $this->assertAttributeEquals('Bye, Folks', 'message', $this->class, 'Checks the message (9).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (9).');
     // URL, message and message type
     $this->class->setMessage('Hello folks', 'notice');
     $this->class->setRedirect('index.php?option=com_foobar', 'Bye, folks', 'notice');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (10).');
     $this->assertAttributeEquals('Bye, folks', 'message', $this->class, 'Checks the message (10).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (10).');
     // URL and message type
     $this->class->setMessage('Folks?', 'notice');
     $this->class->setRedirect('index.php?option=com_foobar', null, 'question');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (10).');
     $this->assertAttributeEquals('Folks?', 'message', $this->class, 'Checks the message (10).');
     $this->assertAttributeEquals('question', 'messageType', $this->class, 'Checks the message type (10).');
 }
开发者ID:nogsus,项目名称:joomla-platform,代码行数:73,代码来源:JControllerTest.php


注:本文中的JController::setMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。