本文整理汇总了PHP中JModelList::setState方法的典型用法代码示例。如果您正苦于以下问题:PHP JModelList::setState方法的具体用法?PHP JModelList::setState怎么用?PHP JModelList::setState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModelList
的用法示例。
在下文中一共展示了JModelList::setState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testListInfoIsAppendedToFormData
/**
* Tests the loadFormData method.
*
* @since 3.4
*
* @return void
*
* @testdox loadFormData() returns correct data from currently set states
*/
public function testListInfoIsAppendedToFormData()
{
$method = new ReflectionMethod('JModelList', 'loadFormData');
$method->setAccessible(true);
$applicationMock = $this->getMockCmsApp();
$applicationMock->expects($this->once())->method('getUserState')->with($this->equalTo('com_j.list'), $this->equalTo(new stdClass()))->will($this->returnValue((object) array("foo" => "bar")));
JFactory::$application = $applicationMock;
$this->object->setState('list.direction', 'ASC');
$this->object->setState('list.limit', 30);
$this->object->setState('list.ordering', 'enabled');
$this->object->setState('list.start', 0);
$expected = (object) array("foo" => "bar", "list" => array('direction' => 'ASC', 'limit' => 30, 'ordering' => 'enabled', 'start' => 0));
$this->assertEquals($expected, $method->invoke($this->object));
}
示例2: setState
/**
* Method to set model state variables. Update local vars.
*
* @access public
* @param string $property The name of the property.
* @param mixed $value The value of the property to set or null.
*
* @return mixed The previous value of the property or null if not set.
*
* @since 11.1
*/
public function setState($property, $value = null)
{
if ($property == 'context') {
$this->context = $value;
}
return parent::setState($property, $value);
}