| Current File : /home/jvzmxxx/wiki1/extensions/Flow/tests/phpunit/api/ApiFlowReplyTest.php |
<?php
namespace Flow\Tests\Api;
/**
* @group Flow
* @group medium
*/
class ApiFlowReplyTest extends ApiTestCase {
public function testTopLevelReply() {
$topic = $this->createTopic();
$data = $this->doApiRequest( array(
'page' => $topic['topic-page'],
'token' => $this->getEditToken(),
'action' => 'flow',
'submodule' => 'reply',
'repreplyTo' => $topic['topic-id'],
'repcontent' => '⎛ ゚∩゚⎞⎛ ⍜⌒⍜⎞⎛ ゚⌒゚⎞',
'repformat' => 'wikitext',
) );
$debug = json_encode( $data );
$this->assertEquals( 'ok', $data[0]['flow']['reply']['status'], $debug );
$this->assertCount( 1, $data[0]['flow']['reply']['committed'], $debug );
$replyPostId = $data[0]['flow']['reply']['committed']['topic']['post-id'];
$replyRevisionId = $data[0]['flow']['reply']['committed']['topic']['post-revision-id'];
$data = $this->doApiRequest( array(
'page' => $topic['topic-page'],
'action' => 'flow',
'submodule' => 'view-post',
'vppostId' => $replyPostId,
'vpformat' => 'html',
) );
$debug = json_encode( $data );
$revision = $data[0]['flow']['view-post']['result']['topic']['revisions'][$replyRevisionId];
$this->assertArrayHasKey( 'changeType', $revision, $debug );
$this->assertEquals( 'reply', $revision['changeType'], $debug );
$this->assertEquals(
'⎛ ゚∩゚⎞⎛ ⍜⌒⍜⎞⎛ ゚⌒゚⎞',
trim( strip_tags( $revision['content']['content'] ) ),
$debug
);
$this->assertEquals( 'html', $revision['content']['format'], $debug );
}
}