Skip to content

Commit

Permalink
Merge 'reorganize_tests' into 'DBIx-Class-current'
Browse files Browse the repository at this point in the history
r1656@moss (orig r1655):  bluefeet | 2006-05-17 22:15:24 -0700
Delete basicrels tests. Modify run tests to use new syntax.  Remove helperrels test wrappers.
  • Loading branch information
Aran Deltac committed May 25, 2006
2 parents c63e445 + 7035051 commit 9eba6e0
Show file tree
Hide file tree
Showing 34 changed files with 333 additions and 416 deletions.
4 changes: 3 additions & 1 deletion t/helperrels/26sqlt.t
@@ -1,7 +1,9 @@
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;
use DBICTest::HelperRels;

eval "use SQL::Translator";
plan skip_all => 'SQL::Translator required' if $@;
Expand Down
2 changes: 0 additions & 2 deletions t/lib/DBICTest.pm
Expand Up @@ -7,7 +7,6 @@ use DBICTest::Schema;
use DBICTest::Schema::Relationships;

sub init_schema {

my $db_file = "t/var/DBIxClass.db";

unlink($db_file) if -e $db_file;
Expand All @@ -22,7 +21,6 @@ sub init_schema {
$schema->deploy();
$schema->auto_populate();
return $schema;

}

1;
155 changes: 0 additions & 155 deletions t/lib/DBICTest/Setup.pm

This file was deleted.

17 changes: 10 additions & 7 deletions t/run/01core.tl
@@ -1,7 +1,13 @@
sub run_tests {
my $schema = shift;
use strict;
use warnings;

plan tests => 60;
use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest::init_schema();

plan tests => 58;

# figure out if we've got a version of sqlite that is older than 3.2.6, in
# which case COUNT(DISTINCT()) doesn't work
Expand Down Expand Up @@ -88,7 +94,7 @@ $new->name('Man With A Spoon');

$new->update;

$new_again = $schema->resultset("Artist")->find(4);
my $new_again = $schema->resultset("Artist")->find(4);

is($new_again->name, 'Man With A Spoon', 'Retrieved correctly');

Expand Down Expand Up @@ -278,6 +284,3 @@ ok(!$@, "stringify to false value doesn't cause error");
is_deeply([$schema->source('CD')->columns], [qw/cdid artist title/]);
}

}

1;
15 changes: 9 additions & 6 deletions t/run/04db.tl
@@ -1,6 +1,12 @@
sub run_tests {
my $schema = shift;

use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest::init_schema();

plan tests => 3;

# add some rows inside a transaction and commit it
Expand Down Expand Up @@ -48,6 +54,3 @@ my $test_type_info = {
};
is_deeply($type_info, $test_type_info, 'columns_info_for - column data types');

}

1;
16 changes: 10 additions & 6 deletions t/run/05multipk.tl
@@ -1,13 +1,17 @@
sub run_tests {
my $schema = shift;
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest::init_schema();

plan tests => 4;
$artist = DBICTest::Artist->find(1);

my $artist = DBICTest::Artist->find(1);
ok($artist->find_related('twokeys', {cd => 1}), "find multiple pks using relationships + args");
ok($schema->resultset("FourKeys")->find(1,2,3,4), "find multiple pks without hash");
ok($schema->resultset("FourKeys")->find(5,4,3,6), "find multiple pks without hash");
is($schema->resultset("FourKeys")->find(1,2,3,4)->ID, 'DBICTest::FourKeys|fourkeys|bar=2|foo=1|goodbye=4|hello=3', 'unique object id ok for multiple pks');

}

1;
17 changes: 5 additions & 12 deletions t/run/06relationship.tl
@@ -1,11 +1,12 @@
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest::init_schema();

use strict;
use warnings;
plan tests => 32;

# has_a test
Expand Down Expand Up @@ -59,11 +60,7 @@ my $track = $schema->resultset("Track")->create( {
} );
$track->set_from_related( cd => $cd );

if ($INC{'DBICTest/HelperRels.pm'}) { # expect inflated object
is($track->disc->cdid, 4, 'set_from_related ok, including alternative accessor' );
} else {
is( $track->cd, 4, 'set_from_related ok' );
}
is($track->disc->cdid, 4, 'set_from_related ok, including alternative accessor' );

$track->set_from_related( cd => undef );

Expand All @@ -81,11 +78,7 @@ $track->update_from_related( cd => $cd );

my $t_cd = ($schema->resultset("Track")->search( cd => 4, position => 99 ))[0]->cd;

if ($INC{'DBICTest/HelperRels.pm'}) { # except inflated object
is( $t_cd->cdid, 4, 'update_from_related ok' );
} else {
is( $t_cd, 4, 'update_from_related ok' );
}
is( $t_cd->cdid, 4, 'update_from_related ok' );

# find_or_create_related with an existing record
$cd = $artist->find_or_create_related( 'cds', { title => 'Big Flop' } );
Expand Down
13 changes: 8 additions & 5 deletions t/run/07pager.tl
@@ -1,5 +1,11 @@
sub run_tests {
my $schema = shift;
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest::init_schema();

plan tests => 12;

Expand Down Expand Up @@ -62,6 +68,3 @@ is( $it->count, 2, "software count on paged rs ok" );

is( $it->next->title, "Generic Manufactured Singles", "software iterator->next ok" );

}

1;
13 changes: 8 additions & 5 deletions t/run/08inflate.tl
@@ -1,5 +1,11 @@
sub run_tests {
my $schema = shift;
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest::init_schema();

eval { require DateTime };
plan skip_all => "Need DateTime for inflation tests" if $@;
Expand Down Expand Up @@ -27,6 +33,3 @@ $cd->update;
($cd) = $schema->resultset("CD")->search( year => $now->year );
is( $cd->year->year, $now->year, 'deflate ok' );

}

1;
13 changes: 8 additions & 5 deletions t/run/08inflate_has_a.tl
@@ -1,5 +1,11 @@
sub run_tests {
my $schema = shift;
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest::init_schema();

eval { require DateTime };
plan skip_all => "Need DateTime for inflation tests" if $@;
Expand Down Expand Up @@ -50,6 +56,3 @@ $cd->update;
($cd) = $schema->resultset("CD")->search( year => $now->year );
is( $cd->year->year, $now->year, 'deflate ok' );

}

1;
13 changes: 8 additions & 5 deletions t/run/08inflate_serialize.tl
@@ -1,5 +1,11 @@
sub run_tests {
my $schema = shift;
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest::init_schema();

use Data::Dumper;

Expand Down Expand Up @@ -67,6 +73,3 @@ ok($entry->update ({ %{$complex2} }), 'arrayref deflation ok');
ok($inflated = $entry->serialized, 'arrayref inflation ok');
is_deeply($inflated, $complex2->{serialized}, 'inflated array matches original');

}

1;

0 comments on commit 9eba6e0

Please sign in to comment.