public function ViewsDataTest::testCacheCallsWithSameTableMultipleTimesAndWarmCache in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::testCacheCallsWithSameTableMultipleTimesAndWarmCache()
Tests the cache calls for a single table and warm cache for:
- all tables
- views_test_data
File
- core/
modules/ views/ tests/ src/ Unit/ ViewsDataTest.php, line 432 - Contains \Drupal\Tests\views\Unit\ViewsDataTest.
Class
- ViewsDataTest
- @coversDefaultClass \Drupal\views\ViewsData @group views
Namespace
Drupal\Tests\views\UnitCode
public function testCacheCallsWithSameTableMultipleTimesAndWarmCache() {
$expected_views_data = $this
->viewsDataWithProvider();
$this->moduleHandler
->expects($this
->never())
->method('getImplementations');
// Setup a warm cache backend for a single table.
$this->cacheBackend
->expects($this
->once())
->method('get')
->with('views_data:views_test_data:en')
->will($this
->returnValue((object) array(
'data' => $expected_views_data['views_test_data'],
)));
$this->cacheBackend
->expects($this
->never())
->method('set');
// We have a warm cache now, so this will only request the tables-specific
// cache entry and return that.
for ($i = 0; $i < 5; $i++) {
$views_data = $this->viewsData
->get('views_test_data');
$this
->assertSame($expected_views_data['views_test_data'], $views_data);
}
}