Added tests for chained sqlt_deploy_hook()'s
[dbsrgits/DBIx-Class.git] / t / 86sqlt.t
index d240a9c..961ca27 100644 (file)
@@ -59,13 +59,12 @@ my $schema = DBICTest->init_schema (no_deploy => 1);
   $custom_deployment_statements_called = 0;
 
   # add a temporary sqlt_deploy_hook to a source
-  no warnings 'once';
-  local *DBICTest::Track::sqlt_deploy_hook = sub {
-    my ($self, $sqlt_table) = @_;
+  local $DBICTest::Schema::Track::hook_cb = sub {
+    my ($class, $sqlt_table) = @_;
 
     $deploy_hook_called = 1;
 
-    is (blessed ($self), 'DBIx::Class::ResultSource::Table', 'Source object passed to plain hook');
+    is ($class, 'DBICTest::Track', 'Result class passed to plain hook');
 
     is (
       $sqlt_table->schema->translator->producer_type,
@@ -74,9 +73,15 @@ my $schema = DBICTest->init_schema (no_deploy => 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');
 }
 
 {