You are here

public function CasHelperTest::testLogWhenDebugTurnedOn in CAS 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/Service/CasHelperTest.php \Drupal\Tests\cas\Unit\Service\CasHelperTest::testLogWhenDebugTurnedOn()

Test the logging capability.

@covers ::log @covers ::__construct

File

tests/src/Unit/Service/CasHelperTest.php, line 99

Class

CasHelperTest
CasHelper unit tests.

Namespace

Drupal\Tests\cas\Unit\Service

Code

public function testLogWhenDebugTurnedOn() {

  /** @var \Drupal\Core\Config\ConfigFactory $config_factory */
  $config_factory = $this
    ->getConfigFactoryStub([
    'cas.settings' => [
      'advanced.debug_log' => TRUE,
    ],
  ]);
  $cas_helper = new CasHelper($config_factory, $this->loggerFactory, $this->token
    ->reveal());

  // The actual logger should be called twice.
  $this->loggerChannel
    ->expects($this
    ->exactly(2))
    ->method('log');
  $cas_helper
    ->log(LogLevel::DEBUG, 'This is a debug log');
  $cas_helper
    ->log(LogLevel::ERROR, 'This is an error log');
}