You are here

public function SubPathautoTest::setUp in Sub-pathauto (Sub-path URL Aliases) 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/SubPathautoTest.php, line 74

Class

SubPathautoTest
@coversDefaultClass \Drupal\subpathauto\PathProcessor @group subpathauto

Namespace

Drupal\Tests\subpathauto\Unit

Code

public function setUp() {
  parent::setUp();
  $this->aliasProcessor = $this
    ->getMockBuilder('Drupal\\path_alias\\PathProcessor\\AliasPathProcessor')
    ->disableOriginalConstructor()
    ->getMock();
  $this->languageManager = $this
    ->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
  $this->languageManager
    ->expects($this
    ->any())
    ->method('getCurrentLanguage')
    ->willReturn(new Language(Language::$defaultValues));
  $this->pathValidator = $this
    ->createMock('Drupal\\Core\\Path\\PathValidatorInterface');
  $this->subPathautoSettings = $this
    ->createMock('Drupal\\Core\\Config\\ConfigBase');
  $this->configFactory = $this
    ->createMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
  $this->configFactory
    ->expects($this
    ->any())
    ->method('get')
    ->with('subpathauto.settings')
    ->willReturn($this->subPathautoSettings);
  $this->pathProcessor = new PathProcessor($this->aliasProcessor, $this->languageManager, $this->configFactory);
  $this->pathProcessor
    ->setPathValidator($this->pathValidator);
}