[Catalyst-commits] r13679 - in trunk/Catalyst-Plugin-PageCache: . t t/lib

timbunce at dev.catalyst.perl.org timbunce at dev.catalyst.perl.org
Mon Nov 1 20:53:47 GMT 2010


Author: timbunce
Date: 2010-11-01 20:53:47 +0000 (Mon, 01 Nov 2010)
New Revision: 13679

Modified:
   trunk/Catalyst-Plugin-PageCache/Changes
   trunk/Catalyst-Plugin-PageCache/Makefile.PL
   trunk/Catalyst-Plugin-PageCache/t/04cache.t
   trunk/Catalyst-Plugin-PageCache/t/05expires.t
   trunk/Catalyst-Plugin-PageCache/t/06auto_cache.t
   trunk/Catalyst-Plugin-PageCache/t/07set_http_headers.t
   trunk/Catalyst-Plugin-PageCache/t/08params.t
   trunk/Catalyst-Plugin-PageCache/t/09datetime.t
   trunk/Catalyst-Plugin-PageCache/t/10options.t
   trunk/Catalyst-Plugin-PageCache/t/11nocache.t
   trunk/Catalyst-Plugin-PageCache/t/12i18n.t
   trunk/Catalyst-Plugin-PageCache/t/13cachehook.t
   trunk/Catalyst-Plugin-PageCache/t/14keymaker.t
   trunk/Catalyst-Plugin-PageCache/t/15busy_lock.t
   trunk/Catalyst-Plugin-PageCache/t/lib/TestApp.pm
   trunk/Catalyst-Plugin-PageCache/t/lib/TestAppI18N.pm
Log:
Use Cache::FileCache for tests (fixes t/15busy_lock.t)
Do cache directory pre-clear in app module instead of each test file.


Modified: trunk/Catalyst-Plugin-PageCache/Changes
===================================================================
--- trunk/Catalyst-Plugin-PageCache/Changes	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/Changes	2010-11-01 20:53:47 UTC (rev 13679)
@@ -1,9 +1,8 @@
 Revision history for Perl extension Catalyst::Plugin::PageCache
 
 0.23    XXX
-        - XXX Test 15busy_lock.t fails as the moment.
-        - Updated tests to use Catalyst::Plugin::Cache::Store::Memory instead
-          of the deprecated ::FileCache (Report and patch from Rod Taylor) RT#53304.
+        - Updated tests to use Cache::FileCache instead of the deprecated ::FileCache.
+          Report and patch by Rod Taylor, RT#53304 & RT#47373.
         - Fixed t/04critic.t to not fail if Test::Perl::Critic is not installed.
         - Updated test app code to avoid deprecated constructs.
         - Only serve GET and HEAD requests (instead of all except POST). RT#53307.

Modified: trunk/Catalyst-Plugin-PageCache/Makefile.PL
===================================================================
--- trunk/Catalyst-Plugin-PageCache/Makefile.PL	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/Makefile.PL	2010-11-01 20:53:47 UTC (rev 13679)
@@ -7,6 +7,7 @@
 requires 'Test::More';
 requires 'MRO::Compat' => '0.10';
 requires 'Digest::SHA1' => '0';
+test_requires 'Cache::FileCache' => 0;
 
 auto_install;
 resources repository => 'http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Plugin-PageCache/';

Modified: trunk/Catalyst-Plugin-PageCache/t/04cache.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/04cache.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/04cache.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -15,9 +15,6 @@
         : ( tests => 20 );
 }
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 # cache a page

Modified: trunk/Catalyst-Plugin-PageCache/t/05expires.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/05expires.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/05expires.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -15,9 +15,6 @@
         : ( tests => 6 );
 }
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 # add config option

Modified: trunk/Catalyst-Plugin-PageCache/t/06auto_cache.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/06auto_cache.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/06auto_cache.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -15,9 +15,6 @@
         : ( tests => 8 );
 }
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 # add config option

Modified: trunk/Catalyst-Plugin-PageCache/t/07set_http_headers.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/07set_http_headers.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/07set_http_headers.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -15,9 +15,6 @@
         : ( tests => 11 );
 }
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 # add config options

Modified: trunk/Catalyst-Plugin-PageCache/t/08params.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/08params.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/08params.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -15,9 +15,6 @@
         : ( tests => 8 );
 }
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 # This test file tests that the cache handles URI parameters properly

