public function test_unsetData() { /* unset root */ $obj = new DataObject('data'); $this->assertEquals('data', $obj->getData()); $obj->unsetData(); $this->assertNull($obj->getData()); /* unset key in root array */ $obj->setKey('dataKey'); $obj->setOther('dataOther'); $this->assertEquals('dataKey', $obj->getKey()); $obj->unsetKey(); $this->assertNull($obj->getKey()); $this->assertEquals('dataOther', $obj->getOther()); /* unset by path */ $obj->setData('Other/Node', 'dataNode'); $this->assertEquals('dataNode', $obj->getData('/Other/Node')); $obj->unsetData('/Other/Node'); /* wrong path */ $obj->unsetData('/Other/WrongNode'); }