/** * */ public function testDumpSiteMap() { $siteMapEntity = new SiteMapEntity(); $siteMapEntity->setLoc('http://test.com/sitemap1.xml'); $siteMapEntity->setLastmod(new \DateTime('2015-09-10')); $this->siteMapIndexEntity->addSiteMap($siteMapEntity); $this->assertRegExp('/\\<sitemap\\>\\<loc\\>http\\:\\/\\/test\\.com\\/sitemap1\\.xml\\<\\/loc\\>\\<lastmod\\>2015\\-09\\-10\\<\\/lastmod\\>\\<\\/sitemap\\>/', $this->siteMapIndexEntity->getXml()); }
/** * */ public function testDumpLocation() { $locationEntity = new LocationEntity(); $locationEntity->setLocation('http://test.com/'); $locationEntity->setLastmod(new \DateTime('2015-09-10')); $this->siteMapEntity->addLocation($locationEntity); $this->assertRegExp('/\\<url\\>\\<loc\\>http\\:\\/\\/test\\.com\\/\\<\\/loc\\>\\<lastmod\\>2015\\-09\\-10\\<\\/lastmod\\>\\<\\/url\\>/', $this->siteMapEntity->getXml()); }
/** * */ public function testSaveSiteMapWithSiteMapEntityAndLocation() { $saveSiteMap = $this->reflectionClass->getMethod('saveSiteMap'); $saveSiteMap->setAccessible(true); $filesystem = new Filesystem(); $dumpEntity = new DumpEntity(); $siteMapEntity = new SiteMapEntity(); $siteMapEntity->setLoc('http://test/sitemap.xml'); $dumpEntity->setSiteMapEntity($siteMapEntity)->setWebDir(__DIR__)->setDomain('test'); $this->dumpManager->setEntity($dumpEntity); $saveSiteMap->invoke($this->dumpManager); $this->assertTrue($filesystem->exists(__DIR__ . '/sitemap.xml')); $filesystem->remove(__DIR__ . '/sitemap.xml'); }