protected function saveRegistry() { if (!$this->registryFile) { PWELogger::warn("No registry file set, won't try to save registry"); return; } try { PWEXML::cleanEmptyNodes($this->registryArray['registry'][0]); } catch (PHPFatalException $e) { PWELogger::warn("Failed cleaning empty nodes: %s", $e); } PWELogger::info("Saving registry file: %s", $this->registryFile); $XML = new PWEXML($this->PWE->getTempDirectory()); $XML->ArrayToFile($this->registryArray, $this->registryFile); $XML->FileToArray($this->registryFile, $this->registryArray); }
public function testBrokenWrite() { $tmp = PWEUnitTests::utGetCleanTMP(); $registerData = array(); $registerData['!a']['dir'] = '/tmp'; $registerData['!c']['ArchiveToken'] = array('!v' => 'changeme'); $xml = new PWEXML(); $data = array('test' => array($registerData)); try { $xml->ArrayToFile($data, $tmp . '/test.xml'); $this->fail(); } catch (RuntimeException $e) { $this->assertFileNotExists($tmp . '/test.xml'); } }