Remove mention of IE9 support
[lhc/web/wiklou.git] / tests / phpunit / mocks / content / DummyContentForTesting.php
1 <?php
2
3 class DummyContentForTesting extends AbstractContent {
4
5 public function __construct( $data ) {
6 parent::__construct( "testing" );
7
8 $this->data = $data;
9 }
10
11 public function serialize( $format = null ) {
12 return serialize( $this->data );
13 }
14
15 /**
16 * @return string A string representing the content in a way useful for
17 * building a full text search index. If no useful representation exists,
18 * this method returns an empty string.
19 */
20 public function getTextForSearchIndex() {
21 return '';
22 }
23
24 /**
25 * @return string|bool The wikitext to include when another page includes this content,
26 * or false if the content is not includable in a wikitext page.
27 */
28 public function getWikitextForTransclusion() {
29 return false;
30 }
31
32 /**
33 * Returns a textual representation of the content suitable for use in edit
34 * summaries and log messages.
35 *
36 * @param int $maxlength Maximum length of the summary text.
37 * @return string The summary text.
38 */
39 public function getTextForSummary( $maxlength = 250 ) {
40 return '';
41 }
42
43 /**
44 * Returns native represenation of the data. Interpretation depends on the data model used,
45 * as given by getDataModel().
46 *
47 * @return mixed The native representation of the content. Could be a string, a nested array
48 * structure, an object, a binary blob... anything, really.
49 */
50 public function getNativeData() {
51 return $this->data;
52 }
53
54 /**
55 * returns the content's nominal size in bogo-bytes.
56 *
57 * @return int
58 */
59 public function getSize() {
60 return strlen( $this->data );
61 }
62
63 /**
64 * Return a copy of this Content object. The following must be true for the object returned
65 * if $copy = $original->copy()
66 *
67 * * get_class($original) === get_class($copy)
68 * * $original->getModel() === $copy->getModel()
69 * * $original->equals( $copy )
70 *
71 * If and only if the Content object is imutable, the copy() method can and should
72 * return $this. That is, $copy === $original may be true, but only for imutable content
73 * objects.
74 *
75 * @return Content A copy of this object
76 */
77 public function copy() {
78 return $this;
79 }
80
81 /**
82 * Returns true if this content is countable as a "real" wiki page, provided
83 * that it's also in a countable location (e.g. a current revision in the main namespace).
84 *
85 * @param bool|null $hasLinks If it is known whether this content contains links,
86 * provide this information here, to avoid redundant parsing to find out.
87 * @return bool
88 */
89 public function isCountable( $hasLinks = null ) {
90 return false;
91 }
92
93 /**
94 * @param Title $title
95 * @param int $revId Unused.
96 * @param null|ParserOptions $options
97 * @param bool $generateHtml Whether to generate Html (default: true). If false, the result
98 * of calling getText() on the ParserOutput object returned by this method is undefined.
99 *
100 * @return ParserOutput
101 */
102 public function getParserOutput( Title $title, $revId = null,
103 ParserOptions $options = null, $generateHtml = true
104 ) {
105 return new ParserOutput( $this->getNativeData() );
106 }
107
108 /**
109 * @see AbstractContent::fillParserOutput()
110 *
111 * @param Title $title Context title for parsing
112 * @param int|null $revId Revision ID (for {{REVISIONID}})
113 * @param ParserOptions $options Parser options
114 * @param bool $generateHtml Whether or not to generate HTML
115 * @param ParserOutput &$output The output object to fill (reference).
116 */
117 protected function fillParserOutput( Title $title, $revId,
118 ParserOptions $options, $generateHtml, ParserOutput &$output ) {
119 $output = new ParserOutput( $this->getNativeData() );
120 }
121 }