File: 15-alias-ref.t

package info (click to toggle)
libalzabo-perl 0.92-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,172 kB
  • ctags: 794
  • sloc: perl: 15,060; makefile: 4
file content (52 lines) | stat: -rw-r--r-- 896 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl -w

use strict;

use File::Spec;

use lib '.', File::Spec->catdir( File::Spec->curdir, 't', 'lib' );

use Alzabo::Test::Utils;

use Test::More;


use Alzabo::Runtime;


my @rdbms_names = Alzabo::Test::Utils->rdbms_names;

unless (@rdbms_names)
{
    plan skip_all => 'no test config provided';
    exit;
}

plan tests => 1;


Alzabo::Test::Utils->remove_all_schemas;


# doesn't matter which RDBMS is used
my $rdbms = $rdbms_names[0];

Alzabo::Test::Utils->make_schema($rdbms);

my $config = Alzabo::Test::Utils->test_config_for($rdbms);

my $s = Alzabo::Runtime::Schema->load_from_file( name => $config->{schema_name} );

my $destroy = 0;
sub Alzabo::Runtime::Table::DESTROY { $destroy++ }

{
    my $employee_t = $s->table('employee');

    {
        my $alias1 = $employee_t->alias;
        $alias1->primary_key;
    }

    is( $destroy, 1, 'alias should go out of scope' );
}