LoggerTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 2 1
A testEnhanceLogEntry() 0 9 2
1
<?php
2
3
namespace Drupal\Tests\mongodb_watchdog\Unit;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * Test the ControllerBase mechanisms.
9
 *
10
 * @coversDefaultClass \Drupal\mongodb_watchdog\Logger
11
 *
12
 * @group mongodb
13
 */
14
class LoggerTest extends TestCase {
15
16
  /**
17
   * {@inheritDoc}
18
   */
19
  public function setUp(): void {
20
    require_once __DIR__ . "/../../modules/mongodb_watchdog_test/mongodb_watchdog_test.module";
21
  }
22
23
  /**
24
   * Test for issue #3219325 about closures stack.
25
   *
26
   * @link https://www.drupal.org/project/mongodb/issues/3219325
27
   * @covers ::enhanceLogEntry
28
   *
29
   * @throws \ReflectionException
30
   */
31
  public function testEnhanceLogEntry(): void {
32
    $backtrace = mongodb_watchdog_test_3219325();
33
    $logger = new MockLogger();
34
    $entry = [];
35
    try {
36
      $logger->enhanceLogEntry($entry, $backtrace);
37
    }
38
    catch (\ReflectionException $e) {
39
      $this->fail($e->getMessage());
40
    }
41
  }
42
43
}
44