save_file)) { //This really shouldn't be happening, but just in case... $this->has_save_file = true; $this->backup_file = $this->save_file . '.' . gmmktime() . '.bak'; copy($this->save_file, $this->backup_file); } else { if(!file_exists('modules/DocumentRevisions')) { mkdir_recursive('modules/DocumentRevisions'); } //Create the test file write_array_to_file("test", array(), $this->save_file); } } public function tearDown() { if($this->has_save_file) { copy($this->backup_file, $this->save_file); unlink($this->backup_file); } else { if(file_exists($this->save_file)) { unlink($this->save_file); } } if(file_exists($this->save_file . '.suback.bak')) { unlink($this->save_file . '.suback.bak'); } } public function testUnlinkUpgradeFiles600() { $this->assertTrue(file_exists($this->save_file), 'Assert the ' . $this->save_file . ' exists'); unlinkUpgradeFiles('600'); $this->assertFalse(file_exists($this->save_file), 'Assert the ' . $this->save_file . ' no longer exists'); $this->assertTrue(file_exists($this->save_file . '.suback.bak'), 'Assert the ' . $this->save_file . '.suback.bak file exists'); } public function testUnlinkUpgradeFiles610() { $this->assertTrue(file_exists($this->save_file), 'Assert the ' . $this->save_file . ' exists'); unlinkUpgradeFiles('610'); $this->assertFalse(file_exists($this->save_file), 'Assert the ' . $this->save_file . ' no longer exists'); $this->assertTrue(file_exists($this->save_file . '.suback.bak'), 'Assert the ' . $this->save_file . '.suback.bak file exists'); } }