Mercurial > pub > Impl
comparison _test/Test/ORM/Schema.pm @ 30:dd4d72600c69
ORM in works
| author | Sergey |
|---|---|
| date | Tue, 03 Nov 2009 16:31:47 +0300 |
| parents | 6d33f75c6e1f |
| children | d59526f6310e |
comparison
equal
deleted
inserted
replaced
| 29:37160f7c8edb | 30:dd4d72600c69 |
|---|---|
| 1 package Test::ORM::Schema; | 1 package Test::ORM::Schema; |
| 2 use strict; | 2 use strict; |
| 3 use warnings; | 3 use warnings; |
| 4 use base qw(IMPL::Test::Unit); | |
| 4 | 5 |
| 5 require Exporter; | 6 __PACKAGE__->PassThroughArgs; |
| 6 our @ISA = qw(Exporter); | 7 |
| 7 our @EXPORT_OK = qw(); | 8 use IMPL::Test qw(test failed); |
| 9 | |
| 10 test ExtractClassSchema => sub { | |
| 11 my ($this) = @_; | |
| 12 | |
| 13 my $schema = Test::ORM::Schema::Data::User->ormGetSchema('Test::ORM::Schema::Data'); | |
| 14 failed "Wrong number of the elements","expected: 4","got: ".$schema->childNodes->Count unless $schema->childNodes->Count == 4; | |
| 15 | |
| 16 return 1; | |
| 17 }; | |
| 18 | |
| 19 test StaticSchema => sub { | |
| 20 my ($this) = @_; | |
| 21 | |
| 22 my $schema = Test::ORM::Schema::Data->instance; | |
| 23 | |
| 24 return 1; | |
| 25 }; | |
| 26 | |
| 8 | 27 |
| 9 package Test::ORM::Schema::Data::User; | 28 package Test::ORM::Schema::Data::User; |
| 10 use base qw(IMPL::ORM::Object); | 29 use base qw(IMPL::ORM::Object); |
| 11 use IMPL::Class::Property; | 30 use IMPL::Class::Property; |
| 12 | 31 |
| 37 } | 56 } |
| 38 | 57 |
| 39 package Test::ORM::Schema::Data; | 58 package Test::ORM::Schema::Data; |
| 40 use base qw(IMPL::ORM::Schema); | 59 use base qw(IMPL::ORM::Schema); |
| 41 | 60 |
| 42 __PACKAGE__->usePrefix(__PACKAGE__); | |
| 43 __PACKAGE__->Classes qw( | |
| 44 User | |
| 45 Role | |
| 46 Session | |
| 47 ); | |
| 48 | |
| 49 __PACKAGE__->ValueTypes ( | 61 __PACKAGE__->ValueTypes ( |
| 50 'String' => 'IMPL::ORM::Value::String', | 62 'String' => 'IMPL::ORM::Value::String', |
| 51 'DateTime' => 'IMPL::ORM::Value::DateTime', | 63 'DateTime' => 'IMPL::ORM::Value::DateTime', |
| 52 'Integer' => 'IMPL::ORM::Value::Inetger', | 64 'Integer' => 'IMPL::ORM::Value::Inetger', |
| 53 'Float' => 'IMPL::ORM::Value::Float', | 65 'Float' => 'IMPL::ORM::Value::Float', |
| 54 'Decimal' => 'IMPL::ORM::Value::Decimal' | 66 'Decimal' => 'IMPL::ORM::Value::Decimal' |
| 55 ); | 67 ); |
| 56 | 68 |
| 69 __PACKAGE__->usePrefix(__PACKAGE__); | |
| 70 __PACKAGE__->Classes qw( | |
| 71 User | |
| 72 Role | |
| 73 Session | |
| 74 ); | |
| 75 | |
| 57 1; | 76 1; |
