File: explain.t

package info (click to toggle)
libdbix-class-helpers-perl 2.023007-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 792 kB
  • ctags: 294
  • sloc: perl: 3,872; sql: 161; makefile: 7
file content (33 lines) | stat: -rw-r--r-- 645 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!perl

use Test::Roo;
use Test::Fatal;
use Data::Dumper::Concise;

use lib 't/lib';

with 'A::Role::TestConnect';

sub rs { shift->schema->resultset('Gnarly') }

top_test basic => sub {
   my $self = shift;
   my $rs = $self->rs;
   SKIP: {
      skip 'cannot test without a connection', 1 unless $self->connected;

      my $s;
      my $e = exception { $s = $rs->explain };
      ok(!$e, 'valid SQL') or diag $e;
      note(Dumper($s)) if $s;
   }
};

run_me(SQLite => {
   engine => 'SQLite',
   connect_info => [ 'dbi:SQLite::memory:'],
});
run_me(Pg     => { engine => 'Pg'     });
run_me(mysql  => { engine => 'mysql'  });

done_testing;