You are here

protected function JsonLogTest::setUp in JSONlog 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/JsonLogTest.php \Drupal\Tests\jsonlog\Unit\JsonLogTest::setUp()
  2. 3.x tests/src/Unit/JsonLogTest.php \Drupal\Tests\jsonlog\Unit\JsonLogTest::setUp()

Overrides UnitTestCase::setUp

File

tests/src/Unit/JsonLogTest.php, line 42

Class

JsonLogTest
Unit tests for JsonLog class

Namespace

Drupal\Tests\jsonlog\Unit

Code

protected function setUp() {
  parent::setUp();
  $config_stub['jsonlog.settings'] = [
    'jsonlog_severity_threshold' => self::DEFAULT_THRESHOLD,
    'jsonlog_truncate' => 64,
    'jsonlog_siteid' => self::DEFAULT_SITE_ID,
    'jsonlog_canonical' => '',
    'jsonlog_file_time' => self::DEFAULT_TIME_FORMAT,
    'jsonlog_dir' => self::DEFAULT_LOG_DIR,
    'jsonlog_tags' => 'test',
  ];

  /** @var ConfigFactoryInterface $configFactoryMock */
  $configFactoryMock = $this
    ->getConfigFactoryStub($config_stub);

  /** @var LogMessageParserInterface $messageParserMock */
  $messageParserMock = $this
    ->getEmptyMessageParserMock();

  /** @var ModuleHandlerInterface $moduleHandlerMock */
  $moduleHandlerMock = $this
    ->createMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');

  /** @var RequestStack requestStackMock */
  $this->requestStackMock = $this
    ->createMock('Symfony\\Component\\HttpFoundation\\RequestStack');
  $this->jsonLogger = new JsonLog($configFactoryMock, $messageParserMock, $moduleHandlerMock, $this->requestStackMock);
}