forked from Yoast/wordpress-seo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-class-googleplus.php
47 lines (36 loc) · 1.07 KB
/
test-class-googleplus.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
44
45
46
47
<?php
class WPSEO_GooglePlus_Test extends WPSEO_UnitTestCase {
/**
* @var WPSEO_GooglePlus
*/
private static $class_instance;
public static function setUpBeforeClass() {
self::$class_instance = new WPSEO_GooglePlus;
}
/**
* Placeholder test to prevent PHPUnit from throwing errors
*/
public function test_class_is_tested() {
$this->assertTrue( true );
}
/**
* @covers WPSEO_GooglePlus::description
*/
public function test_description() {
self::$class_instance->description();
$this->expectOutput( '' );
// create and go to post
$post_id = $this->factory->post->create();
$this->go_to( get_permalink( $post_id ) );
// should be empty, didn't set google-plus-description
self::$class_instance->description();
$this->expectOutput( '' );
// set meta
$description = 'Google description';
WPSEO_Meta::set_value( 'google-plus-description', $description, $post_id );
// test output
$expected = '<meta itemprop="description" content="' . $description . '">' . "\n";
self::$class_instance->description();
$this->expectOutput( $expected );
}
}