comparison _test/Test/ORM/Schema.pm @ 38:d660fb38b7cc

small fixes ORM shema to SQL schema transformation
author Sergey
date Mon, 23 Nov 2009 17:57:07 +0300
parents d59526f6310e
children 32d2350fccf9
comparison
equal deleted inserted replaced
37:c2e7f7c96bcd 38:d660fb38b7cc
4 use base qw(IMPL::Test::Unit); 4 use base qw(IMPL::Test::Unit);
5 5
6 __PACKAGE__->PassThroughArgs; 6 __PACKAGE__->PassThroughArgs;
7 7
8 use IMPL::Test qw(test failed); 8 use IMPL::Test qw(test failed);
9
10 require IMPL::ORM::Schema::TransformToSQL;
9 11
10 test ExtractClassSchema => sub { 12 test ExtractClassSchema => sub {
11 my ($this) = @_; 13 my ($this) = @_;
12 14
13 my $schema = Test::ORM::Schema::Data::User->ormGetSchema('Test::ORM::Schema::Data'); 15 my $schema = Test::ORM::Schema::Data::User->ormGetSchema('Test::ORM::Schema::Data');
20 my ($this) = @_; 22 my ($this) = @_;
21 23
22 my $schema = Test::ORM::Schema::Data->instance; 24 my $schema = Test::ORM::Schema::Data->instance;
23 25
24 return 1; 26 return 1;
27 };
28
29 test TransformDataSchema => sub {
30 my $sqlSchema = IMPL::ORM::Schema::TransformToSQL->Std->Transform(Test::ORM::Schema::Data->instance)
31 or failed("Failed to transform a schema");
32 $sqlSchema->Dispose;
25 }; 33 };
26 34
27 35
28 package Test::ORM::Schema::Data::User; 36 package Test::ORM::Schema::Data::User;
29 use base qw(IMPL::ORM::Object); 37 use base qw(IMPL::ORM::Object);
57 65
58 package Test::ORM::Schema::Data; 66 package Test::ORM::Schema::Data;
59 use base qw(IMPL::ORM::Schema); 67 use base qw(IMPL::ORM::Schema);
60 68
61 __PACKAGE__->ValueTypes ( 69 __PACKAGE__->ValueTypes (
62 'String' => 'IMPL::ORM::Value::String', 70 String => 'IMPL::ORM::Value::String',
63 'DateTime' => 'IMPL::ORM::Value::DateTime', 71 DateTime => 'IMPL::ORM::Value::DateTime',
64 'Integer' => 'IMPL::ORM::Value::Inetger', 72 Integer => 'IMPL::ORM::Value::Inetger',
65 'Float' => 'IMPL::ORM::Value::Float', 73 Float => 'IMPL::ORM::Value::Float',
66 'Decimal' => 'IMPL::ORM::Value::Decimal' 74 Decimal => 'IMPL::ORM::Value::Decimal'
67 ); 75 );
68 76
69 __PACKAGE__->usePrefix(__PACKAGE__); 77 __PACKAGE__->usePrefix(__PACKAGE__);
70 __PACKAGE__->Classes qw( 78 __PACKAGE__->Classes qw(
71 User 79 User