You are here

trait AcquiadamLoggerFactoryTrait in Media: Acquia DAM 8

A shared mock logger channel.

Hierarchy

4 files declare their use of AcquiadamLoggerFactoryTrait
AcquiadamServiceTest.php in tests/src/Unit/AcquiadamServiceTest.php
AssetFileEntityHelperTest.php in tests/src/Unit/AssetFileEntityHelperTest.php
AssetRefreshManagerTest.php in tests/src/Unit/AssetRefreshManagerTest.php
OauthTest.php in tests/src/Unit/OauthTest.php

File

tests/src/Traits/AcquiadamLoggerFactoryTrait.php, line 11

Namespace

Drupal\Tests\media_acquiadam\Traits
View source
trait AcquiadamLoggerFactoryTrait {

  /**
   * Gets a stubbed out Logger factory for Media: Acquia DAM test usage.
   *
   * @return \PHPUnit\Framework\MockObject\MockObject|\Drupal\Core\Logger\LoggerChannelFactoryInterface
   *   A mock LoggerChannelFactoryInstance with a media_acquiadam channel.
   */
  protected function getLoggerFactoryStub() {
    $logger_channel = $this
      ->getMockBuilder(LoggerChannelInterface::class)
      ->disableOriginalConstructor()
      ->getMock();
    $logger_factory = $this
      ->getMockBuilder(LoggerChannelFactoryInterface::class)
      ->disableOriginalConstructor()
      ->getMock();
    $logger_factory
      ->method('get')
      ->with('media_acquiadam')
      ->willReturn($logger_channel);
    return $logger_factory;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AcquiadamLoggerFactoryTrait::getLoggerFactoryStub protected function Gets a stubbed out Logger factory for Media: Acquia DAM test usage.