|
From: Chris W. <la...@us...> - 2001-11-04 17:54:29
|
Update of /cvsroot/openinteract/SPOPS/t
In directory usw-pr-cvs1:/tmp/cvs-serv5645
Modified Files:
30_dbi.t
Log Message:
make the SPOPS class a variable instead of hardcoded, other small changes
Index: 30_dbi.t
===================================================================
RCS file: /cvsroot/openinteract/SPOPS/t/30_dbi.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** 30_dbi.t 2001/11/04 17:42:50 1.3
--- 30_dbi.t 2001/11/04 17:54:26 1.4
***************
*** 13,16 ****
--- 13,18 ----
use constant TEST_TABLE_NAME => 'spops_test';
+ my $SPOPS_CLASS = 'DBITest';
+
{
***************
*** 26,30 ****
my $driver_name = $config->{DBI_driver};
! my $spops_dbi_driver = check_dbd_compliance( $config, $driver_name );
# Ensure we can get to SPOPS::Initialize
--- 28,32 ----
my $driver_name = $config->{DBI_driver};
! my $spops_dbi_driver = check_dbd_compliance( $config, $driver_name, $SPOPS_CLASS );
# Ensure we can get to SPOPS::Initialize
***************
*** 37,41 ****
my $spops_config = {
tester => {
! class => 'DBITest',
isa => [ $spops_dbi_driver, 'SPOPS::DBI' ],
field => [ qw/ spops_id spops_name spops_goop spops_num / ],
--- 39,43 ----
my $spops_config = {
tester => {
! class => $SPOPS_CLASS,
isa => [ $spops_dbi_driver, 'SPOPS::DBI' ],
field => [ qw/ spops_id spops_name spops_goop spops_num / ],
***************
*** 49,53 ****
my $class_init_list = eval { SPOPS::Initialize->process({ config => $spops_config }) };
ok( ! $@, 'Initialize process run' );
! ok( $class_init_list->[0] eq 'DBITest', 'Initialize class' );
--- 51,55 ----
my $class_init_list = eval { SPOPS::Initialize->process({ config => $spops_config }) };
ok( ! $@, 'Initialize process run' );
! ok( $class_init_list->[0] eq $SPOPS_CLASS, 'Initialize class' );
***************
*** 59,66 ****
# Create an object
{
! my $obj = eval { DBITest->new({ spops_name => 'MyProject',
! spops_goop => 'oopie doop',
! spops_num => 241,
! spops_id => 42 } ) };
ok( ! $@, 'Create object' );
--- 61,68 ----
# Create an object
{
! my $obj = eval { $SPOPS_CLASS->new({ spops_name => 'MyProject',
! spops_goop => 'oopie doop',
! spops_num => 241,
! spops_id => 42 } ) };
ok( ! $@, 'Create object' );
***************
*** 76,80 ****
# Fetch an object, then update it
{
! my $obj = eval { DBITest->fetch( 42, { db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch object (perform)' );
if ( $@ ) {
--- 78,82 ----
# Fetch an object, then update it
{
! my $obj = eval { $SPOPS_CLASS->fetch( 42, { db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch object (perform)' );
if ( $@ ) {
***************
*** 92,96 ****
}
! my $new_obj = eval { DBITest->fetch( 42, { db => $db, skip_cache => 1 } ) };
ok( $new_obj->{spops_name} eq $obj->{spops_name}, 'Fetch object (after update)' );
}
--- 94,98 ----
}
! my $new_obj = eval { $SPOPS_CLASS->fetch( 42, { db => $db, skip_cache => 1 } ) };
ok( $new_obj->{spops_name} eq $obj->{spops_name}, 'Fetch object (after update)' );
}
***************
*** 98,102 ****
# Fetch an object then clone it and save it
{
! my $obj = eval { DBITest->fetch( 42, { db => $db, skip_cache => 1 } ) };
my $new_obj = eval { $obj->clone({ spops_name => 'YourProject',
spops_goop => 'this n that',
--- 100,104 ----
# Fetch an object then clone it and save it
{
! my $obj = eval { $SPOPS_CLASS->fetch( 42, { db => $db, skip_cache => 1 } ) };
my $new_obj = eval { $obj->clone({ spops_name => 'YourProject',
spops_goop => 'this n that',
***************
*** 115,119 ****
# field and see if the default comes through
{
! my $obj = DBITest->new({ spops_id => 1588,
spops_goop => 'here we go!',
spops_name => 'AnotherProject' });
--- 117,121 ----
# field and see if the default comes through
{
! my $obj = $SPOPS_CLASS->new({ spops_id => 1588,
spops_goop => 'here we go!',
spops_name => 'AnotherProject' });
***************
*** 124,128 ****
# Fetch the three objects in the db and be sure we got them all
{
! my $obj_list = eval { DBITest->fetch_group({ db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch group' );
if ( $@ ) {
--- 126,130 ----
# Fetch the three objects in the db and be sure we got them all
{
! my $obj_list = eval { $SPOPS_CLASS->fetch_group({ db => $db, skip_cache => 1 } ) };
ok( ! $@, 'Fetch group' );
if ( $@ ) {
***************
*** 135,139 ****
# Fetch a count of the objects in the database
{
! my $obj_count = eval { DBITest->fetch_count({ db => $db }) };
ok( $obj_count == 3, 'Fetch count' );
}
--- 137,141 ----
# Fetch a count of the objects in the database
{
! my $obj_count = eval { $SPOPS_CLASS->fetch_count({ db => $db }) };
ok( $obj_count == 3, 'Fetch count' );
}
***************
*** 141,145 ****
# Create an iterator and run through the objects
{
! my $iter = eval { DBITest->fetch_iterator({ db => $db, skip_cache => 1 }) };
ok( $iter->isa( 'SPOPS::Iterator' ), 'Iterator returned' );
my $count = 0;
--- 143,147 ----
# Create an iterator and run through the objects
{
! my $iter = eval { $SPOPS_CLASS->fetch_iterator({ db => $db, skip_cache => 1 }) };
ok( $iter->isa( 'SPOPS::Iterator' ), 'Iterator returned' );
my $count = 0;
|