forked from Yoast/wordpress-seo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-class-wpseo-sitemaps.php
43 lines (32 loc) · 1.01 KB
/
test-class-wpseo-sitemaps.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
class WPSEO_Sitemaps_Test extends WPSEO_UnitTestCase {
/**
* @var WPSEO_Sitemaps
*/
private static $class_instance;
public static function setUpBeforeClass() {
self::$class_instance = new WPSEO_Sitemaps;
}
/**
* @covers WPSEO_Sitemaps::canonical
*/
public function test_canonical() {
$url = site_url();
$this->assertNotEmpty( self::$class_instance->canonical( $url ) );
set_query_var( 'sitemap', 'sitemap_value' );
$this->assertFalse( self::$class_instance->canonical( $url ) );
set_query_var( 'xsl', 'xsl_value' );
$this->assertFalse( self::$class_instance->canonical( $url ) );
}
/**
* @covers WPSEO_Sitemaps::get_last_modified
*/
public function test_get_last_modified() {
// create and go to post
$post_id = $this->factory->post->create();
$this->go_to( get_permalink( $post_id ) );
$date = self::$class_instance->get_last_modified( array( 'post' ) );
$post = get_post( $post_id );
$this->assertEquals( $date, date( 'c', strtotime( $post->post_modified_gmt ) ) );
}
}