| 741 | |
| 742 | |
| 743 | /** |
| 744 | * @ticket 35993 |
| 745 | */ |
| 746 | function test_xmlrpc_getposttitle() { |
| 747 | $title = "This is the title"; |
| 748 | $xml_rpc_with_title = $this->_xml_rpc_request_fixture($title); |
| 749 | $this->assertEquals($title, xmlrpc_getposttitle($xml_rpc_with_title), "The title doesn't match with $title"); |
| 750 | |
| 751 | global $post_default_title; |
| 752 | $post_default_title = "This is the default title"; |
| 753 | $xml_rpc_with_out_title = $this->_xml_rpc_request_fixture; |
| 754 | $this->assertEquals($post_default_title, xmlrpc_getposttitle($xml_rpc_with_out_title), "The title doesn't match with $post_default_title"); |
| 755 | } |
| 756 | |
| 757 | /** |
| 758 | * @ticket 35993 |
| 759 | */ |
| 760 | function test_xmlrpc_getpostcategory() { |
| 761 | $category = "Foo"; |
| 762 | $xml_rpc_with_category = $this->_xml_rpc_request_fixture('x title', $category); |
| 763 | $this->assertEquals(array($category), xmlrpc_getpostcategory($xml_rpc_with_category), "The category doesn't match"); |
| 764 | |
| 765 | global $post_default_category; |
| 766 | $post_default_category = array("Default category"); |
| 767 | $xml_rpc_with_out_category = $this->_xml_rpc_request_fixture; |
| 768 | $this->assertEquals($post_default_category, xmlrpc_getpostcategory($xml_rpc_with_out_category), "The category doesn't match"); |
| 769 | } |
| 770 | |
| 771 | /** |
| 772 | * @ticket 35993 |
| 773 | */ |
| 774 | function test_xmlrpc_removepostdata() { |
| 775 | $xml_rpc = $this->_xml_rpc_request_fixture('Foo', 'X Category'); |
| 776 | $xml_rpc_without_post_data = xmlrpc_removepostdata($xml_rpc); |
| 777 | |
| 778 | $this->assertEquals(0, preg_match( '/<title>(.+?)<\/title>/is', $xml_rpc_without_post_data, $matchcat), "The title shouldn't exists after the xmlrpc_removepostdata call"); |
| 779 | $this->assertEquals(0, preg_match( '/<category>(.+?)<\/category>/is', $xml_rpc_without_post_data, $matchcat), "No category should exist after the xmlrpc_removepostdata call"); |
| 780 | } |