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 |
|
|
26 |
ok( my $strix = Strix->new({ instance => $instance }), '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" ); |
56 |
|
|
57 |
ok( my @sites = $strix->sites, "sites" ); |
ok( my @sites = $strix->sites, "sites" ); |
58 |
diag dump( @sites ) if $debug; |
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' ); |