function SearchPageRepositoryTest::setUp

Same name in other branches
  1. 9 core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::setUp()
  2. 10 core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::setUp()
  3. 11.x 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

Class

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

Namespace

Drupal\Tests\search\Unit

Code

protected function setUp() {
    $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.