sub run_tests {
my $self = shift;
- plan tests => 139 + ($self->{extra}->{count} || 0);
+ plan tests => 140 + ($self->{extra}->{count} || 0);
$self->create();
inflect_singular => { fkid => 'fkid_singular' },
moniker_map => \&_monikerize,
debug => $debug,
+ use_namespaces => 0,
dump_directory => $DUMP_DIR,
);
my $expected_count = 34;
- $expected_count += @{ $self->{extra}{drop} || [] };
+ $expected_count += grep /CREATE (?:TABLE|VIEW)/i,
+ @{ $self->{extra}{create} || [] };
$expected_count -= grep /CREATE TABLE/, @statements_inline_rels
- if $self->{no_inline_rels};
+ if $self->{skip_rels} || $self->{no_inline_rels};
$expected_count -= grep /CREATE TABLE/, @statements_implicit_rels
- if $self->{no_implicit_rels};
+ if $self->{skip_rels} || $self->{no_implicit_rels};
+
+ $expected_count -= grep /CREATE TABLE/, ($self->{vendor} =~ /sqlite/ ? @statements_advanced_sqlite : @statements_advanced), @statements_reltests
+ if $self->{skip_rels};
is $file_count, $expected_count, 'correct number of files generated';
exit if $file_count != $expected_count;
- my $warn_count = 0;
+ my $warn_count = 2;
$warn_count++ if grep /ResultSetManager/, @loader_warnings;
+ $warn_count++ for grep /^Bad table or view/, @loader_warnings;
+
+ my $vendor = $self->{vendor};
+ $warn_count++ for grep /${vendor}_\S+ has no primary key/,
+ @loader_warnings;
+
if($self->{skip_rels}) {
SKIP: {
is(scalar(@loader_warnings), $warn_count, "No loader warnings")
}
ok( $class1->column_info('id')->{is_auto_increment}, 'is_auto_incrment detection' );
+ is($class2->column_info('dat2')->{default_value}, 'foo', 'Correct default value');
my $obj = $rsobj1->find(1);
is( $obj->id, 1, "Find got the right row" );
CREATE TABLE loader_test2 (
id $self->{auto_inc_pk},
dat VARCHAR(32) NOT NULL,
- dat2 VARCHAR(32) NOT NULL,
+ dat2 VARCHAR(32) NOT NULL DEFAULT 'foo',
UNIQUE (dat2, dat)
) $self->{innodb}
},
unless($self->{no_implicit_rels}) {
$dbh->do("DROP TABLE $_") for (@tables_implicit_rels);
}
- $dbh->do("DROP TABLE $_") for (@tables_rescan);
}
- $dbh->do("DROP TABLE $_") for (@tables);
+ $dbh->do("DROP TABLE $_") for (@tables, @tables_rescan);
$dbh->do($_) for map { $drop_auto_inc->(@$_) } @tables_auto_inc;
$dbh->disconnect;
}