X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi%2F19-set_sql.t;h=a9818108755d8d42e1b0660a9a9777ae41264480;hb=83eef5621cc3a7b77a280b4b01f1175e9935fff6;hp=ebd571d87eae297def9f37f21011b3a734a9df0c;hpb=6a3bf2519832866d037740c5fb22341dad6f8bb3;p=dbsrgits%2FDBIx-Class.git diff --git a/t/cdbi/19-set_sql.t b/t/cdbi/19-set_sql.t index ebd571d..a981810 100644 --- a/t/cdbi/19-set_sql.t +++ b/t/cdbi/19-set_sql.t @@ -1,15 +1,9 @@ +use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat'; + use strict; -use Test::More; +use warnings; -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 => 20); -} +use Test::More; use lib 't/cdbi/testlib'; use Film; @@ -19,7 +13,7 @@ use Actor; my @cols = Film->columns('Essential'); is_deeply \@cols, ['title'], "1 Column in essential"; is +Film->transform_sql('__ESSENTIAL__'), 'title', '__ESSENTIAL__ expansion'; - + # This provides a more interesting test Film->columns(Essential => qw(title rating)); is +Film->transform_sql('__ESSENTIAL__'), 'title, rating', @@ -37,7 +31,7 @@ Film->set_sql( SELECT __ESSENTIAL__ FROM __TABLE__ WHERE __TABLE__.rating = 'PG' - ORDER BY title DESC + ORDER BY title DESC } ); @@ -61,7 +55,7 @@ Film->set_sql( SELECT __ESSENTIAL__ FROM __TABLE__ WHERE rating = ? - ORDER BY title DESC + ORDER BY title DESC } ); @@ -80,7 +74,7 @@ Film->set_sql( WHERE __IDENTIFIER__ } ); - + my $film = Film->retrieve_all->first; my @found = Film->search_by_id($film->id); is @found, 1; @@ -93,11 +87,11 @@ Film->set_sql( Film->set_sql( namerate => qq{ SELECT __ESSENTIAL(f)__ - FROM __TABLE(=f)__, __TABLE(Actor=a)__ - WHERE __JOIN(a f)__ + FROM __TABLE(=f)__, __TABLE(Actor=a)__ + WHERE __JOIN(a f)__ AND a.name LIKE ? AND f.rating = ? - ORDER BY title + ORDER BY title } ); @@ -116,11 +110,11 @@ Film->set_sql( Film->set_sql( ratename => qq{ SELECT __ESSENTIAL(f)__ - FROM __TABLE(=f)__, __TABLE(Actor=a)__ - WHERE __JOIN(f a)__ + FROM __TABLE(=f)__, __TABLE(Actor=a)__ + WHERE __JOIN(f a)__ AND f.rating = ? AND a.name LIKE ? - ORDER BY title + ORDER BY title } ); @@ -130,3 +124,4 @@ Film->set_sql( is $apg[1]->title, "B", "and B"; } +done_testing;