public function testRegisterLoggableEventType()
 {
     $manualLogEntry = $this->getMockBuilder('\\ManualLogEntry')->disableOriginalConstructor()->getMock();
     $manualLogEntry->expects($this->once())->method('insert')->will($this->returnValue(42));
     $instance = new ManualEntryLogger($manualLogEntry);
     $instance->registerLoggableEventType('Foo');
     $this->assertEquals(42, $instance->log('Foo', 'Bar', 'Baz', 'Yui'));
 }
 /**
  * @since 2.4
  *
  * @param string $message
  * @param string $target
  */
 public function log($message, $target = '')
 {
     if ($target === '') {
         $target = $this->performer;
     }
     // #1983
     if ($this->maxNameChars < strlen($target)) {
         throw new RuntimeException('wgMaxNameChars requires at least ' . strlen($target));
     }
     $this->manualEntryLogger->log('maintenance', $this->performer, $target, $message);
 }
 public function testLogToTableForNonLoggableEvent()
 {
     $instance = new ManualEntryLogger();
     $this->assertNull($instance->log('Foo', 'Bar', 'Baz', 'Yui'));
 }