Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Working on sfViewCacheTagManager test coverage percentage

  • Loading branch information...
commit 712a2ec54d1754858aff975f831afcc1d2b91c7a 1 parent 99466a1
@fruit authored
View
5 README_ADVANCED
@@ -233,11 +233,6 @@ Explained behavior setup, file ``/config/doctrine/schema.yml``:
# (default: [])
object_class_tag_name_provider: []
- # This class responses to save/fetch data and tags
- # from/to cache with custom serialization/de-serialization
- # (default: "CacheMetadata")
- metadata_class: CacheMetadata
-
## Tag manipulations
View
5 lib/view/sfViewCacheTagManager.class.php
@@ -379,6 +379,7 @@ public function setActionCache ($uri, $content, $decoratorTemplate)
{
if (! $this->isCacheable($uri) || $this->withLayout($uri))
{
+ print "AAAAAA\n";
return $content;
}
@@ -756,6 +757,10 @@ public function disableCache ($moduleName, $actionName = null)
return;
}
+ /**
+ * @see parent::remove() The main difference, instead of $this->cache is
+ * used $this->getTaggingCache()
+ */
public function remove ($internalUri, $hostName = '', $vary = '', $contextualPrefix = '**')
{
if (sfConfig::get('sf_logging_enabled'))
View
11 test/functional/frontend/CascadeDeleteOrInvalidateTest.php
@@ -28,7 +28,6 @@
$sfTagger->setTags($alltags = array_merge($a, $b, $c, $d));
-
function checkTags ($microtime, array $toDelete, array $toInvalidate)
{
global $t, $sfTagger, $alltags;
@@ -65,7 +64,6 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
}
$run = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
-// $run = array(5);
$t->diag('RelSite model');
@@ -92,7 +90,6 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
)
);
}
- die;
if (in_array(2, $run))
{
@@ -141,6 +138,8 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
);
}
+ return;
+
$t->diag('RelCulture model (tree)');
if (in_array(4, $run))
@@ -170,6 +169,9 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
);
}
+
+
+
if (in_array(5, $run))
{
$version = sfCacheTaggingToolkit::generateVersion();
@@ -219,6 +221,7 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
);
}
+
$t->diag('RelSiteCulture model (M:M)');
if (in_array(7, $run))
@@ -241,6 +244,7 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
);
}
+
if (in_array(8, $run))
{
$version = sfCacheTaggingToolkit::generateVersion();
@@ -263,6 +267,7 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
);
}
+
$t->diag('RelSiteSetting model (1:1)');
if (in_array(9, $run))
View
1  test/functional/frontend/sfViewCacheTagManagerBridgeTest.php
@@ -183,7 +183,6 @@
'All tags are cleared'
);
-
$t->is($bridge->disableCache(), true, 'Disabled default controllers module and action');
$t->is($bridge->disableCache('blog_post', 'index'), true, 'Disabled blog_post/index to cache');
View
48 test/functional/frontend/sfViewCacheTagManagerTest.php
@@ -134,7 +134,6 @@
$cacheManager->getContentTagHandler()->removeContentTags(sfViewCacheTagManager::NAMESPACE_ACTION);
-
# (set|get)PageCache
@@ -217,7 +216,6 @@
sfConfig::set('sf_web_debug', $sfWebDebug);
-
$t->comment('listeners counts');
try
{
@@ -232,6 +230,52 @@
));
}
+
+ $layout = sfConfig::get('sf_root_dir') . '/apps/frontend/templates/layout.php';
+ $v = $cacheManager->setActionCache('/blog_post/actionWithoutLayout', 'Content, may be, to cache', $layout);
+
+ $t->is(
+ $cacheManager->isCacheable('/blog_post/actionWithoutLayout'),
+ true,
+ 'Checking again, action is still cachable'
+ );
+
+ $cacheManager->disableCache('blog_post', 'actionWithoutLayout');
+
+ $t->is(
+ $cacheManager->isCacheable('/blog_post/actionWithoutLayout'),
+ false,
+ 'Ok, then, it should be not cachable now'
+ );
+
+ $cacheManager->addCache(
+ 'blog_post',
+ 'actionWithoutLayout',
+ array(
+ 'lifeTime' => 100,
+ 'withLayout' => false,
+ )
+ );
+
+ $t->is(
+ $cacheManager->isCacheable('/blog_post/actionWithoutLayout'),
+ true,
+ 'Added again to cache'
+ );
+
+ $cacheManager->disableCache('blog_post');
+
+ $t->is(
+ $cacheManager->isCacheable('/blog_post/actionWithoutLayout'),
+ false,
+ 'Disaled all module cache, action now should not be cachable too'
+ );
+
+
+ /**
+ * After all $cacheManager->configCache[] is empty
+ */
+
$listenersCountBefore = count($sfEventDispatcher->getListeners(SF_VIEW_CACHE_MANAGER_EVENT_NAME));
$cacheManager->initialize($sfContext, $taggingCache, $cacheManager->getOptions());
$listenersCountAfter = count($sfEventDispatcher->getListeners(SF_VIEW_CACHE_MANAGER_EVENT_NAME));
Please sign in to comment.
Something went wrong with that request. Please try again.