DBIx-Class-Helper-SimpleStats

 view release on metacpan or  search on metacpan

t/01-simple.t  view on Meta::CPAN

use Test::Roo;

use Test::Most;

use Class::Load qw/ load_class /;
use Ref::Util qw/ is_plain_arrayref /;
use SQL::Abstract::Test import => [qw/ is_same_sql_bind /];
use SQL::Translator 0.11018;

use lib 't/lib';

has dsn => (
    is      => 'lazy',
    default => 'dbi:SQLite::memory:',
);

has schema_class => (
    is      => 'ro',
    default => 'Test::Schema',
);

has schema => (
    is      => 'lazy',
    builder => sub {
        my ($self) = @_;
        my $class = $self->schema_class;
        load_class($class);
        return $class->deploy_or_connect( $self->dsn );
    },
);

has base_rs => (
    is      => 'lazy',
    builder => sub {
        shift->schema->resultset('Artist'),;
    },
);

has args => (
    is       => 'ro',
    required => 1,
);

has rs => (
    is      => 'lazy',
    builder => sub {
        my ($self) = @_;
        my $args = $self->args;
        return is_plain_arrayref($args)
          ? $self->base_rs->simple_stats(@$args)
          : $self->base_rs->simple_stats($args);
    },
    handles => [qw/ current_source_alias /],
);

has sql => (
    is       => 'ro',
    required => 1,
);

has as => (
    is       => 'ro',
    required => 1,
);

has bind => (



( run in 0.658 second using v1.01-cache-2.11-cpan-39bf76dae61 )