1#!/usr/bin/perl -w 2 3use strict; 4 5use File::Spec; 6 7use lib '.', File::Spec->catdir( File::Spec->curdir, 't', 'lib' ); 8 9use Alzabo::Test::Utils; 10 11use Test::More; 12 13 14use Alzabo::Runtime; 15 16 17my @rdbms_names = Alzabo::Test::Utils->rdbms_names; 18 19unless (@rdbms_names) 20{ 21 plan skip_all => 'no test config provided'; 22 exit; 23} 24 25plan tests => 1; 26 27 28Alzabo::Test::Utils->remove_all_schemas; 29 30 31# doesn't matter which RDBMS is used 32my $rdbms = $rdbms_names[0]; 33 34Alzabo::Test::Utils->make_schema($rdbms); 35 36my $config = Alzabo::Test::Utils->test_config_for($rdbms); 37 38my $s = Alzabo::Runtime::Schema->load_from_file( name => $config->{schema_name} ); 39 40my $destroy = 0; 41sub Alzabo::Runtime::Table::DESTROY { $destroy++ } 42 43{ 44 my $employee_t = $s->table('employee'); 45 46 { 47 my $alias1 = $employee_t->alias; 48 $alias1->primary_key; 49 } 50 51 is( $destroy, 1, 'alias should go out of scope' ); 52} 53