$custom_deployment_statements_called = 0;
# add a temporary sqlt_deploy_hook to a source
- no warnings 'once';
- local *DBICTest::Track::sqlt_deploy_hook = sub {
+ local $DBICTest::Schema::Track::hook_cb = sub {
my ($class, $sqlt_table) = @_;
$deploy_hook_called = 1;
);
};
+ my $component_deploy_hook_called = 0;
+ local $DBICTest::DeployComponent::hook_cb = sub {
+ $component_deploy_hook_called = 1;
+ };
+
$schema->deploy; # do not remove, this fires the is() test in the callback above
ok($deploy_hook_called, 'deploy hook got called');
ok($custom_deployment_statements_called, '->deploy used the schemas deploy_statements method');
+ ok($component_deploy_hook_called, 'component deploy hook got called');
}
{
--- /dev/null
+# belongs to t/86sqlt.t
+package # hide from PAUSE
+ DBICTest::DeployComponent;
+use warnings;
+use strict;
+
+our $hook_cb;
+
+sub sqlt_deploy_hook {
+ my $class = shift;
+
+ $hook_cb->($class, @_) if $hook_cb;
+ $class->next::method(@_) if $class->next::can;
+}
+
+1;
use base qw/DBICTest::BaseResult/;
use Carp qw/confess/;
-__PACKAGE__->load_components(qw/InflateColumn::DateTime Ordered/);
+__PACKAGE__->load_components(qw{
+ +DBICTest::DeployComponent
+ InflateColumn::DateTime
+ Ordered
+});
__PACKAGE__->table('track');
__PACKAGE__->add_columns(
}
);
+our $hook_cb;
+
+sub sqlt_deploy_hook {
+ my $class = shift;
+
+ $hook_cb->($class, @_) if $hook_cb;
+ $class->next::method(@_) if $class->next::can;
+}
+
1;