46 $this->assertSame( $expected, $builder->addNewLineAtEnd(
$input ) );
51 $user->setOption(
'editfont',
'monospace' );
53 $title = $this->getMockBuilder( Title::class )
54 ->disableOriginalConstructor()
56 $title->expects( $this->
any() )
57 ->method(
'getPageLanguage' )
58 ->will( $this->returnValue( Language::factory(
'en' ) ) );
61 $attribs = $builder->buildTextboxAttribs(
63 [
'class' =>
'foo bar',
'data-foo' =>
'123',
'rows' => 30 ],
68 $this->assertInternalType(
'array',
$attribs );
70 $this->assertArrayHasKey(
'data-foo',
$attribs );
72 $this->assertSame(
'foo bar mw-editfont-monospace',
$attribs[
'class'] );
74 $this->assertSame( 30,
$attribs[
'rows'] );
75 $this->assertSame(
'en',
$attribs[
'lang'] );
77 $attribs2 = $builder->buildTextboxAttribs(
78 'mw-textbox2', [
'class' => [
'foo',
'bar' ] ], $user, $title
81 $this->assertSame( [
'foo',
'bar',
'mw-editfont-monospace' ], $attribs2[
'class'] );
83 $attribs3 = $builder->buildTextboxAttribs(
84 'mw-textbox3', [], $user, $title
87 $this->assertSame(
'mw-editfont-monospace', $attribs3[
'class'] );
98 [
'mw-new-classname' ],
100 [
'class' =>
'mw-new-classname' ],
104 [
'title' =>
'My Title' ],
105 [
'title' =>
'My Title' ],
108 [
'mw-new-classname' ],
109 [
'title' =>
'My Title' ],
110 [
'title' =>
'My Title',
'class' =>
'mw-new-classname' ],
113 [
'mw-new-classname' ],
114 [
'class' =>
'mw-existing-classname' ],
115 [
'class' =>
'mw-existing-classname mw-new-classname' ],
118 [
'mw-new-classname',
'mw-existing-classname' ],
119 [
'class' =>
'mw-existing-classname' ],
120 [
'class' =>
'mw-existing-classname mw-new-classname' ],
132 $builder->mergeClassesIntoAttributes( $inputClasses, $inputAttributes )
151 [
'mw-textarea-protected' ]
155 [
'isProtected',
'isSemiProtected' ],
156 [
'mw-textarea-sprotected' ],
160 [
'isProtected',
'isCascadeProtected' ],
161 [
'mw-textarea-protected',
'mw-textarea-cprotected' ],
165 [
'isProtected',
'isCascadeProtected',
'isSemiProtected' ],
166 [
'mw-textarea-sprotected',
'mw-textarea-cprotected' ],
181 'wgRestrictionLevels' => $restrictionLevels
185 $this->assertSame( $expected, $builder->getTextboxProtectionCSSClasses(
186 $this->mockProtectedTitle( $protectionModes )
194 $title = $this->getMockBuilder( Title::class )
195 ->disableOriginalConstructor()
198 $title->expects( $this->
any() )
199 ->method(
'getNamespace' )
200 ->will( $this->returnValue( 1 ) );
202 foreach ( $methodsToReturnTrue as $method ) {
203 $title->expects( $this->
any() )
205 ->will( $this->returnValue(
true ) );
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
Internationalisation code.
Helps EditPage build textboxes.
\MediaWiki\EditPage\TextboxBuilder
provideGetTextboxProtectionCSSClasses()
testMergeClassesIntoAttributes( $inputClasses, $inputAttributes, $expected)
provideMergeClassesIntoAttributes
testBuildTextboxAttribs()
testAddNewLineAtEnd( $input, $expected)
provideAddNewLineAtEnd
provideMergeClassesIntoAttributes()
testGetTextboxProtectionCSSClasses( $restrictionLevels, $protectionModes, $expected)
provideGetTextboxProtectionCSSClasses
mockProtectedTitle( $methodsToReturnTrue)
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
namespace and then decline to actually register it file or subcat img or subcat $title
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
Copyright (C) 2017 Kunal Mehta legoktm@member.fsf.org
if(is_array($mode)) switch( $mode) $input