mirror of
https://gh.wpcy.net/https://github.com/elementor/wp2static.git
synced 2026-05-28 03:52:57 +08:00
87 lines
3.2 KiB
PHP
87 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace WP2Static;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class SitemapStripCommentsTest extends TestCase {
|
|
|
|
/**
|
|
* @group ExternalRequests
|
|
* @dataProvider generateDataForTest
|
|
* @param string $url URL
|
|
* @param string $body URL body content
|
|
*/
|
|
public function testStrict( $url, $body ) {
|
|
$parser = new SitemapParser();
|
|
$this->assertInstanceOf( 'WP2Static\SitemapParser', $parser );
|
|
$parser->parse( $url, $body );
|
|
$this->assertEquals(
|
|
[
|
|
'https://www.bellinghambaymarathon.org/post-sitemap.xml' => [
|
|
'loc' => 'https://www.bellinghambaymarathon.org/post-sitemap.xml',
|
|
'lastmod' => '2019-07-19T10:18:07-07:00',
|
|
],
|
|
'https://www.bellinghambaymarathon.org/page-sitemap.xml' => [
|
|
'loc' => 'https://www.bellinghambaymarathon.org/page-sitemap.xml',
|
|
'lastmod' => '2019-07-29T06:51:35-07:00',
|
|
],
|
|
'https://www.bellinghambaymarathon.org/category-sitemap.xml' => [
|
|
'loc' => 'https://www.bellinghambaymarathon.org/category-sitemap.xml',
|
|
'lastmod' => '2019-07-19T10:18:07-07:00',
|
|
],
|
|
'https://www.bellinghambaymarathon.org/post_tag-sitemap.xml' => [
|
|
'loc' => 'https://www.bellinghambaymarathon.org/post_tag-sitemap.xml',
|
|
'lastmod' => '2019-05-16T10:06:14-07:00',
|
|
],
|
|
'https://www.bellinghambaymarathon.org/author-sitemap.xml' => [
|
|
'loc' => 'https://www.bellinghambaymarathon.org/author-sitemap.xml',
|
|
'lastmod' => '2018-08-22T17:12:52-07:00',
|
|
],
|
|
],
|
|
$parser->getSitemaps()
|
|
);
|
|
$this->assertEquals( [], $parser->getURLs() );
|
|
}
|
|
|
|
/**
|
|
* Generate test data
|
|
*
|
|
* @return array
|
|
*/
|
|
public function generateDataForTest() {
|
|
return [
|
|
[
|
|
'https://www.bellinghambaymarathon.org/sitemap_index.xml',
|
|
<<<TEXT
|
|
<!-- This page is cached by the Hummingbird Performance plugin v2.0.1 - https://blah.com/. -->
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<?xml-stylesheet type="text/xsl" href="//www.bellinghambaymarathon.org/main-sitemap.xsl"?>
|
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
<sitemap>
|
|
<loc>https://www.bellinghambaymarathon.org/post-sitemap.xml</loc>
|
|
<lastmod>2019-07-19T10:18:07-07:00</lastmod>
|
|
</sitemap>
|
|
<sitemap>
|
|
<loc>https://www.bellinghambaymarathon.org/page-sitemap.xml</loc>
|
|
<lastmod>2019-07-29T06:51:35-07:00</lastmod>
|
|
</sitemap>
|
|
<sitemap>
|
|
<loc>https://www.bellinghambaymarathon.org/category-sitemap.xml</loc>
|
|
<lastmod>2019-07-19T10:18:07-07:00</lastmod>
|
|
</sitemap>
|
|
<sitemap>
|
|
<loc>https://www.bellinghambaymarathon.org/post_tag-sitemap.xml</loc>
|
|
<lastmod>2019-05-16T10:06:14-07:00</lastmod>
|
|
</sitemap>
|
|
<sitemap>
|
|
<loc>https://www.bellinghambaymarathon.org/author-sitemap.xml</loc>
|
|
<lastmod>2018-08-22T17:12:52-07:00</lastmod>
|
|
</sitemap>
|
|
</sitemapindex>
|
|
<!-- XML Sitemap generated by Yoast SEO --><!-- Hummingbird 1.06 seconds, on 01-08-19 23:06:50 -->
|
|
TEXT,
|
|
],
|
|
];
|
|
}
|
|
}
|