You are here

private function FileUploadSecureValidatorTest::getLoggerFactoryMock in File Upload Secure Validator 8

Utility function for getting a LoggerChannelFactory service.

1 call to FileUploadSecureValidatorTest::getLoggerFactoryMock()
FileUploadSecureValidatorTest::testFileUploadSecureValidatorValidate in tests/src/Unit/FileUploadSecureValidatorTest.php
Tests the file upload validate function of the provided service.

File

tests/src/Unit/FileUploadSecureValidatorTest.php, line 140

Class

FileUploadSecureValidatorTest
A class for unit testing the file_upload_secure_validator service.

Namespace

Drupal\Tests\file_upload_secure_validator\Unit

Code

private function getLoggerFactoryMock() {
  $loggerChannel = $this
    ->getMockBuilder('Drupal\\Core\\Logger\\LoggerChannel')
    ->disableOriginalConstructor()
    ->getMock();
  $loggerChannel
    ->expects($this
    ->any())
    ->method('error')
    ->will($this
    ->returnValue(''));
  $loggerChannelFactory = $this
    ->getMockBuilder('Drupal\\Core\\Logger\\LoggerChannelFactory')
    ->disableOriginalConstructor()
    ->getMock();
  $loggerChannelFactory
    ->expects($this
    ->any())
    ->method('get')
    ->will($this
    ->returnValue($loggerChannel));
  return $loggerChannelFactory;
}