public function test_serialized() { $data = array('one', 'two', 'three'); $array = new Jam_Array(); $array->content($data); $array[0] = 'changed'; $array[] = 'new'; $serialized = serialize($array); $array = unserialize($serialized); $this->assertEquals(array('changed', 'two', 'three', 'new'), $array->content()); $this->assertTrue($array->changed(0)); $this->assertFalse($array->changed(1)); $this->assertFalse($array->changed(2)); $this->assertTrue($array->changed(3)); }
/** * Getter for the changed array - check if any or a particular item has been changed * @param int $offset * @return bool */ public function changed($offset = NULL) { if ($this->_content) { foreach ($this->_content as $key => $value) { if (!isset($this->_changed[$key]) and $value instanceof Jam_Model and $value->changed()) { $this->_changed[$key] = TRUE; } } } return parent::changed($offset); }