/[A3C]/t/50-strix.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /t/50-strix.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 216 - (show annotations)
Fri Jun 20 21:49:16 2008 UTC (15 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1690 byte(s)
put cache all over the place and simplify it
1 #!/usr/bin/env perl
2 use warnings;
3 use strict;
4
5 =head1 DESCRIPTION
6
7 test Strix integration
8
9 =cut
10
11 use Jifty::Test tests => 21;
12
13 use Data::Dump qw/dump/;
14
15 use_ok('Strix');
16
17 $Strix::debug = 1 if @ARGV;
18 my $debug = $Strix::debug;
19
20 my $instance = 'os-test0604-zg';
21 $instance = 'new';
22
23 ok( my $dbh = Strix->dbh( $instance ), 'dbh' );
24 isa_ok( $dbh, 'DBI::db' );
25
26 ok( my $strix = Strix->new({ instance => $instance }), 'new' );
27 isa_ok( $strix, 'Strix' );
28
29 # cache
30 ok( my $path = $strix->cache_path( 'test', 42, 'bar' ), 'cache_path' );
31 like( $path, qr/test-42-bar/, 'correct' );
32
33 my $data = 'scalar';
34 SKIP: {
35 skip( 'scalars not supported', 2 );
36 ok( $strix->write_cache( $data, 'test-scalar' ), 'write_cache scalar' );
37 is_deeply( $strix->read_cache( 'test-scalar' ), $data, 'read_cache scalar' );
38 }
39 $data = { foo => 42, bar => 'baz' };
40 ok( $strix->write_cache( $data, 'test-hash' ), 'write_cache hash' );
41 is_deeply( $strix->read_cache( 'test-hash' ), $data, 'read_cache hash' );
42 $data = [ 1, 2, 42 ];
43 ok( $strix->write_cache( $data, 'test-array' ), 'write_cache array' );
44 is_deeply( $strix->read_cache( 'test-array' ), $data, 'read_cache array' );
45
46 my $url = '/';
47
48 ok( my $category = $strix->category( $url ), "category $url" );
49 diag dump( $category ) if $debug;
50
51
52 ok( my $layout = $strix->layout( $url ), "layout $url" );
53 diag dump( $layout ) if $debug;
54 ok( $layout->{pre}, 'pre' );
55 ok( $layout->{free}, 'free' );
56
57 ok( my @sites = $strix->sites, "sites" );
58 diag dump( @sites ) if $debug;
59
60 ok( my $nav = $strix->site_navigation( 1, 1 ), "site_navigation" );
61 diag dump( $nav ) if $debug;
62
63 ok( my $nav2 = $strix->site_navigation( 1, 1 ), "site_navigation (again)" );
64 is_deeply( $nav, $nav2, 'same' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26