File: 01-constructor.t

package info (click to toggle)
libpgobject-simple-perl 3.000002-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 128 kB
  • sloc: perl: 166; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 597 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
use PGObject::Simple;
use Test::More tests => 5;
use DBI;

my %hash = (
   foo => 'foo',
   bar => 'baz',
   baz => '2',
   id  => '33',
);

my $dbh = 'test_dbh_fake_value';

my $obj = PGObject::Simple->new(%hash);

ok($obj->isa('PGObject::Simple'), 'Object successfully created');

is($obj->set_dbh($dbh), $dbh, 'Set database handle successfully');
is($dbh, $obj->dbh, "database handle cross check");

my $obj2 = PGObject::Simple->new(%hash);
is($obj2->dbh, undef, 'No db handle for second object');
$obj2->associate($obj);
is($dbh, $obj2->dbh, "database handle cross check after association");