getMockBuilder( '\SMW\MediaWiki\ManualEntryLogger' ) ->disableOriginalConstructor() ->getMock(); $this->assertInstanceOf( '\SMW\Maintenance\MaintenanceLogger', new MaintenanceLogger( 'Foo', $manualEntryLogger ) ); } public function testLog() { $manualEntryLogger = $this->getMockBuilder( '\SMW\MediaWiki\ManualEntryLogger' ) ->disableOriginalConstructor() ->getMock(); $manualEntryLogger->expects( $this->once() ) ->method( 'log' ) ->with( $this->stringContains( 'maintenance' ), 'Foo', 'Foo', $this->stringContains( 'bar' ) ); $instance = new MaintenanceLogger( 'Foo', $manualEntryLogger ); $instance->log( 'bar' ); } public function testLogWithInvalidNameLengthThrowsException() { $manualEntryLogger = $this->getMockBuilder( '\SMW\MediaWiki\ManualEntryLogger' ) ->disableOriginalConstructor() ->getMock(); $manualEntryLogger->expects( $this->never() ) ->method( 'log' ); $instance = new MaintenanceLogger( 'Foo', $manualEntryLogger ); $instance->setMaxNameChars( 2 ); $this->expectException( 'RuntimeException' ); $instance->log( 'bar' ); } }