A test case from Amiri
authorzby <zby@dorotka-pc.(none)>
Sat, 20 Mar 2010 13:56:43 +0000 (14:56 +0100)
committerzby <zby@dorotka-pc.(none)>
Sat, 20 Mar 2010 13:56:43 +0000 (14:56 +0100)
t/lib/DBSchema.pm
t/lib/DBSchema/Result/Personality.pm [new file with mode: 0644]
t/lib/RunTests.pm
t/var/dvdzbr.db

index 9b1dca6c18e353d713d30ed701aff7f391cdcbaa..3d01f23f1bc0260fa26d3c7a9d6487a0c7a100b2 100644 (file)
@@ -25,6 +25,13 @@ sub get_test_schema {
     my $deploy_attrs;
     $deploy_attrs->{add_drop_table} = 1 if tables_exist( $dsn, $user, $pass );
     $schema->deploy( $deploy_attrs );
+    $schema->populate('Personality', [
+        [ qw/user_id / ],
+        [ '1'],
+        [ '2' ],
+        [ '3'],
+        ]
+    );
     $schema->populate('User', [
         [ qw/username name password / ],
         [ 'jgda', 'Jonas Alves', ''],
diff --git a/t/lib/DBSchema/Result/Personality.pm b/t/lib/DBSchema/Result/Personality.pm
new file mode 100644 (file)
index 0000000..3284fa1
--- /dev/null
@@ -0,0 +1,15 @@
+package DBSchema::Result::Personality;
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class';
+
+__PACKAGE__->load_components( "PK::Auto", "Core" );
+__PACKAGE__->table("personality");
+__PACKAGE__->add_columns( "user_id" => { data_type => 'integer' }, );
+__PACKAGE__->set_primary_key("user_id");
+__PACKAGE__->has_one( 'user', 'DBSchema::Result::User', {'user_id' => 'foreign.id'}, );
+
+1;
+
index 53d3c6b174809bbebdf4bfc4fc0dbb844694cefc..88ec1c93808e8c631d3de5cdfe3a5874d04e239e 100644 (file)
@@ -9,7 +9,7 @@ use DBIx::Class::ResultSet::RecursiveUpdate;
 sub run_tests{
     my $schema = shift;
 
-    plan tests => 40;
+    plan tests => 41;
     
     my $dvd_rs = $schema->resultset( 'Dvd' );
     my $user_rs = $schema->resultset( 'User' );
@@ -213,7 +213,15 @@ sub run_tests{
     is( scalar @rel_tags, 2, 'tags related' );
     ok( $rel_tags[0]->file eq 'file0' || $rel_tags[0]->file eq 'file1', 'tags related' );
 
+    my $new_person = {
+        name  => 'Amiri Barksdale',
+        username => 'amiri',
+        password => 'amiri',
+    };
+    ok(my $new_user = $user_rs->recursive_update( $new_person ));
  
+    #print STDERR Dumper $new_user;
+
 #    $updates = {
 #            name => 'Test name 1',
 #    };
index 279e7f719be81ce870561a079e918084717c7698..cf2b20f9fa13dc1f5465d4350678d34e8e6fb566 100644 (file)
Binary files a/t/var/dvdzbr.db and b/t/var/dvdzbr.db differ
This page took 0.022022 seconds and 4 git commands to generate.