mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Add unit tests for XMLRPC request parser
This commit is contained in:
parent
2407ad15df
commit
716b0e19bd
2 changed files with 40 additions and 0 deletions
20
tests/_data/xmlrpc/request.xml
Normal file
20
tests/_data/xmlrpc/request.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<methodCall>
|
||||
<params>
|
||||
<module><![CDATA[board]]></module>
|
||||
<act><![CDATA[procBoardInsertDocument]]></act>
|
||||
<mid><![CDATA[board]]></mid>
|
||||
<document_srl><![CDATA[197]]></document_srl>
|
||||
<title><![CDATA[제목]]></title>
|
||||
<content><![CDATA[<p>내용</p>
|
||||
<p>내용</p>]]>
|
||||
</content>
|
||||
<foobar type="array">
|
||||
<subkey1><![CDATA[customvalue1]]></subkey1>
|
||||
<subkey2><![CDATA[customvalue2]]></subkey2>
|
||||
<subkey3 type="array">
|
||||
<subsubkey>look here</subsubkey>
|
||||
</subkey3>
|
||||
</foobar>
|
||||
</params>
|
||||
</methodCall>
|
||||
20
tests/unit/framework/parsers/XmlrpcParserTest.php
Normal file
20
tests/unit/framework/parsers/XmlrpcParserTest.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
class XmlrpcParserTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
public function testParse()
|
||||
{
|
||||
$xml = file_get_contents(\RX_BASEDIR . 'tests/_data/xmlrpc/request.xml');
|
||||
$params = Rhymix\Framework\Parsers\XMLRPCParser::parse($xml);
|
||||
$this->assertTrue(is_array($params));
|
||||
$this->assertEquals('board', $params['module']);
|
||||
$this->assertEquals('procBoardInsertDocument', $params['act']);
|
||||
$this->assertEquals('제목', $params['title']);
|
||||
$this->assertEquals('<p>내용</p>' . "\n\t\t\t" . '<p>내용</p>' . "\n\t\t", $params['content']);
|
||||
$this->assertTrue(is_array($params['foobar']));
|
||||
$this->assertEquals('customvalue1', $params['foobar']['subkey1']);
|
||||
$this->assertEquals('customvalue2', $params['foobar']['subkey2']);
|
||||
$this->assertTrue(is_array($params['foobar']['subkey3']));
|
||||
$this->assertEquals('look here', $params['foobar']['subkey3']['subsubkey']);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue