X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi%2F04-lazy.t;h=6c9a8d3b7f9cd250a25a302fed194c4321574100;hb=386c61f65520dc5c1b6f3d4710e865eeff9f26a8;hp=4c6e178bca98a4b817f7a635aa2da7d5b22d4d25;hpb=2c656b2be0267e454be5076c518213985e50c422;p=dbsrgits%2FDBIx-Class.git diff --git a/t/cdbi/04-lazy.t b/t/cdbi/04-lazy.t index 4c6e178..6c9a8d3 100644 --- a/t/cdbi/04-lazy.t +++ b/t/cdbi/04-lazy.t @@ -1,6 +1,5 @@ -#!/usr/bin/perl -w - use strict; +use warnings; use Test::More; use Test::Warn; @@ -10,17 +9,15 @@ use Test::Warn; BEGIN { eval "use DBIx::Class::CDBICompat;"; - if ($@) { - plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); - next; - } - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 36); + plan $@ + ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required') + : (tests => 36) + ; } INIT { - use lib 't/cdbi/testlib'; - use Lazy; + use lib 't/cdbi/testlib'; + use Lazy; } is_deeply [ Lazy->columns('Primary') ], [qw/this/], "Pri"; @@ -31,13 +28,13 @@ is_deeply [ sort Lazy->columns('vertical') ], [qw/oop opop/], "vertical"; is_deeply [ sort Lazy->columns('All') ], [qw/eep oop opop orp that this/], "All"; { - my @groups = Lazy->__grouper->groups_for(Lazy->find_column('this')); - is_deeply [ sort @groups ], [sort qw/things Essential Primary/], "this (@groups)"; + my @groups = Lazy->__grouper->groups_for(Lazy->find_column('this')); + is_deeply [ sort @groups ], [sort qw/things Essential Primary/], "this (@groups)"; } { - my @groups = Lazy->__grouper->groups_for(Lazy->find_column('that')); - is_deeply \@groups, [qw/things/], "that (@groups)"; + my @groups = Lazy->__grouper->groups_for(Lazy->find_column('that')); + is_deeply \@groups, [qw/things/], "that (@groups)"; } Lazy->create({ this => 1, that => 2, oop => 3, opop => 4, eep => 5 }); @@ -56,28 +53,28 @@ ok(!$obj->_attribute_exists('oop'), 'But still not oop'); ok(!$obj->_attribute_exists('that'), 'nor that'); { - Lazy->columns(All => qw/this that eep orp oop opop/); - ok(my $obj = Lazy->retrieve(1), 'Retrieve by Primary'); - ok !$obj->_attribute_exists('oop'), " Don't have oop"; - my $null = $obj->eep; - ok !$obj->_attribute_exists('oop'), - " Don't have oop - even after getting eep"; + Lazy->columns(All => qw/this that eep orp oop opop/); + ok(my $obj = Lazy->retrieve(1), 'Retrieve by Primary'); + ok !$obj->_attribute_exists('oop'), " Don't have oop"; + my $null = $obj->eep; + ok !$obj->_attribute_exists('oop'), + " Don't have oop - even after getting eep"; } # Test contructor breaking. eval { # Need a hashref - Lazy->create(this => 10, that => 20, oop => 30, opop => 40, eep => 50); + Lazy->create(this => 10, that => 20, oop => 30, opop => 40, eep => 50); }; ok($@, $@); eval { # False column - Lazy->create({ this => 10, that => 20, theother => 30 }); + Lazy->create({ this => 10, that => 20, theother => 30 }); }; ok($@, $@); eval { # Multiple false columns - Lazy->create({ this => 10, that => 20, theother => 30, andanother => 40 }); + Lazy->create({ this => 10, that => 20, theother => 30, andanother => 40 }); }; ok($@, $@); @@ -120,7 +117,7 @@ warning_like { # Now again for inflated values SKIP: { - skip "Requires Date::Simple", 5 unless eval "use Date::Simple; 1; "; + skip "Requires Date::Simple 3.03", 5 unless eval "use Date::Simple 3.03; 1; "; Lazy->has_a( orp => 'Date::Simple', inflate => sub { Date::Simple->new($_[0] . '-01-01') },