root/branches/release-40/t/63-objectclasses.t @ 2562

Revision 2562, 1.5 kB (checked in by bchoate, 18 months ago)

Test suite cleanup. Use MT::Test to force t/ based configuration file for all tests. Fixed several tests that had incorrect expected values.

  • Property svn:keywords set to Id Revision
Line 
1#!/usr/bin/perl
2
3use strict;
4use lib 't/lib', 'extlib', 'lib';
5use Test::More tests => 11;
6
7use MT::Test;
8my $mt = new MT;
9
10package MT::TestAsset;
11
12our @ISA = qw( MT::Object );
13
14__PACKAGE__->install_properties({
15    column_defs => {
16        id => 'integer not null auto_increment',
17        title => 'string(255)',
18    },
19    primary_key => 'id',
20    class_type => 'file',
21});
22
23package MT::TestAsset::Image;
24
25our @ISA = qw( MT::TestAsset );
26
27__PACKAGE__->install_properties({
28    class_type => 'image',
29});
30
31package MT::TestAsset::Audio;
32
33our @ISA = qw( MT::TestAsset );
34
35__PACKAGE__->install_properties({
36    column_defs => {
37        duration => 'integer',
38    },
39    class_type => 'audio',
40});
41
42package main;
43
44my $file = new MT::TestAsset;
45my $image = new MT::TestAsset::Image;
46my $audio = new MT::TestAsset::Audio;
47
48ok($file->has_column('title'), 'file has title column');
49ok($image->has_column('title'), 'image has title column');
50ok($audio->has_column('title'), 'audio has title column');
51ok(!$file->has_column('duration'), 'file doesn\'t have column duration');
52ok(!$image->has_column('duration'), 'image doesn\'t have column duration');
53ok($audio->has_column('duration'), 'audio has column duration');
54ok($file->class_type eq 'file', 'file class_type is file');
55ok($image->class_type eq 'image', 'image class_type is image');
56ok($audio->class_type eq 'audio', 'audio class_type is audio');
57ok(MT::TestAsset->class_type eq 'file', 'generic asset class_type is file');
58ok(MT::TestAsset::Image->class_type eq 'image', 'generic image asset class type is image');
Note: See TracBrowser for help on using the browser.