getMockBuilder( '\StripState' ) ->disableOriginalConstructor() ->getMock(); $this->assertInstanceOf( StripMarkerDecoder::class, new StripMarkerDecoder( $stripState ) ); } public function testIsSupported() { $stripState = $this->getMockBuilder( '\StripState' ) ->disableOriginalConstructor() ->getMock(); $instance = new StripMarkerDecoder( $stripState ); $instance->isSupported( true ); $this->assertTrue( $instance->canUse() ); } public function testDecodeWithoutStrip() { $stripState = $this->getMockBuilder( '\StripState' ) ->disableOriginalConstructor() ->getMock(); $instance = new StripMarkerDecoder( $stripState ); $instance->isSupported( true ); $this->assertEquals( '
Foo
', $instance->decode( '
Foo
' ) ); } public function testUnstripNoWiki() { $stripState = $this->getMockBuilder( '\StripState' ) ->disableOriginalConstructor() ->getMock(); $stripState->expects( $this->once() ) ->method( 'unstripNoWiki' ) ->willReturnArgument( 0 ); $instance = new StripMarkerDecoder( $stripState ); $this->assertEquals( '<nowiki><pre>Foo</pre></nowiki>', $instance->unstrip( '
Foo
' ) ); } public function testUnstripGeneral() { $stripState = $this->getMockBuilder( '\StripState' ) ->disableOriginalConstructor() ->getMock(); $stripState->expects( $this->once() ) ->method( 'unstripNoWiki' ) ->willReturn( '' ); $stripState->expects( $this->once() ) ->method( 'unstripGeneral' ); $instance = new StripMarkerDecoder( $stripState ); $instance->isSupported( true ); $instance->unstrip( '
Foo
' ); } }