summaryrefslogtreecommitdiffstats
path: root/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php')
-rw-r--r--core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php
index f2dbd3e..05b51aa 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php
@@ -43,6 +43,28 @@ class CacheableMetadataTest extends UnitTestCase {
}
/**
+ * @covers ::addCacheableDependency
+ * @dataProvider providerTestMerge
+ *
+ * This only tests at a high level, because it reuses existing logic. Detailed
+ * tests exist for the existing logic:
+ *
+ * @see \Drupal\Tests\Core\Cache\CacheTest::testMergeTags()
+ * @see \Drupal\Tests\Core\Cache\CacheTest::testMergeMaxAges()
+ * @see \Drupal\Tests\Core\Cache\CacheContextsTest
+ */
+ public function testAddCacheableDependency(CacheableMetadata $a, CacheableMetadata $b, CacheableMetadata $expected) {
+ $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $container = new ContainerBuilder();
+ $container->set('cache_contexts_manager', $cache_contexts_manager);
+ \Drupal::setContainer($container);
+
+ $this->assertEquals($expected, $a->addCacheableDependency($b));
+ }
+
+ /**
* Provides test data for testMerge().
*
* @return array