X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi-t%2F15-accessor.t;h=b487cc6d052abfe44d9e1f59fb243755c7c2149b;hb=c4d239930f5d96be7ddccdb59ff07ff1bd43698d;hp=91d614596713dec643bf37d637c4ed4d07ac1102;hpb=dec1bfe02a3edde0ad981a663811926f29825777;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/cdbi-t/15-accessor.t b/t/cdbi-t/15-accessor.t index 91d6145..b487cc6 100644 --- a/t/cdbi-t/15-accessor.t +++ b/t/cdbi-t/15-accessor.t @@ -8,7 +8,7 @@ BEGIN { next; } eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 55); + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 75); } INIT { @@ -57,18 +57,61 @@ my $data = { }; eval { - my $data = $data; + my $data = { %$data }; $data->{NumExplodingSheep} = 1; ok my $bt = Film->create($data), "Modified accessor - with column name"; isa_ok $bt, "Film"; + is $bt->sheep, 1, 'sheep bursting violently'; }; is $@, '', "No errors"; eval { - my $data = $data; - $data->{sheep} = 1; + my $data = { %$data }; + $data->{sheep} = 2; ok my $bt = Film->create($data), "Modified accessor - with accessor"; isa_ok $bt, "Film"; + is $bt->sheep, 2, 'sheep bursting violently'; +}; +is $@, '', "No errors"; + +eval { + my $data = { %$data }; + $data->{NumExplodingSheep} = 1; + ok my $bt = Film->find_or_create($data), + "find_or_create Modified accessor - find with column name"; + isa_ok $bt, "Film"; + is $bt->sheep, 1, 'sheep bursting violently'; +}; +is $@, '', "No errors"; + +eval { + my $data = { %$data }; + $data->{sheep} = 1; + ok my $bt = Film->find_or_create($data), + "find_or_create Modified accessor - find with accessor"; + isa_ok $bt, "Film"; + is $bt->sheep, 1, 'sheep bursting violently'; +}; +is $@, '', "No errors"; + +TODO: { local $TODO = 'TODOifying failing tests, waiting for Schwern'; ok (1, 'remove me'); +eval { + my $data = { %$data }; + $data->{NumExplodingSheep} = 3; + ok my $bt = Film->find_or_create($data), + "find_or_create Modified accessor - create with column name"; + isa_ok $bt, "Film"; + is $bt->sheep, 3, 'sheep bursting violently'; +}; +is $@, '', "No errors"; + +eval { + my $data = { %$data }; + $data->{sheep} = 4; + ok my $bt = Film->find_or_create($data), + "find_or_create Modified accessor - create with accessor"; + isa_ok $bt, "Film"; + is $bt->sheep, 4, 'sheep bursting violently'; }; is $@, '', "No errors"; @@ -76,6 +119,9 @@ eval { my @film = Film->search({ sheep => 1 }); is @film, 2, "Can search with modified accessor"; }; +is $@, '', "No errors"; + +} {