You are here

public function SearchPageRepositoryTest::testGetActiveSearchPages in Zircon Profile 8

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

Tests the getActiveSearchPages() method.

File

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

Class

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

Namespace

Drupal\Tests\search\Unit

Code

public function testGetActiveSearchPages() {
  $this->query
    ->expects($this
    ->once())
    ->method('condition')
    ->with('status', TRUE)
    ->will($this
    ->returnValue($this->query));
  $this->query
    ->expects($this
    ->once())
    ->method('execute')
    ->will($this
    ->returnValue(array(
    'test' => 'test',
    'other_test' => 'other_test',
  )));
  $entities = array();
  $entities['test'] = $this
    ->getMock('Drupal\\search\\SearchPageInterface');
  $entities['other_test'] = $this
    ->getMock('Drupal\\search\\SearchPageInterface');
  $this->storage
    ->expects($this
    ->once())
    ->method('loadMultiple')
    ->with(array(
    'test' => 'test',
    'other_test' => 'other_test',
  ))
    ->will($this
    ->returnValue($entities));
  $result = $this->searchPageRepository
    ->getActiveSearchPages();
  $this
    ->assertSame($entities, $result);
}