Test::DatabaseRow without SQL
Of course, writing SQL is not fun, especially if you don't know SQL. You might prefer to write the logic in Perl and not care about the SQL stuff.
examples/db/dbrow_without_sql.t
#!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use Test::DatabaseRow; use DBI; system "$^X examples/dbi/create_sample.pl"; END { unlink 'sample.db' } my ($email, $pw) = ('foo@bar.com', 'secret'); my $dbh = DBI->connect("dbi:SQLite:dbname=sample.db"); local $Test::DatabaseRow::dbh = $dbh; row_ok( table => 'people', where => { '=' => { email => $email, pw => $pw, } }, tests => { 'eq' => { fname => 'Foo', lname => 'Bar', }, }, label => 'Foo Bar', ); $dbh->disconnect;
Results:
1..1 ok 1 - Foo Bar