X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F86sqlt.t;h=76e759d850206c7aea41f7877341ae6f0d604922;hb=16be93fed654413dff2f4eb541bc2d10b55d6f31;hp=d240a9cd8daf7acc5fb52717733ce56a0a43c4fb;hpb=fed15b9163bcb281a3a654643949a9cd1f9a3928;p=dbsrgits%2FDBIx-Class.git diff --git a/t/86sqlt.t b/t/86sqlt.t index d240a9c..76e759d 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -22,11 +22,10 @@ sub DBICTest::Schema::deployment_statements { return $self->next::method(@_); } -my $schema = DBICTest->init_schema (no_deploy => 1); - # Check deployment statements ctx sensitivity { + my $schema = DBICTest->init_schema (no_deploy => 1); my $not_first_table_creation_re = qr/CREATE TABLE fourkeys_to_twokeys/; my $statements = $schema->deployment_statements; @@ -59,13 +58,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,11 +72,19 @@ 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'); } +my $schema = DBICTest->init_schema (no_deploy => 1); + { my $deploy_hook_called = 0; $custom_deployment_statements_called = 0;