2008年12月1日星期一

Re: [fw-mvc] Zend_Test - How to emulate raw XML POST data?

Hi,

you can set it within the test method with:
$this->request->setMethod('POST')->setRawBody('<xml/>');

--
Pagarbiai,
Vladas Diržys
Tel.: +370 620 69020
www.dirzys.com


On Tue, Dec 2, 2008 at 3:00 AM, afx114 <jsnodspam@gmail.com> wrote:

I have a controller that parses raw XML POST data, and I'm trying to figure
out how to emulate this within Zend_Test_PHPUnit_ControllerTestCase.  I can
manually emulate using Zend_Http_Client like so:

$request = new Zend_Http_Client('http://www.domain.com/controller/action');
$xml = 'some valid xml here';
$result =
$request->setRawData($xml)->setEncType('text/xml')->request('POST')->getBody();

However, I can't figure out how to run assertions against the result.

Can I just manually set $this->response->body = $result, and then run the
standard Zend_Test assertions against it?

Or is there an better way to emulate raw XML POST data from within
Zend_Test_PHPUnit_ControllerTestCase ?

Thx in advance.  :)
--
View this message in context: http://www.nabble.com/Zend_Test---How-to-emulate-raw-XML-POST-data--tp20784041p20784041.html
Sent from the Zend MVC mailing list archive at Nabble.com.


没有评论: