public function testCRUD() { $this->_model->setData(array('store_id' => 1, 'design' => 'default/default/default', 'date_from' => date('Y-m-d', strtotime('-1 day')), 'date_to' => date('Y-m-d', strtotime('+1 day')))); $this->_model->save(); $this->assertNotEmpty($this->_model->getId()); try { $model = new Mage_Core_Model_Design(); $model->loadChange(1); $this->assertEquals($this->_model->getId(), $model->getId()); /* Design change that intersects with existing ones should not be saved, so exception is expected */ try { $model->setId(null); $model->save(); $this->fail('A validation failure is expected.'); } catch (Mage_Core_Exception $e) { // intentionally swallow exception } $this->_model->delete(); } catch (Exception $e) { $this->_model->delete(); throw $e; } $model = new Mage_Core_Model_Design(); $model->loadChange(1); $this->assertEmpty($model->getId()); }