public function testModified()
{
$entity = new Entity();
$this->assertEqual(array(), $entity->modified());
$data = array('foo' => 'bar', 'baz' => 'dib');
$entity->set($data);
$this->assertEqual(array('foo' => true, 'baz' => true), $entity->modified());
$this->assertTrue($entity->modified('foo'));
$this->assertTrue($entity->modified('baz'));
/* and last, checking a non-existing field */
$this->assertNull($entity->modified('ole'));
$subentity = new Entity();
$subentity->set($data);
$entity->set(array('ble' => $subentity));
$this->assertEqual(array('foo' => true, 'baz' => true, 'ble' => true), $entity->modified());
$this->assertTrue($entity->ble->modified('foo'));
$this->assertEmpty($entity->ble->modified('iak'));
$this->assertEqual($entity->ble->modified(), array('foo' => true, 'baz' => true));
$data = array('foo' => 'bar', 'baz' => 'dib');
//it's the default data array in the test
$entity = new Entity();
$entity->set($data);
$entity->sync();
/* Checking empty values */
$entity->foo = '';
$this->assertTrue($entity->modified('foo'));
$this->assertEqual(array('foo' => true, 'baz' => false), $entity->modified());
/* and checking null values */
$entity->sync();
$entity->foo = null;
$this->assertTrue($entity->modified('foo'));
}