X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F60core.t;h=2f30ad74b64b86ffd8a8f79752618c15a2d9f068;hb=4baa3b95cf1a0c69079babf37371f346edd08855;hp=77ee4f9ec3ca123890f491457b99518596db4237;hpb=f45dc928a3d4a50b495dde22a423b3ce0da5234c;p=dbsrgits%2FDBIx-Class.git diff --git a/t/60core.t b/t/60core.t index 77ee4f9..2f30ad7 100644 --- a/t/60core.t +++ b/t/60core.t @@ -1,10 +1,12 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + use strict; use warnings; use Test::More; use Test::Exception; use Test::Warn; -use lib qw(t/lib); + use DBICTest ':DiffSQL'; my $schema = DBICTest->init_schema(); @@ -123,19 +125,8 @@ warnings_exist { $schema->resultset('Artist')->search_rs(id => 4) } qr/\Qsearch( %condition ) is deprecated/, 'Deprecation warning on ->search( %condition )'; -# this has been warning for 4 years, killing -throws_ok { - $schema->resultset('Artist')->find(artistid => 4); -} qr|expects either a column/value hashref, or a list of values corresponding to the columns of the specified unique constraint|; - is($schema->resultset("Artist")->count, 4, 'count ok'); -# test find on an unresolvable condition -is( - $schema->resultset('Artist')->find({ artistid => [ -and => 1, 2 ]}), - undef -); - # test find_or_new { @@ -206,41 +197,6 @@ $new = $schema->resultset("Track")->new( { $new->update_or_insert; ok($new->in_storage, 'update_or_insert insert ok'); -# test in update mode -$new->title('Insert or Update - updated'); -$new->update_or_insert; -is( $schema->resultset("Track")->find(100)->title, 'Insert or Update - updated', 'update_or_insert update ok'); - -SKIP: { - skip "Tests require " . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_sqlite'), 13 - unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_sqlite'); - - # test get_inflated_columns with objects - my $event = $schema->resultset('Event')->search->first; - my %edata = $event->get_inflated_columns; - is($edata{'id'}, $event->id, 'got id'); - isa_ok($edata{'starts_at'}, 'DateTime', 'start_at is DateTime object'); - isa_ok($edata{'created_on'}, 'DateTime', 'create_on DateTime object'); - is($edata{'starts_at'}, $event->starts_at, 'got start date'); - is($edata{'created_on'}, $event->created_on, 'got created date'); - - - # get_inflated_columns w/relation and accessor alias - isa_ok($new->updated_date, 'DateTime', 'have inflated object via accessor'); - my %tdata = $new->get_inflated_columns; - is($tdata{'trackid'}, 100, 'got id'); - isa_ok($tdata{'cd'}, 'DBICTest::CD', 'cd is CD object'); - is($tdata{'cd'}->id, 1, 'cd object is id 1'); - is( - $tdata{'position'}, - $schema->resultset ('Track')->search ({cd => 1})->count, - 'Ordered assigned proper position', - ); - is($tdata{'title'}, 'Insert or Update - updated'); - is($tdata{'last_updated_on'}, '1973-07-19T12:01:02'); - isa_ok($tdata{'last_updated_on'}, 'DateTime', 'inflated accessored column'); -} - throws_ok (sub { $schema->class("Track")->load_components('DoesNotExist'); }, qr!Can't locate DBIx/Class/DoesNotExist.pm!, 'exception on nonexisting component'); @@ -583,17 +539,6 @@ lives_ok (sub { my $newlink = $newbook->link}, "stringify to false value doesn't isa_ok( $new_artist, 'DBIx::Class::Row', '$rs->new gives a row object' ); } - -# make sure we got rid of the compat shims -SKIP: { - my $remove_version = 0.083; - skip "Remove in $remove_version", 3 if $DBIx::Class::VERSION < $remove_version; - - for (qw/compare_relationship_keys pk_depends_on resolve_condition/) { - ok (! DBIx::Class::ResultSource->can ($_), "$_ no longer provided by DBIx::Class::ResultSource, removed before $remove_version"); - } -} - #------------------------------ # READ THIS BEFORE "FIXING" #------------------------------