From: Peter Rabbitson Date: Fri, 20 Feb 2009 09:17:21 +0000 (+0000) Subject: Ordered now works correctly with MC too \o/ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1ceafb0cf3647c04e3e7029f7c1a2d0559f6d595;p=dbsrgits%2FDBIx-Class-Historic.git Ordered now works correctly with MC too \o/ --- diff --git a/t/96multi_create.t b/t/96multi_create.t index d808eba..e07bfd9 100644 --- a/t/96multi_create.t +++ b/t/96multi_create.t @@ -91,9 +91,9 @@ eval { title => 'Bad investment', year => 2008, tracks => [ - { position => 1, title => 'Just buy' }, - { position => 2, title => 'Why did we do it' }, - { position => 3, title => 'Burn baby burn' }, + { title => 'Just buy' }, + { title => 'Why did we do it' }, + { title => 'Burn baby burn' }, ], }, producer => { @@ -133,19 +133,17 @@ eval { year => 2008, tracks => [ { - position => 1, # some day me might test this with Ordered title => 'Off by one again', }, { - position => 2, title => 'The dereferencer', cd_single => { artist => $artist, year => 2008, title => 'Was that a null (Single)', tracks => [ - { title => 'The dereferencer', position => 1 }, - { title => 'The dereferencer II', position => 2 }, + { title => 'The dereferencer' }, + { title => 'The dereferencer II' }, ], cd_to_producer => [ { @@ -204,16 +202,15 @@ eval { my $cd = $schema->resultset('CD')->first; my $track = $schema->resultset('Track')->create ({ cd => $cd, - position => 77, # some day me might test this with Ordered title => 'Multicreate rocks', cd_single => { artist => $cd->artist, year => 2008, title => 'Disemboweling MultiCreate', tracks => [ - { title => 'Why does mst write this way', position => 1 }, - { title => 'Chainsaw celebration', position => 2 }, - { title => 'Purl cleans up', position => 3 }, + { title => 'Why does mst write this way' }, + { title => 'Chainsaw celebration' }, + { title => 'Purl cleans up' }, ], cd_to_producer => [ { @@ -303,7 +300,6 @@ eval { my $cd = $schema->resultset('CD')->first; my $track = $schema->resultset ('Track')->create ({ cd => $cd, - position => 66, title => 'Black', lyrics => { lyric_versions => [ @@ -441,13 +437,8 @@ eval { title => 'TestOneCD1', year => 2007, tracks => [ - - { position=>111, - title => 'TrackOne', - }, - { position=>112, - title => 'TrackTwo', - } + { title => 'TrackOne' }, + { title => 'TrackTwo' }, ], }); @@ -475,13 +466,8 @@ eval { title => 'TestOneCD2', year => 2007, tracks => [ - - { position=>111, - title => 'TrackOne', - }, - { position=>112, - title => 'TrackTwo', - } + { title => 'TrackOne' }, + { title => 'TrackTwo' }, ], liner_notes => { notes => 'I can haz liner notes?' }, diff --git a/t/96multi_create/cd_single.t b/t/96multi_create/cd_single.t index 53825b8..5f2f568 100644 --- a/t/96multi_create/cd_single.t +++ b/t/96multi_create/cd_single.t @@ -12,7 +12,6 @@ eval { my $cd = $schema->resultset('CD')->first; my $track = $schema->resultset('Track')->new_result({ cd => $cd, - position => 77, # some day me might test this with Ordered title => 'Multicreate rocks', cd_single => { artist => $cd->artist, diff --git a/t/lib/DBICTest/Schema/Track.pm b/t/lib/DBICTest/Schema/Track.pm index ffbd2fd..e3f731e 100644 --- a/t/lib/DBICTest/Schema/Track.pm +++ b/t/lib/DBICTest/Schema/Track.pm @@ -2,7 +2,7 @@ package # hide from PAUSE DBICTest::Schema::Track; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components(qw/InflateColumn::DateTime/); +__PACKAGE__->load_components(qw/InflateColumn::DateTime Ordered/); __PACKAGE__->table('track'); __PACKAGE__->add_columns( @@ -32,6 +32,10 @@ __PACKAGE__->set_primary_key('trackid'); __PACKAGE__->add_unique_constraint([ qw/cd position/ ]); __PACKAGE__->add_unique_constraint([ qw/cd title/ ]); +__PACKAGE__->position_column ('position'); +__PACKAGE__->grouping_column ('cd'); + + __PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD' ); __PACKAGE__->belongs_to( disc => 'DBICTest::Schema::CD' => 'cd');