diff _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
line wrap: on
line diff
--- a/_test/Test/ORM/Schema.pm	Wed Oct 21 17:30:20 2009 +0400
+++ b/_test/Test/ORM/Schema.pm	Tue Nov 03 16:31:47 2009 +0300
@@ -1,10 +1,29 @@
 package Test::ORM::Schema;
 use strict;
 use warnings;
+use base qw(IMPL::Test::Unit);
 
-require Exporter;
-our @ISA = qw(Exporter);
-our @EXPORT_OK = qw();
+__PACKAGE__->PassThroughArgs;
+
+use IMPL::Test qw(test failed);
+
+test ExtractClassSchema => sub {
+    my ($this) = @_;
+    
+    my $schema = Test::ORM::Schema::Data::User->ormGetSchema('Test::ORM::Schema::Data');
+    failed "Wrong number of the elements","expected: 4","got: ".$schema->childNodes->Count unless $schema->childNodes->Count == 4;
+    
+    return 1;
+};
+
+test StaticSchema => sub {
+    my ($this) = @_;
+    
+    my $schema = Test::ORM::Schema::Data->instance;
+    
+    return 1;
+};
+
 
 package Test::ORM::Schema::Data::User;
 use base qw(IMPL::ORM::Object);
@@ -39,13 +58,6 @@
 package Test::ORM::Schema::Data;
 use base qw(IMPL::ORM::Schema);
 
-__PACKAGE__->usePrefix(__PACKAGE__);
-__PACKAGE__->Classes qw(
-    User
-    Role
-    Session
-);
-
 __PACKAGE__->ValueTypes (
     'String' => 'IMPL::ORM::Value::String',
     'DateTime' => 'IMPL::ORM::Value::DateTime',
@@ -54,4 +66,11 @@
     'Decimal' => 'IMPL::ORM::Value::Decimal'
 );
 
+__PACKAGE__->usePrefix(__PACKAGE__);
+__PACKAGE__->Classes qw(
+    User
+    Role
+    Session
+);
+
 1;