File: Explain.t

package info (click to toggle)
libdbix-class-helpers-perl 2.036000-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,008 kB
  • sloc: perl: 5,041; sql: 537; makefile: 7
file content (36 lines) | stat: -rw-r--r-- 747 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
34
35
36
#!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') }

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

      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'  });

ok $ran, 'tests were run against default SQLite';
done_testing;