Ejemplo n.º 1
0
 public function test_changed()
 {
     $data = array('one', 'two', 'three');
     $array = new Jam_Array();
     $array->content($data);
     $this->assertFalse($array->changed());
     foreach ($data as $offset => $value) {
         $this->assertFalse($array->changed($offset));
     }
     $array[0] = 'changed';
     $array[] = 'new';
     $this->assertTrue($array->changed(0));
     $this->assertFalse($array->changed(1));
     $this->assertFalse($array->changed(2));
     $this->assertTrue($array->changed(3));
 }
Ejemplo n.º 2
0
Archivo: Model.php Proyecto: Konro1/pms
 /**
  * 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);
 }