本文整理匯總了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).');
}