Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
ApiFlowNewTopic
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 5
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getBlockParams
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getAction
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getAllowedParams
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 getExamplesMessages
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Flow\Api;
4
5use Wikimedia\ParamValidator\ParamValidator;
6
7class ApiFlowNewTopic extends ApiFlowBasePost {
8
9    public function __construct( $api, $modName ) {
10        parent::__construct( $api, $modName, 'nt' );
11    }
12
13    /**
14     * Taken from ext.flow.base.js
15     * @return array
16     */
17    protected function getBlockParams() {
18        return [ 'topiclist' => $this->extractRequestParams() ];
19    }
20
21    protected function getAction() {
22        return 'new-topic';
23    }
24
25    public function getAllowedParams() {
26        return [
27            'topic' => [
28                ParamValidator::PARAM_REQUIRED => true,
29            ],
30            'content' => [
31                ParamValidator::PARAM_REQUIRED => true,
32            ],
33            'format' => [
34                ParamValidator::PARAM_DEFAULT => 'wikitext',
35                ParamValidator::PARAM_TYPE => [ 'html', 'wikitext' ],
36            ],
37        ] + parent::getAllowedParams();
38    }
39
40    /**
41     * @inheritDoc
42     */
43    protected function getExamplesMessages() {
44        return [
45            'action=flow&submodule=new-topic&page=Talk:Sandbox&nttopic=Hi&ntcontent=Nice%20to&20meet%20you&ntformat=wikitext'
46                => 'apihelp-flow+new-topic-example-1',
47        ];
48    }
49}