From: Amiri Barksdale at Home Date: Wed, 29 Dec 2010 15:50:43 +0000 (-0800) Subject: New, failing SQLT deployment order test. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b5c5e0464b9c34d051cf87698d3b97d88f228d54;p=dbsrgits%2FDBIx-Class-ResultSource-MultipleTableInheritance.git New, failing SQLT deployment order test. The order of the views is not being set properly because one keeps depending on itself. Still code-diving to find out why. The Cafe schema works, and I don't see the difference yet. --- diff --git a/t/02view_def.t b/t/02view_def.t index 19cfc59..4b5d2c9 100644 --- a/t/02view_def.t +++ b/t/02view_def.t @@ -23,6 +23,7 @@ dies_ok { LoadTest->source('Foo')->view_definition } "Can't generate view def without connected schema"; my $schema = LoadTest->connect( $dsn, $user, $pass ); +$schema->storage->ensure_connected; my $dir = "t/sql"; # tempdir(CLEANUP => 0); @@ -33,6 +34,12 @@ lives_ok { } "It's also OK to deploy the schema"; +isa_ok( + $schema->source('Bar'), + 'DBIx::Class::ResultSource::View', + "My MTI class also" +); + my $sqlt_object = $schema->{sqlt}; is_deeply( diff --git a/t/lib/CafeInsertion/Result/Chair.pm b/t/lib/CafeInsertion/Result/Chair.pm new file mode 100644 index 0000000..cd06d35 --- /dev/null +++ b/t/lib/CafeInsertion/Result/Chair.pm @@ -0,0 +1,22 @@ +package # hide from PAUSE + CafeInsertion::Result::Chair; + +use base qw(DBIx::Class::Core); + +__PACKAGE__->table('chair'); + +__PACKAGE__->add_columns( + id => { data_type => 'integer', is_auto_increment => 1 }, + name => { data_type => 'varchar', size => 255 } +); + +__PACKAGE__->set_primary_key('id'); + +__PACKAGE__->has_many( + 'coffees', + 'CafeInsertion::Result::Coffee', + { 'foreign.id' => 'self.id' } +); + + +1; diff --git a/t/lib/CafeInsertion/Result/Coffee.pm b/t/lib/CafeInsertion/Result/Coffee.pm index 625c949..0dc65b0 100644 --- a/t/lib/CafeInsertion/Result/Coffee.pm +++ b/t/lib/CafeInsertion/Result/Coffee.pm @@ -1,5 +1,5 @@ -package # hide from PAUSE - CafeInsertion::Result::Coffee; +package # hide from PAUSE + CafeInsertion::Result::Coffee; use strict; use warnings; @@ -9,8 +9,13 @@ use aliased 'DBIx::Class::ResultSource::MultipleTableInheritance' => 'MTI'; __PACKAGE__->table_class(MTI); __PACKAGE__->table('coffee'); __PACKAGE__->add_columns( - "id", { data_type => "integer", is_auto_increment => 1, sequence => '_coffee_id_seq'}, - "flavor", { data_type => "text", default_value => "good" }, + "id", + { data_type => "integer", + is_auto_increment => 1, + sequence => '_coffee_id_seq' + }, + "flavor", + { data_type => "text", default_value => "good" }, ); __PACKAGE__->set_primary_key("id"); diff --git a/t/lib/CafeInsertion/Result/Sugar.pm b/t/lib/CafeInsertion/Result/Sugar.pm index 31001ae..a7b9304 100644 --- a/t/lib/CafeInsertion/Result/Sugar.pm +++ b/t/lib/CafeInsertion/Result/Sugar.pm @@ -1,5 +1,5 @@ -package # hide from PAUSE - CafeInsertion::Result::Sugar; +package # hide from PAUSE + CafeInsertion::Result::Sugar; use strict; use warnings; diff --git a/t/lib/CafeInsertion/Result/Sumatra.pm b/t/lib/CafeInsertion/Result/Sumatra.pm index 04403fa..3c6c7b7 100644 --- a/t/lib/CafeInsertion/Result/Sumatra.pm +++ b/t/lib/CafeInsertion/Result/Sumatra.pm @@ -1,5 +1,5 @@ -package # hide from PAUSE - CafeInsertion::Result::Sumatra; +package # hide from PAUSE + CafeInsertion::Result::Sumatra; use strict; use warnings; @@ -8,11 +8,14 @@ use parent 'CafeInsertion::Result::Coffee'; require CafeInsertion::Result::Sugar; __PACKAGE__->table('sumatra'); -__PACKAGE__->result_source_instance->add_additional_parent( - CafeInsertion::Result::Sugar->result_source_instance ); +__PACKAGE__->result_source_instance->add_additional_parents( + "CafeInsertion::Result::Sugar"); __PACKAGE__->add_columns( "aroma", { data_type => "text" } ); -#__PACKAGE__->has_many( 'coffees', 'CafeInsertion::Result::Coffee', -#{ 'foreign.id' => 'self.id' } ); +__PACKAGE__->has_many( + 'coffees', + 'CafeInsertion::Result::Coffee', + { 'foreign.id' => 'self.id' } +); 1; diff --git a/t/lib/LoadTest/Result/Bar.pm b/t/lib/LoadTest/Result/Bar.pm index ed6a506..e236be3 100644 --- a/t/lib/LoadTest/Result/Bar.pm +++ b/t/lib/LoadTest/Result/Bar.pm @@ -1,5 +1,5 @@ -package # hide from PAUSE - LoadTest::Result::Bar; +package # hide from PAUSE + LoadTest::Result::Bar; use strict; use warnings; @@ -9,24 +9,18 @@ require LoadTest::Result::Mixin; __PACKAGE__->table('bar'); -__PACKAGE__->result_source_instance->add_additional_parent( - LoadTest::Result::Mixin->result_source_instance -); +__PACKAGE__->result_source_instance->add_additional_parents( + "LoadTest::Result::Mixin" ); + +__PACKAGE__->add_columns( b => { data_type => 'integer' } ); -__PACKAGE__->add_columns( - b => { data_type => 'integer' } +__PACKAGE__->belongs_to( + 'b_thang', + 'LoadTest::Result::JustATable', + { 'foreign.id' => 'self.b' }, ); -#__PACKAGE__->belongs_to( - #'b_thang', - #'LoadTest::Result::JustATable', - #{ 'foreign.id' => 'self.b' }, -#); - -#__PACKAGE__->has_many( - #'foos', - #'LoadTest::Result::Foo', - #{ 'foreign.a' => 'self.id' } -#); +__PACKAGE__->has_many( 'foos', 'LoadTest::Result::Foo', + { 'foreign.a' => 'self.id' } ); 1; diff --git a/t/lib/LoadTest/Result/Foo.pm b/t/lib/LoadTest/Result/Foo.pm index 7b20e1b..a8680ae 100644 --- a/t/lib/LoadTest/Result/Foo.pm +++ b/t/lib/LoadTest/Result/Foo.pm @@ -1,26 +1,22 @@ -package # hide from PAUSE - LoadTest::Result::Foo; +package # hide from PAUSE + LoadTest::Result::Foo; use strict; use warnings; -use parent qw(DBIx::Class::Core); -use aliased 'DBIx::Class::ResultSource::MultipleTableInheritance'; - -__PACKAGE__->table_class(MultipleTableInheritance); +use parent 'DBIx::Class::Core'; +use aliased 'DBIx::Class::ResultSource::MultipleTableInheritance' => 'MTI'; +__PACKAGE__->table_class(MTI); __PACKAGE__->table('foo'); __PACKAGE__->add_columns( - id => { data_type => 'integer', is_auto_increment => 1 }, - a => { data_type => 'integer', is_nullable => 1 } + id => { data_type => 'integer', is_auto_increment => 1 }, + a => { data_type => 'integer', is_nullable => 1 } ); __PACKAGE__->set_primary_key('id'); -#__PACKAGE__->belongs_to( - #'bar', - #'LoadTest::Result::Bar', - #{ 'foreign.id' => 'self.a' } -#); +__PACKAGE__->belongs_to( 'bar', 'LoadTest::Result::Bar', + { 'foreign.id' => 'self.a' } ); 1; diff --git a/t/lib/LoadTest/Result/Mixin.pm b/t/lib/LoadTest/Result/Mixin.pm index 95a9007..10eb205 100644 --- a/t/lib/LoadTest/Result/Mixin.pm +++ b/t/lib/LoadTest/Result/Mixin.pm @@ -1,17 +1,19 @@ -package # hide from PAUSE - LoadTest::Result::Mixin; +package # hide from PAUSE + LoadTest::Result::Mixin; use strict; use warnings; -use parent qw(DBIx::Class::Core); +use parent 'DBIx::Class::Core'; __PACKAGE__->table('mixin'); __PACKAGE__->add_columns( - id => { - data_type => 'integer', is_auto_increment => 1, sequence => 'foo_id_seq' - }, - words => { data_type => 'text' } + id => { + data_type => 'integer', + is_auto_increment => 1, + sequence => 'foo_id_seq' + }, + words => { data_type => 'text' } ); __PACKAGE__->set_primary_key('id');