Mojo-Pg-Che
view release on metacpan or search on metacpan
t/02-connection.t view on Meta::CPAN
use Mojo::Pg::Che;
use Scalar::Util 'refaddr';
my $class = 'Mojo::Pg::Che';
my $db_class = 'Mojo::Pg::Che::Database';
#~ my $mojo_db_class = 'Mojo::Pg::Database';
my $dbi_db_class = 'DBI::db';
plan skip_all => 'set env TEST_PG="dbname=<...>/<pg_user>/<passwd>" to enable this test' unless $ENV{TEST_PG};
my ($dsn, $user, $pw) = split m|[/]|, $ENV{TEST_PG};
# 1
my $pg1 = $class->connect($dsn, $user, $pw, {PrintWarn => 0,},);
my $options = {
AutoCommit => 1,
AutoInactiveDestroy => 1,
PrintError => 0,
PrintWarn => 0,
RaiseError => 1,
ShowErrorStatement => 1,
t/03-query.t view on Meta::CPAN
use Mojo::Base -strict;
use Test::More;
plan skip_all => 'set env TEST_PG="dbname=<...>/<pg_user>/<passwd>" to enable this test' unless $ENV{TEST_PG};
my ($dsn, $user, $pw) = split m|[/]|, $ENV{TEST_PG};
use Mojo::Pg::Che;
use Scalar::Util 'refaddr';
my $class = 'Mojo::Pg::Che';
my $results_class = 'Mojo::Pg::Che::Results';
# 1
my $pg = $class->connect($dsn, $user, $pw, max_connections=>20, debug=>0,);
t/04-select.t view on Meta::CPAN
use Mojo::Base -strict;
use Test::More;
use Mojo::Util qw(dumper);
plan skip_all => 'set env TEST_PG="dbname=<...>/<pg_user>/<passwd>" to enable this test' unless $ENV{TEST_PG};
my ($dsn, $user, $pw) = split m|[/]|, $ENV{TEST_PG};
use Mojo::Pg::Che;
my $class = 'Mojo::Pg::Che';
# 1
my $pg = $class->connect($dsn, $user, $pw, max_connections=>20);#{pg_enable_utf8 => 1,}
$pg->on(connection=>sub {$_[1]->do('set datestyle to "DMY, ISO";');});
t/05-transaction.t view on Meta::CPAN
use Mojo::Base -strict;
use Test::More;
use Mojo::Pg::Che;
plan skip_all => 'set env TEST_PG="DBI:Pg:dbname=<...>/<pg_user>/<passwd>" to enable this test' unless $ENV{TEST_PG};
my ($dsn, $user, $pw) = split m|[/]|, $ENV{TEST_PG};
my $pg = Mojo::Pg::Che->connect($dsn, $user, $pw,);
my $seq_name = 'Mojo_Pg_Che_test_seq_remove_it';
my $r = $pg->do("drop sequence IF EXISTS $seq_name;");
is $r, '0E0', 'do create';
my $seq_tx = sub {
my ($commit) = @_;
t/06-base-pubsub.t view on Meta::CPAN
use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
#~ plan skip_all => 'set TEST_ONLINE to enable this test' unless $ENV{TEST_ONLINE};
plan skip_all => 'set env TEST_PG="dbname=<...>/<pg_user>/<passwd>" to enable this test' unless $ENV{TEST_PG};
my ($dsn, $user, $pw) = split m|[/]|, $ENV{TEST_PG};
use Mojo::IOLoop;
use Mojo::JSON 'true';
use Mojo::Pg::Che;
# Notifications with event loop
#~ my $pg = Mojo::Pg->new($ENV{TEST_ONLINE});
my $pg = Mojo::Pg::Che->connect($dsn, $user, $pw)->pg;
my ($db, @all, @test);
$pg->pubsub->on(reconnect => sub { $db = pop });
t/07-base-crud.t view on Meta::CPAN
use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
#~ plan skip_all => 'set TEST_ONLINE to enable this test' unless $ENV{TEST_ONLINE};
plan skip_all => 'set env TEST_PG="dbname=<...>/<pg_user>/<passwd>" to enable this test' unless $ENV{TEST_PG};
my ($dsn, $user, $pw) = split m|[/]|, $ENV{TEST_PG};
use Mojo::IOLoop;
use Mojo::Pg::Che;
# Isolate tests
#~ my $pg = Mojo::Pg::Che->new($ENV{TEST_ONLINE})->search_path(['mojo_crud_test']);
my $pg = Mojo::Pg::Che->connect($dsn, $user, $pw, {PrintWarn => 0,}, search_path=>['mojo_crud_test'])
->pg;#max_connections=>20
#~ is_deeply $pg->options, {}, 'right options';
$pg->db->query('drop schema if exists mojo_crud_test cascade');
t/09-base-database.t view on Meta::CPAN
use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
#~ plan skip_all => 'set TEST_ONLINE to enable this test' unless $ENV{TEST_ONLINE};
plan skip_all => 'set env TEST_PG="dbname=<...>/<pg_user>/<passwd>" to enable this test' unless $ENV{TEST_PG};
my ($dsn, $user, $pw) = split m|[/]|, $ENV{TEST_PG};
use Mojo::IOLoop;
use Mojo::JSON 'true';
use Mojo::Pg::Che;
use Scalar::Util 'refaddr';
# Connected
#~ my $pg = Mojo::Pg::Che->new($ENV{TEST_ONLINE});
my $pg = Mojo::Pg::Che->connect($dsn, $user, $pw)
( run in 2.783 seconds using v1.01-cache-2.11-cpan-71847e10f99 )