function SearchPageRepositoryTest::testGetActiveSearchPages
Tests the getActiveSearchPages() method.
File
- 
              core/
modules/ search/ tests/ src/ Unit/ SearchPageRepositoryTest.php, line 73  
Class
- SearchPageRepositoryTest
 - @coversDefaultClass \Drupal\search\SearchPageRepository[[api-linebreak]] @group search
 
Namespace
Drupal\Tests\search\UnitCode
public function testGetActiveSearchPages() : void {
  $this->query
    ->expects($this->once())
    ->method('condition')
    ->with('status', TRUE)
    ->willReturn($this->query);
  $this->query
    ->expects($this->once())
    ->method('execute')
    ->willReturn([
    'test' => 'test',
    'other_test' => 'other_test',
  ]);
  $entities = [];
  $entities['test'] = $this->createMock('Drupal\\search\\SearchPageInterface');
  $entities['other_test'] = $this->createMock('Drupal\\search\\SearchPageInterface');
  $this->storage
    ->expects($this->once())
    ->method('loadMultiple')
    ->with([
    'test' => 'test',
    'other_test' => 'other_test',
  ])
    ->willReturn($entities);
  $result = $this->searchPageRepository
    ->getActiveSearchPages();
  $this->assertSame($entities, $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.