X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F101populate_rs.t;h=5de0b4f26907b6d7e638e891fbcdb7e3d7c22656;hb=8273e845426f0187b4ad6c4a1b42286fa09a648f;hp=6caf01e062ceff6feff4443969544e8ea32dcf9c;hpb=33eafbfd322ab48a2697c0ea9fadfb182fb22a36;p=dbsrgits%2FDBIx-Class.git diff --git a/t/101populate_rs.t b/t/101populate_rs.t index 6caf01e..5de0b4f 100644 --- a/t/101populate_rs.t +++ b/t/101populate_rs.t @@ -66,17 +66,17 @@ SCHEMA_POPULATE1: { isa_ok $artist1, 'DBICTest::Artist'; isa_ok $artist2, 'DBICTest::Artist'; isa_ok $artist3, 'DBICTest::Artist'; - isa_ok $undef, 'DBICTest::Artist'; + isa_ok $undef, 'DBICTest::Artist'; ok $artist1->name eq '001First Artist', "Got Expected Artist Name for Artist001"; ok $artist2->name eq '002Second Artist', "Got Expected Artist Name for Artist002"; ok $artist3->name eq '003Third Artist', "Got Expected Artist Name for Artist003"; - ok !defined $undef->name, "Got Expected Artist Name for Artist004"; + ok !defined $undef->name, "Got Expected Artist Name for Artist004"; ok $artist1->cds->count eq 3, "Got Right number of CDs for Artist1"; ok $artist2->cds->count eq 0, "Got Right number of CDs for Artist2"; ok $artist3->cds->count eq 1, "Got Right number of CDs for Artist3"; - ok $undef->cds->count eq 1, "Got Right number of CDs for Artist4"; + ok $undef->cds->count eq 1, "Got Right number of CDs for Artist4"; ARTIST1CDS: { @@ -170,7 +170,7 @@ ARRAY_CONTEXT: { isa_ok( $crap, 'DBICTest::Artist', "Got 'Artist'"); isa_ok( $girl, 'DBICTest::Artist', "Got 'Artist'"); - isa_ok( $damn, 'DBICTest::Artist', "Got 'Artist'"); + isa_ok( $damn, 'DBICTest::Artist', "Got 'Artist'"); isa_ok( $formerly, 'DBICTest::Artist', "Got 'Artist'"); ## Find the expected information? @@ -244,7 +244,7 @@ ARRAY_CONTEXT: { isa_ok( $crap, 'DBICTest::Artist', "Got 'Artist'"); isa_ok( $girl, 'DBICTest::Artist', "Got 'Artist'"); - isa_ok( $damn, 'DBICTest::Artist', "Got 'Artist'"); + isa_ok( $damn, 'DBICTest::Artist', "Got 'Artist'"); isa_ok( $formerly, 'DBICTest::Artist', "Got 'Artist'"); ## Find the expected information? @@ -258,7 +258,7 @@ ARRAY_CONTEXT: { ## Create the expected children sub objects? ok( $crap->cds->count == 0, "got Expected Number of Cds"); - ok( $girl->cds->count == 2, "got Expected Number of Cds"); + ok( $girl->cds->count == 2, "got Expected Number of Cds"); ok( $damn->cds->count == 3, "got Expected Number of Cds"); ok( $formerly->cds->count == 1, "got Expected Number of Cds"); @@ -272,7 +272,7 @@ ARRAY_CONTEXT: { BELONGS_TO_NO_PKs: { - ## Test from a belongs_to perspective, should create artist first, + ## Test from a belongs_to perspective, should create artist first, ## then CD with artistid. This test we let the system automatically ## create the PK's. Chances are good you'll use it this way mostly. @@ -286,7 +286,7 @@ ARRAY_CONTEXT: { title => 'Some CD4', year => '1997', artist => { name => 'Fred BloggsD'}, - }, + }, ]; my ($cdA, $cdB) = $cd_rs->populate($cds); @@ -304,7 +304,7 @@ ARRAY_CONTEXT: { BELONGS_TO_WITH_PKs: { - ## Test from a belongs_to perspective, should create artist first, + ## Test from a belongs_to perspective, should create artist first, ## then CD with artistid. This time we try setting the PK's my $aid = $art_rs->get_column('artistid')->max || 0; @@ -319,7 +319,7 @@ ARRAY_CONTEXT: { title => 'Some CD4', year => '1997', artist => { artistid=> ++$aid, name => 'Fred BloggsF'}, - }, + }, ]; my ($cdA, $cdB) = $cd_rs->populate($cds); @@ -344,7 +344,7 @@ ARRAY_CONTEXT: { ## Did it use the condition in the resultset? cmp_ok( $more_crap->rank, '==', 42, "Got Correct rank for result object"); - } + } } @@ -354,7 +354,7 @@ ARRAY_CONTEXT: { VOID_CONTEXT: { - ## All these tests check the ability to use populate without asking for + ## All these tests check the ability to use populate without asking for ## any returned resultsets. This uses bulk_insert as much as possible ## in order to increase speed. @@ -386,7 +386,7 @@ VOID_CONTEXT: { cds => [ { title => 'VOID_PK_My parents sold me to a record company' ,year => 2005 }, { title => 'VOID_PK_Why Am I So Ugly?', year => 2006 }, - { title => 'VOID_PK_I Got Surgery and am now Popular', year => 2007 } + { title => 'VOID_PK_I Got Surgery and am now Popular', year => 2007 } ], }, { @@ -419,27 +419,27 @@ VOID_CONTEXT: { isa_ok( $crap, 'DBICTest::Artist', "Got 'Artist'"); isa_ok( $girl, 'DBICTest::Artist', "Got 'Artist'"); - isa_ok( $damn, 'DBICTest::Artist', "Got 'Artist'"); - isa_ok( $formerly, 'DBICTest::Artist', "Got 'Artist'"); - isa_ok( $undef, 'DBICTest::Artist', "Got 'Artist'"); + isa_ok( $damn, 'DBICTest::Artist', "Got 'Artist'"); + isa_ok( $formerly, 'DBICTest::Artist', "Got 'Artist'"); + isa_ok( $undef, 'DBICTest::Artist', "Got 'Artist'"); ## Find the expected information? ok( $crap->name eq 'VOID_PK_Manufactured Crap', "Got Correct name 'VOID_PK_Manufactured Crap' for result object"); ok( $girl->name eq 'VOID_PK_Angsty-Whiny Girl', "Got Correct name for result object"); - ok( $damn->name eq 'VOID_PK_Like I Give a Damn', "Got Correct name for result object"); + ok( $damn->name eq 'VOID_PK_Like I Give a Damn', "Got Correct name for result object"); ok( $formerly->name eq 'VOID_PK_Formerly Named', "Got Correct name for result object"); - ok( !defined $undef->name, "Got Correct name 'is undef' for result object"); + ok( !defined $undef->name, "Got Correct name 'is undef' for result object"); ## Create the expected children sub objects? ok( $crap->can('cds'), "Has cds relationship"); ok( $girl->can('cds'), "Has cds relationship"); ok( $damn->can('cds'), "Has cds relationship"); ok( $formerly->can('cds'), "Has cds relationship"); - ok( $undef->can('cds'), "Has cds relationship"); + ok( $undef->can('cds'), "Has cds relationship"); ok( $crap->cds->count == 0, "got Expected Number of Cds"); - ok( $girl->cds->count == 2, "got Expected Number of Cds"); + ok( $girl->cds->count == 2, "got Expected Number of Cds"); ok( $damn->cds->count == 3, "got Expected Number of Cds"); ok( $formerly->cds->count == 1, "got Expected Number of Cds"); ok( $undef->cds->count == 1, "got Expected Number of Cds"); @@ -455,7 +455,7 @@ VOID_CONTEXT: { BELONGS_TO_WITH_PKs: { - ## Test from a belongs_to perspective, should create artist first, + ## Test from a belongs_to perspective, should create artist first, ## then CD with artistid. This time we try setting the PK's my $aid = $art_rs->get_column('artistid')->max || 0; @@ -492,7 +492,7 @@ VOID_CONTEXT: { BELONGS_TO_NO_PKs: { - ## Test from a belongs_to perspective, should create artist first, + ## Test from a belongs_to perspective, should create artist first, ## then CD with artistid. my $cds = [ @@ -510,7 +510,7 @@ VOID_CONTEXT: { title => 'Some CD5BB', year => '1997', artist => { name => undef}, - }, + }, ]; $cd_rs->populate($cds); @@ -543,13 +543,13 @@ VOID_CONTEXT: { ## with the parent having many children and let the keys be automatic my $artists = [ - { + { name => 'VOID_Angsty-Whiny Girl', cds => [ { title => 'VOID_My First CD', year => 2006 }, { title => 'VOID_Yet More Tweeny-Pop crap', year => 2007 }, - ], - }, + ], + }, { name => 'VOID_Manufactured Crap', }, @@ -558,15 +558,15 @@ VOID_CONTEXT: { cds => [ { title => 'VOID_My parents sold me to a record company' ,year => 2005 }, { title => 'VOID_Why Am I So Ugly?', year => 2006 }, - { title => 'VOID_I Got Surgery and am now Popular', year => 2007 } + { title => 'VOID_I Got Surgery and am now Popular', year => 2007 } ], }, - { + { name => 'VOID_Formerly Named', cds => [ { title => 'VOID_One Hit Wonder', year => 2006 }, - ], - }, + ], + }, ]; ## Get the result row objects. @@ -582,14 +582,14 @@ VOID_CONTEXT: { isa_ok( $crap, 'DBICTest::Artist', "Got 'Artist'"); isa_ok( $girl, 'DBICTest::Artist', "Got 'Artist'"); - isa_ok( $damn, 'DBICTest::Artist', "Got 'Artist'"); - isa_ok( $formerly, 'DBICTest::Artist', "Got 'Artist'"); + isa_ok( $damn, 'DBICTest::Artist', "Got 'Artist'"); + isa_ok( $formerly, 'DBICTest::Artist', "Got 'Artist'"); ## Find the expected information? ok( $crap->name eq 'VOID_Manufactured Crap', "Got Correct name for result object"); ok( $girl->name eq 'VOID_Angsty-Whiny Girl', "Got Correct name for result object"); - ok( $damn->name eq 'VOID_Like I Give a Damn', "Got Correct name for result object"); + ok( $damn->name eq 'VOID_Like I Give a Damn', "Got Correct name for result object"); ok( $formerly->name eq 'VOID_Formerly Named', "Got Correct name for result object"); ## Create the expected children sub objects? @@ -599,7 +599,7 @@ VOID_CONTEXT: { ok( $formerly->can('cds'), "Has cds relationship"); ok( $crap->cds->count == 0, "got Expected Number of Cds"); - ok( $girl->cds->count == 2, "got Expected Number of Cds"); + ok( $girl->cds->count == 2, "got Expected Number of Cds"); ok( $damn->cds->count == 3, "got Expected Number of Cds"); ok( $formerly->cds->count == 1, "got Expected Number of Cds"); @@ -627,7 +627,7 @@ VOID_CONTEXT: { ## Did it use the condition in the resultset? cmp_ok( $more_crap->rank, '==', 42, "Got Correct rank for result object"); - } + } } ARRAYREF_OF_ARRAYREF_STYLE: { @@ -649,11 +649,11 @@ ARRAYREF_OF_ARRAYREF_STYLE: { my ($cooler, $lamer) = $restricted_art_rs->populate([ [qw/artistid name/], [1003, 'Cooler'], - [1004, 'Lamer'], + [1004, 'Lamer'], ]); is $cooler->name, 'Cooler', 'Correct Name'; - is $lamer->name, 'Lamer', 'Correct Name'; + is $lamer->name, 'Lamer', 'Correct Name'; cmp_ok $cooler->rank, '==', 42, 'Correct Rank'; @@ -667,7 +667,7 @@ ARRAYREF_OF_ARRAYREF_STYLE: { ## Did it use the condition in the resultset? cmp_ok( $mega_lamer->rank, '==', 42, "Got Correct rank for result object"); - } + } VOID_CONTEXT_WITH_COND_FROM_RS: {