/[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

Diff of /t/50-strix.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 169 by dpavlin, Mon Jun 16 12:44:57 2008 UTC revision 213 by dpavlin, Fri Jun 20 20:44:18 2008 UTC
# Line 8  test Strix integration Line 8  test Strix integration
8    
9  =cut  =cut
10    
11  use Jifty::Test tests => 10;  use Jifty::Test tests => 21;
12    
13  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
14    
# Line 17  use_ok('Strix'); Line 17  use_ok('Strix');
17  $Strix::debug = 1 if @ARGV;  $Strix::debug = 1 if @ARGV;
18  my $debug = $Strix::debug;  my $debug = $Strix::debug;
19    
20  my $site = 'os-test0604-zg';  my $instance = 'os-test0604-zg';
21  $site = 'new';  $instance = 'new';
22    
23  ok( my $dbh = Strix->dbh( $site ), 'dbh' );  ok( my $dbh = Strix->dbh( $instance ), 'dbh' );
24  isa_ok( $dbh, 'DBI::db' );  isa_ok( $dbh, 'DBI::db' );
25    
26  ok( my $strix = Strix->new({ site => $site }), 'new' );  ok( my $strix = Strix->new({ instance => $instance }), 'new' );
27  isa_ok( $strix, 'Strix' );  isa_ok( $strix, 'Strix' );
28    
29    # cache
30    ok( my $path = $strix->cache_path( 'test-%d-%s', 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 = '/';  my $url = '/';
47    
48  ok( my $category = $strix->category( $url ), "category $url" );  ok( my $category = $strix->category( $url ), "category $url" );
# Line 37  diag dump( $layout ) if $debug; Line 54  diag dump( $layout ) if $debug;
54  ok( $layout->{pre}, 'pre' );  ok( $layout->{pre}, 'pre' );
55  ok( $layout->{free}, 'free' );  ok( $layout->{free}, 'free' );
56    
57  my $site_id = 1;  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 $sitemap = $strix->sitemap( $site_id ), "sitemap $site_id" );  ok( my $nav2 = $strix->site_navigation( 1, 1 ), "site_navigation (again)" );
64  diag dump( $sitemap ) if $debug;  is_deeply( $nav, $nav2, 'same' );

Legend:
Removed from v.169  
changed lines
  Added in v.213

  ViewVC Help
Powered by ViewVC 1.1.26