forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmlrpc.php
More file actions
70 lines (58 loc) · 1.77 KB
/
xmlrpc.php
File metadata and controls
70 lines (58 loc) · 1.77 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* @group functions
* @group xmlrpc
*
* @ticket 53490
*/
class Tests_Functions_XMLRPC extends WP_UnitTestCase {
private $test_content = '
<title>title</title>
<category>category,category1</category>
<content>content</content>
';
/**
* Tests that xmlrpc_getposttitle() returns the post title if found in the XML.
*
* @covers ::xmlrpc_getposttitle
*/
public function test_xmlrpc_getposttitle() {
$this->assertSame( 'title', xmlrpc_getposttitle( $this->test_content ) );
}
/**
* Tests that xmlrpc_getposttitle() defaults to the `$post_default_title` global.
*
* @covers ::xmlrpc_getposttitle
*/
public function test_xmlrpc_getposttitle_default() {
global $post_default_title;
$post_default_title = 'post_default_title';
$this->assertSame( 'post_default_title', xmlrpc_getposttitle( '' ) );
}
/**
* Tests that xmlrpc_getpostcategory() returns post categories if found in the XML.
*
* @covers ::xmlrpc_getpostcategory
*/
public function test_xmlrpc_getpostcategory() {
$this->assertSame( array( 'category', 'category1' ), xmlrpc_getpostcategory( $this->test_content ) );
}
/**
* Tests that xmlrpc_getpostcategory() defaults to the `$post_default_category` global.
*
* @covers ::xmlrpc_getpostcategory
*/
public function test_xmlrpc_getpostcategory_default() {
global $post_default_category;
$post_default_category = 'post_default_category';
$this->assertSame( 'post_default_category', xmlrpc_getpostcategory( '' ) );
}
/**
* Tests that xmlrpc_removepostdata() returns XML content without title and category elements.
*
* @covers ::xmlrpc_removepostdata
*/
public function test_xmlrpc_removepostdata() {
$this->assertSame( '<content>content</content>', xmlrpc_removepostdata( $this->test_content ) );
}
}