Modified: trunk/Catalyst-Plugin-PageCache/t/09datetime.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/09datetime.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/09datetime.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -24,9 +24,6 @@
 
 # This tests that a DateTime object can be passed in.
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 # add config option

Modified: trunk/Catalyst-Plugin-PageCache/t/10options.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/10options.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/10options.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -17,9 +17,6 @@
 
 # This test that options can be passed to cache.
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 # add config option

Modified: trunk/Catalyst-Plugin-PageCache/t/11nocache.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/11nocache.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/11nocache.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -17,9 +17,6 @@
 
 # This test that options can be passed to cache.
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 # add config option

Modified: trunk/Catalyst-Plugin-PageCache/t/12i18n.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/12i18n.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/12i18n.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -22,9 +22,6 @@
         : ( tests => 25 );
 }
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestAppI18N';
 
 run_tests();

Modified: trunk/Catalyst-Plugin-PageCache/t/13cachehook.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/13cachehook.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/13cachehook.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -18,9 +18,6 @@
 
 # This test that options can be passed to cache.
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 # add config option

Modified: trunk/Catalyst-Plugin-PageCache/t/14keymaker.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/14keymaker.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/14keymaker.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -16,9 +16,6 @@
 
 # This test that options can be passed to cache.
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 

Modified: trunk/Catalyst-Plugin-PageCache/t/15busy_lock.t
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/15busy_lock.t	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/15busy_lock.t	2010-11-01 20:53:47 UTC (rev 13679)
@@ -20,9 +20,6 @@
     ? ( skip_all => 'Cannot run this test on Windows' )
     : ( tests => 4 );
 
-# remove previous cache
-rmtree 't/var' if -d 't/var';
-
 use Catalyst::Test 'TestApp';
 
 TestApp->config->{'Plugin::PageCache'}->{busy_lock} = 5;

Modified: trunk/Catalyst-Plugin-PageCache/t/lib/TestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/lib/TestApp.pm	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/lib/TestApp.pm	2010-11-01 20:53:47 UTC (rev 13679)
@@ -2,19 +2,25 @@
 
 use strict;
 use Catalyst;
-use Data::Dumper;
+use File::Path qw(make_path remove_tree);
 
 our $VERSION = '0.01';
 
+my $cache_root = 't/var';
+remove_tree($cache_root);
+make_path($cache_root);
+
 TestApp->config(
     name => 'TestApp',
     counter => 0,
     'Plugin::Cache' => {
+        backend => {
+            class => 'Cache::FileCache',
+            cache_root => $cache_root,
+        },
     },
 );
 
-TestApp->setup( qw/Cache Cache::Store::Memory PageCache/ );
+TestApp->setup( qw/Cache PageCache/ );
 
-#sub default : Private { my ( $self, $c ) = @_; }
-
 1;

Modified: trunk/Catalyst-Plugin-PageCache/t/lib/TestAppI18N.pm
===================================================================
--- trunk/Catalyst-Plugin-PageCache/t/lib/TestAppI18N.pm	2010-11-01 20:19:12 UTC (rev 13678)
+++ trunk/Catalyst-Plugin-PageCache/t/lib/TestAppI18N.pm	2010-11-01 20:53:47 UTC (rev 13679)
@@ -2,23 +2,25 @@
 
 use strict;
 use Catalyst;
-use Data::Dumper;
+use File::Path qw(make_path remove_tree);
 
 our $VERSION = '0.01';
 
+my $cache_root = 't/var';
+remove_tree($cache_root);
+make_path($cache_root);
+
 TestAppI18N->config(
     name => 'TestApp-I18N',
-    cache => {
-        storage => 't/var',
+    counter => 0,
+    'Plugin::Cache' => {
+        backend => { 
+            class => 'Cache::FileCache',
+            cache_root => $cache_root,
+        },
     },
-    counter => 0,
 );
 
-TestAppI18N->setup( qw/Cache::FileCache I18N PageCache/ );
+TestAppI18N->setup( qw/Cache I18N PageCache/ );
 
-sub default : Private {
-    my ( $self, $c ) = @_;
-    
-}
-
 1;




More information about the Catalyst-commits mailing list