eZ\Publish\Core\REST\Common\Tests\Input\DispatcherTest::testParse PHP Method

testParse() public method

public testParse ( )
    public function testParse()
    {
        $message = new Common\Message(array('Content-Type' => 'text/html+format'), 'Hello world!');
        $parsingDispatcher = $this->getMock('\\eZ\\Publish\\Core\\REST\\Common\\Input\\ParsingDispatcher');
        $parsingDispatcher->expects($this->at(0))->method('parse')->with(array(42), 'text/html')->will($this->returnValue(23));
        $handler = $this->getMock('\\eZ\\Publish\\Core\\REST\\Common\\Input\\Handler');
        $handler->expects($this->at(0))->method('convert')->with('Hello world!')->will($this->returnValue(array(array(42))));
        $dispatcher = new Common\Input\Dispatcher($parsingDispatcher, array('format' => $handler));
        $this->assertSame(23, $dispatcher->parse($message));
    }