public function LingotekUnitTest::testGetFiltersWithNoData in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
- 4.0.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
- 3.0.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
- 3.1.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
- 3.2.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
- 3.3.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
- 3.4.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
- 3.5.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
- 3.6.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
- 3.8.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testGetFiltersWithNoData()
@covers ::getFilters
File
- tests/
src/ Unit/ LingotekUnitTest.php, line 230
Class
- LingotekUnitTest
- @coversDefaultClass \Drupal\lingotek\Lingotek @group lingotek @preserveGlobalState disabled
Namespace
Drupal\Tests\lingotek\UnitCode
public function testGetFiltersWithNoData() {
// A call is performed when getting filters and there are none locally.
$this->config
->expects($this
->at(0))
->method('get')
->with('account.resources.filter')
->will($this
->returnValue([]));
$this->config
->expects($this
->at(1))
->method('get')
->with('default.community')
->will($this
->returnValue([
'my_community',
]));
$this->config
->expects($this
->at(2))
->method('get')
->with('default.filter')
->will($this
->returnValue(NULL));
// Ensure the call will be made.
$this->api
->expects($this
->once())
->method('getFilters')
->will($this
->returnValue([
'a_filter' => 'A filter',
]));
// And the results will be stored.
$this->configEditable
->expects($this
->at(0))
->method('set')
->with('account.resources.filter', [
'a_filter' => 'A filter',
])
->will($this
->returnSelf());
$this->configEditable
->expects($this
->at(1))
->method('save');
$this->configEditable
->expects($this
->at(2))
->method('set')
->with('default.filter', 'a_filter')
->will($this
->returnSelf());
$this->configEditable
->expects($this
->at(3))
->method('save');
$filters = $this->lingotek
->getFilters(FALSE);
$this
->assertArrayEquals($filters, [
'a_filter' => 'A filter',
]);
}