Example #1
0
	/**
	 * Tests the jsonSerialize method.
	 *
	 * Note, this is not completely backward compatible. Previous this would just return the class name.
	 *
	 * @return  void
	 *
	 * @covers  JData::jsonSerialize
	 * @since   12.3
	 */
	public function testJsonSerialize()
	{
		$this->assertEquals('{}', json_encode($this->_instance->jsonSerialize()), 'Empty object.');

		$this->_instance->bind(array('title' => 'Simple Object'));
		$this->assertEquals('{"title":"Simple Object"}', json_encode($this->_instance->jsonSerialize()), 'Simple object.');
	}
Example #2
0
 /**
  * Set an object property.
  *
  * @param   string  $property  The property name.
  * @param   mixed   $value     The property value.
  *
  * @return  mixed  The property value.
  *
  * @since   12.3
  */
 protected function setProperty($property, $value)
 {
     switch ($property) {
         case 'successful':
             $value = strtoupper($value);
             break;
     }
     return parent::setProperty($property, $value);
 }
 /**
  * Set an object property.
  *
  * @param   string  $property  The property name.
  * @param   mixed   $value     The property value.
  *
  * @return  mixed  The property value.
  *
  * @since   12.3
  */
 protected function setProperty($property, $value)
 {
     return parent::setProperty($property, strtoupper($value));
 }