You are here

protected function SearchPageRepositoryTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php, line 52
Contains \Drupal\Tests\search\Unit\SearchPageRepositoryTest.

Class

SearchPageRepositoryTest
@coversDefaultClass \Drupal\search\SearchPageRepository @group search

Namespace

Drupal\Tests\search\Unit

Code

protected function setUp() : void {
  $this->query = $this
    ->createMock('Drupal\\Core\\Entity\\Query\\QueryInterface');
  $this->storage = $this
    ->createMock('Drupal\\Core\\Config\\Entity\\ConfigEntityStorageInterface');
  $this->storage
    ->expects($this
    ->any())
    ->method('getQuery')
    ->will($this
    ->returnValue($this->query));

  /** @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit\Framework\MockObject\MockObject $entity_type_manager */
  $entity_type_manager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $entity_type_manager
    ->expects($this
    ->any())
    ->method('getStorage')
    ->will($this
    ->returnValue($this->storage));
  $this->configFactory = $this
    ->createMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
  $this->searchPageRepository = new SearchPageRepository($this->configFactory, $entity_type_manager);
}