ACME-QuoteDB

 view release on metacpan or  search on metacpan

t/02-get_quotes.t  view on Meta::CPAN



eval { # param mispelled
    $sq->get_quotes({Charcter => 'bart'});
};
if ($@) {
    pass if $@ =~ m/unsupported argument option passed/;
} else {fail 'should alert user on non existant params' };


#sqlite> select COUNT(*) from quote where attribution_id IN (29,5);
#61 # get all family name wiggum quotes (ralph and clancy)
is scalar @{$sq->get_quotes({AttrName => 'wiggum', Rating => '2-10'})}, 15;

# get 6 random quotes
is scalar @{$sq->get_quotes({Limit => 6})}, 6;

is scalar @{$sq->get_quotes({
                           Limit  => 2,
                           Rating => '9-10'
                           })}, 2; # get 2 very funny random quotes

t/03-load_quotes_env.t  view on Meta::CPAN

           'Ralph Wiggum',
          );
  
  is( $sq->list_attr_names, join "\n", sort @expected_attribution_list);

  $load_db = undef;
}
ok ! -z $ENV{ACME_QUOTEDB_PATH};

my $dbh = DBI->connect('dbi:SQLite:dbname='.$ENV{ACME_QUOTEDB_PATH},'','');
my $count = $dbh->selectrow_hashref('SELECT COUNT(*) AS COUNT FROM quote');
is $count->{COUNT}, 29 ;




t/05-load_quotes_remote.t  view on Meta::CPAN

           'Ralph Wiggum',
          );
  
  is( $sq->list_attr_names, join "\n", sort @expected_attribution_list);

  $load_db = undef;
}

my $dbh = DBI->connect("DBI:mysql:database=$database;host=$host",$user,$pass)
          || croak "can not connect to: $database $!";
my $count = $dbh->selectrow_hashref('SELECT COUNT(*) AS COUNT FROM quote');
is $count->{COUNT}, 29 ;

my $qc = $dbh->selectrow_hashref('SELECT COUNT(*) AS COUNT FROM quote_catg');
is $qc->{COUNT}, 29 ;






( run in 1.123 second using v1.01-cache-2.11-cpan-49f99fa48dc )