Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Working on sfViewCacheTagManager test coverage percentage

  • Loading branch information...
commit 712a2ec54d1754858aff975f831afcc1d2b91c7a 1 parent 99466a1
Ilya Sabelnikov authored April 05, 2011
5  README_ADVANCED
@@ -233,11 +233,6 @@ Explained behavior setup, file ``/config/doctrine/schema.yml``:
233 233
         # (default: [])
234 234
         object_class_tag_name_provider: []
235 235
 
236  
-        # This class responses to save/fetch data and tags
237  
-        # from/to cache with custom serialization/de-serialization
238  
-        # (default: "CacheMetadata")
239  
-        metadata_class: CacheMetadata
240  
-
241 236
 
242 237
 ## Tag manipulations
243 238
 
5  lib/view/sfViewCacheTagManager.class.php
@@ -379,6 +379,7 @@ public function setActionCache ($uri, $content, $decoratorTemplate)
379 379
     {
380 380
       if (! $this->isCacheable($uri) || $this->withLayout($uri))
381 381
       {
  382
+        print "AAAAAA\n";
382 383
         return $content;
383 384
       }
384 385
 
@@ -756,6 +757,10 @@ public function disableCache ($moduleName, $actionName = null)
756 757
       return;
757 758
     }
758 759
 
  760
+    /**
  761
+     * @see parent::remove()   The main difference, instead of $this->cache is
  762
+     *                         used $this->getTaggingCache()
  763
+     */
759 764
     public function remove ($internalUri, $hostName = '', $vary = '', $contextualPrefix = '**')
760 765
     {
761 766
       if (sfConfig::get('sf_logging_enabled'))
11  test/functional/frontend/CascadeDeleteOrInvalidateTest.php
@@ -28,7 +28,6 @@
28 28
 
29 29
   $sfTagger->setTags($alltags = array_merge($a, $b, $c, $d));
30 30
 
31  
-
32 31
   function checkTags ($microtime, array $toDelete, array $toInvalidate)
33 32
   {
34 33
     global $t, $sfTagger, $alltags;
@@ -65,7 +64,6 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
65 64
   }
66 65
 
67 66
   $run = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
68  
-//  $run = array(5);
69 67
 
70 68
   $t->diag('RelSite model');
71 69
 
@@ -92,7 +90,6 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
92 90
       )
93 91
     );
94 92
   }
95  
-  die;
96 93
 
97 94
   if (in_array(2, $run))
98 95
   {
@@ -141,6 +138,8 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
141 138
     );
142 139
   }
143 140
 
  141
+  return;
  142
+
144 143
   $t->diag('RelCulture model (tree)');
145 144
 
146 145
   if (in_array(4, $run))
@@ -170,6 +169,9 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
170 169
     );
171 170
   }
172 171
 
  172
+
  173
+
  174
+
173 175
   if (in_array(5, $run))
174 176
   {
175 177
     $version = sfCacheTaggingToolkit::generateVersion();
@@ -219,6 +221,7 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
219 221
     );
220 222
   }
221 223
 
  224
+
222 225
   $t->diag('RelSiteCulture model (M:M)');
223 226
 
224 227
   if (in_array(7, $run))
@@ -241,6 +244,7 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
241 244
     );
242 245
   }
243 246
 
  247
+
244 248
   if (in_array(8, $run))
245 249
   {
246 250
     $version = sfCacheTaggingToolkit::generateVersion();
@@ -263,6 +267,7 @@ function checkTags ($microtime, array $toDelete, array $toInvalidate)
263 267
     );
264 268
   }
265 269
 
  270
+
266 271
   $t->diag('RelSiteSetting model (1:1)');
267 272
 
268 273
   if (in_array(9, $run))
1  test/functional/frontend/sfViewCacheTagManagerBridgeTest.php
@@ -183,7 +183,6 @@
183 183
     'All tags are cleared'
184 184
   );
185 185
 
186  
-
187 186
   $t->is($bridge->disableCache(), true, 'Disabled default controllers module and action');
188 187
   $t->is($bridge->disableCache('blog_post', 'index'), true, 'Disabled blog_post/index to cache');
189 188
 
48  test/functional/frontend/sfViewCacheTagManagerTest.php
@@ -134,7 +134,6 @@
134 134
   $cacheManager->getContentTagHandler()->removeContentTags(sfViewCacheTagManager::NAMESPACE_ACTION);
135 135
 
136 136
 
137  
-
138 137
   # (set|get)PageCache
139 138
 
140 139
 
@@ -217,7 +216,6 @@
217 216
   sfConfig::set('sf_web_debug', $sfWebDebug);
218 217
 
219 218
 
220  
-
221 219
   $t->comment('listeners counts');
222 220
   try
223 221
   {
@@ -232,6 +230,52 @@
232 230
     ));
233 231
   }
234 232
 
  233
+
  234
+  $layout = sfConfig::get('sf_root_dir') . '/apps/frontend/templates/layout.php';
  235
+  $v = $cacheManager->setActionCache('/blog_post/actionWithoutLayout', 'Content, may be, to cache', $layout);
  236
+
  237
+  $t->is(
  238
+    $cacheManager->isCacheable('/blog_post/actionWithoutLayout'),
  239
+    true,
  240
+    'Checking again, action is still cachable'
  241
+  );
  242
+
  243
+  $cacheManager->disableCache('blog_post', 'actionWithoutLayout');
  244
+
  245
+  $t->is(
  246
+    $cacheManager->isCacheable('/blog_post/actionWithoutLayout'),
  247
+    false,
  248
+    'Ok, then, it should be not cachable now'
  249
+  );
  250
+
  251
+  $cacheManager->addCache(
  252
+    'blog_post',
  253
+    'actionWithoutLayout',
  254
+    array(
  255
+      'lifeTime'    => 100,
  256
+      'withLayout'  => false,
  257
+    )
  258
+  );
  259
+
  260
+  $t->is(
  261
+    $cacheManager->isCacheable('/blog_post/actionWithoutLayout'),
  262
+    true,
  263
+    'Added again to cache'
  264
+  );
  265
+
  266
+  $cacheManager->disableCache('blog_post');
  267
+
  268
+  $t->is(
  269
+    $cacheManager->isCacheable('/blog_post/actionWithoutLayout'),
  270
+    false,
  271
+    'Disaled all module cache, action now should not be cachable too'
  272
+  );
  273
+
  274
+
  275
+  /**
  276
+   * After all $cacheManager->configCache[] is empty
  277
+   */
  278
+
235 279
   $listenersCountBefore = count($sfEventDispatcher->getListeners(SF_VIEW_CACHE_MANAGER_EVENT_NAME));
236 280
   $cacheManager->initialize($sfContext, $taggingCache, $cacheManager->getOptions());
237 281
   $listenersCountAfter = count($sfEventDispatcher->getListeners(SF_VIEW_CACHE_MANAGER_EVENT_NAME));

0 notes on commit 712a2ec

Please sign in to comment.
Something went wrong with that request. Please try again.