requires 'parent';
requires 'signatures';
+test_requires 'Module::Find';
+
auto_install;
WriteAll;
use warnings;
use lib 't/lib';
use Test::More qw(no_plan);
+use Module::Find;
-BEGIN { use_ok $_ for qw/MTITest NoSequence Cafe/; }
+BEGIN {
+ use_ok 'DBIx::Class::ResultSource::MultipleTableInheritance';
+
+ for (qw/LoadTest NoSequenceSalad CafeInsertion/) {
+ use_ok $_;
+ my @modules = findallmod $_;
+ for my $result_class (@modules) {
+ use_ok $result_class;
+ }
+ }
+}
use warnings;
use lib 't/lib';
use Test::More qw(no_plan);
+use LoadTest;
-BEGIN { use_ok 'MTITest'; }
+BEGIN {
+ $ENV{DBIC_TRACE} = 0;
+}
+my $raw_foo = LoadTest->source('Raw::Foo');
-my $raw_foo = MTITest->source('Raw::Foo');
+is_deeply( [ $raw_foo->columns ], [qw(id a)],
+ 'Columns for raw foo ok: id a' );
-is_deeply(
- [ $raw_foo->columns ],
- [ qw(id a) ],
- 'Columns for raw foo ok: id a'
-);
-
-my $raw_bar = MTITest->source('Raw::Bar');
+my $raw_bar = LoadTest->source('Raw::Bar');
-is_deeply(
- [ $raw_bar->columns ],
- [ qw(id b) ],
- 'Columns for raw bar ok: id b'
-);
+is_deeply( [ $raw_bar->columns ], [qw(id b)],
+ 'Columns for raw bar ok: id b' );
-ok($raw_bar->has_relationship('parent'), 'parent rel exists');
+ok( $raw_bar->has_relationship('parent'), 'parent rel exists' );
my $parent_info = $raw_bar->relationship_info('parent');
-is(
- $parent_info->{source}, 'Raw::Foo',
- 'parent rel points to raw parent'
-);
-
-my $foo = MTITest->source('Foo');
-my $bar = MTITest->source('Bar');
+is( $parent_info->{source}, 'Raw::Foo', 'parent rel points to raw parent' );
-is_deeply(
- [ $foo->columns ],
- [ qw(id a) ],
- 'Columns for mti foo are still the same: id a'
-);
+my $foo = LoadTest->source('Foo');
+my $bar = LoadTest->source('Bar');
+is_deeply( [ $foo->columns ],
+ [qw(id a)], 'Columns for mti foo are still the same: id a' );
is_deeply(
- [ $bar->columns ],
- [ qw(id a words b) ],
- 'Columns for mti bar now contain those of foo and the mixin: id a words b'
+ [ $bar->columns ],
+ [qw(id a words b)],
+ 'Columns for mti bar now contain those of foo and the mixin: id a words b'
);
use File::Temp;
use Test::More qw(no_plan);
use Test::Exception;
-use Devel::Dwarn;
+use LoadTest;
BEGIN {
- use_ok 'MTITest';
$ENV{DBIC_TRACE} = 0;
}
( NOTE: This test drops and creates some tables.')
EOM
-dies_ok { MTITest->source('Foo')->view_definition }
+dies_ok { LoadTest->source('Foo')->view_definition }
"Can't generate view def without connected schema";
-my $schema = MTITest->connect( $dsn, $user, $pass );
+my $schema = LoadTest->connect( $dsn, $user, $pass );
my $dir = "t/sql"; # tempdir(CLEANUP => 0);
-$schema->storage->dbh->{Warn} = 0;
lives_ok { $schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir ) }
"It's OK to create_ddl_dir";
lives_ok {
- $schema->deploy(
- { add_drop_table => 1, add_drop_view => 1, } );
+ $schema->deploy( { add_drop_table => 1, add_drop_view => 1, } );
}
"It's also OK to deploy the schema";
use lib 't/lib';
use Test::More qw(no_plan);
use Test::Exception;
-use Devel::Dwarn;
+use CafeInsertion;
BEGIN {
- use_ok 'Cafe';
$ENV{DBIC_TRACE} = 0;
}
+
my ( $dsn, $user, $pass )
= @ENV{ map {"DBICTEST_PG_${_}"} qw/DSN USER PASS/ };
plan skip_all => <<'EOM' unless $dsn && $user;
( NOTE: This test drops and creates some tables.')
EOM
-my $schema = Cafe->connect( $dsn, $user, $pass );
-$schema->storage->dbh->{Warn} = 0;
+my $schema = CafeInsertion->connect( $dsn, $user, $pass );
$schema->storage->ensure_connected;
$schema->storage->_use_insert_returning(0);
use lib 't/lib';
use Test::More qw(no_plan);
use Test::Exception;
-use Devel::Dwarn;
+use NoSequenceSalad;
BEGIN {
- use_ok 'NoSequence';
- $ENV{DBIC_TRACE} = 0;
+ $ENV{DBIC_TRACE} = 0;
}
-
my ( $dsn, $user, $pass )
= @ENV{ map {"DBICTEST_PG_${_}"} qw/DSN USER PASS/ };
( NOTE: This test drops and creates some tables.')
EOM
-my $schema = NoSequence->connect( $dsn, $user, $pass );
-$schema->storage->dbh->{Warn} = 0;
+my $schema = NoSequenceSalad->connect( $dsn, $user, $pass );
$schema->storage->ensure_connected;
$schema->storage->_use_insert_returning(0);
+++ /dev/null
-package Cafe::Result::Sumatra;
-
-use strict;
-use warnings;
-use parent 'Cafe::Result::Coffee';
-
-require Cafe::Result::Sugar;
-
-__PACKAGE__->table('sumatra');
-__PACKAGE__->result_source_instance->add_additional_parent(
- Cafe::Result::Sugar->result_source_instance );
-__PACKAGE__->add_columns( "aroma", { data_type => "text" } );
-
-#__PACKAGE__->has_many( 'coffees', 'Cafe::Result::Coffee',
-#{ 'foreign.id' => 'self.id' } );
-
-1;
-package Cafe;
+package CafeInsertion;
use strict;
use warnings;
-package Cafe::Result::Coffee;
+package CafeInsertion::Result::Coffee;
use strict;
use warnings;
-package Cafe::Result::Sugar;
+package CafeInsertion::Result::Sugar;
use strict;
use warnings;
--- /dev/null
+package CafeInsertion::Result::Sumatra;
+
+use strict;
+use warnings;
+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__->add_columns( "aroma", { data_type => "text" } );
+
+#__PACKAGE__->has_many( 'coffees', 'CafeInsertion::Result::Coffee',
+#{ 'foreign.id' => 'self.id' } );
+
+1;
-package MTITest;
+package LoadTest;
use strict;
use warnings;
-package MTITest::Result::Bar;
+package LoadTest::Result::Bar;
use strict;
use warnings;
-use parent qw(MTITest::Result::Foo);
+use parent qw(LoadTest::Result::Foo);
-require MTITest::Result::Mixin;
+require LoadTest::Result::Mixin;
__PACKAGE__->table('bar');
__PACKAGE__->result_source_instance->add_additional_parent(
- MTITest::Result::Mixin->result_source_instance
+ LoadTest::Result::Mixin->result_source_instance
);
__PACKAGE__->add_columns(
__PACKAGE__->belongs_to(
'b_thang',
- 'MTITest::Result::JustATable',
+ 'LoadTest::Result::JustATable',
{ 'foreign.id' => 'self.b' },
);
__PACKAGE__->has_many(
'foos',
- 'MTITest::Result::Foo',
+ 'LoadTest::Result::Foo',
{ 'foreign.a' => 'self.id' }
);
-package MTITest::Result::Foo;
+package LoadTest::Result::Foo;
use strict;
use warnings;
__PACKAGE__->belongs_to(
'bar',
- 'MTITest::Result::Bar',
+ 'LoadTest::Result::Bar',
{ 'foreign.id' => 'self.a' }
);
-package MTITest::Result::JustATable;
+package LoadTest::Result::JustATable;
use base qw(DBIx::Class::Core);
__PACKAGE__->has_many(
'bars',
- 'MTITest::Result::Bar',
+ 'LoadTest::Result::Bar',
{ 'foreign.b' => 'self.id' }
);
-package MTITest::Result::Mixin;
+package LoadTest::Result::Mixin;
use strict;
use warnings;
+++ /dev/null
-package NoSequence::Result::Mesclun;
-
-use strict;
-use warnings;
-use parent 'NoSequence::Result::Salad';
-
-require NoSequence::Result::Dressing;
-
-__PACKAGE__->table('mesclun');
-__PACKAGE__->result_source_instance->add_additional_parent(
- NoSequence::Result::Dressing->result_source_instance );
-__PACKAGE__->add_columns( "spiciness", { data_type => "integer" } );
-
-1;
-package NoSequence;
+package NoSequenceSalad;
use strict;
use warnings;
-package NoSequence::Result::Dressing;
+package NoSequenceSalad::Result::Dressing;
use strict;
use warnings;
--- /dev/null
+package NoSequenceSalad::Result::Mesclun;
+
+use strict;
+use warnings;
+use parent 'NoSequenceSalad::Result::Salad';
+
+require NoSequenceSalad::Result::Dressing;
+
+__PACKAGE__->table('mesclun');
+__PACKAGE__->result_source_instance->add_additional_parent(
+ NoSequenceSalad::Result::Dressing->result_source_instance );
+__PACKAGE__->add_columns( "spiciness", { data_type => "integer" } );
+
+1;
-package NoSequence::Result::Salad;
+package NoSequenceSalad::Result::Salad;
use strict;
use warnings;