Beispiel #1
0
 public function testImportFromXML_malformed()
 {
     $this->setExpectedException('Exception');
     $store = $this->getMock('SiteStore');
     $importer = new SiteImporter($store);
     $importer->importFromXML('THIS IS NOT XML');
 }
 /**
  * @dataProvider provideRoundTrip()
  */
 public function testRoundTrip(SiteList $sites)
 {
     $tmp = tmpfile();
     $exporter = new SiteExporter($tmp);
     $exporter->exportSites($sites);
     fseek($tmp, 0);
     $xml = fread($tmp, 16 * 1024);
     $actualSites = new SiteList();
     $store = $this->newSiteStore($actualSites);
     $importer = new SiteImporter($store);
     $importer->importFromXML($xml);
     $this->assertEquals($sites, $actualSites);
 }