From 311dd083d47f66fb455316ddd0e9a85963a0733d Mon Sep 17 00:00:00 2001 From: zby Date: Sat, 20 Mar 2010 14:56:43 +0100 Subject: [PATCH] A test case from Amiri --- t/lib/DBSchema.pm | 7 +++++++ t/lib/DBSchema/Result/Personality.pm | 15 +++++++++++++++ t/lib/RunTests.pm | 10 +++++++++- t/var/dvdzbr.db | Bin 37888 -> 38912 bytes 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 t/lib/DBSchema/Result/Personality.pm diff --git a/t/lib/DBSchema.pm b/t/lib/DBSchema.pm index 9b1dca6..3d01f23 100644 --- a/t/lib/DBSchema.pm +++ b/t/lib/DBSchema.pm @@ -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 index 0000000..3284fa1 --- /dev/null +++ b/t/lib/DBSchema/Result/Personality.pm @@ -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; + diff --git a/t/lib/RunTests.pm b/t/lib/RunTests.pm index 53d3c6b..88ec1c9 100644 --- a/t/lib/RunTests.pm +++ b/t/lib/RunTests.pm @@ -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', # }; diff --git a/t/var/dvdzbr.db b/t/var/dvdzbr.db index 279e7f719be81ce870561a079e918084717c7698..cf2b20f9fa13dc1f5465d4350678d34e8e6fb566 100644 GIT binary patch delta 1109 zcmbu8O>7%Q6vt=gtv88dyLRnllh}gzegpxire5mR?i3 zaSo>7p?Yg7R$)v1z)l)x$2lu6E#k+nmo+u9guiAlv^#nHW_Df>L(lYgf;iqW=iw>| z{G#}qAi$%kOM*1~D3#jrYTlrez0Fknls)Aoeuw`kCd5NXz=!PnE|l)zKvS2iT}C*} zo4JN{zEWJN7i)zna^REHv>+WP(ivEzF5F%jz}*c?i&3|ZRo9E~CiURm>=_`Zj!#{u zwWdzJSlGNN$b~;|R-r_0j2B9oi{$AtqEX)T+v_hEYxU}qRVg>tI=W-&=}dAaW6mT~ zXEJ8T2lI&2G*{|q9gejAj=JN%!%BguvWPMO4L-n7JOuAZFIvUn{b;D<9YUnV|36O1 zsq%5yWvaE=dX@DmbJ|<*Y3HCM(@OgzkdQUBUWjW4^0JN(Ml9aIqpK3+ijE_$H(*^} z#Xlq0AttY3Vd`^G^5f(yH-%io$BVIu131_9j%4kc5z0EwJJ(Kj!3HfC73j2(MH`pA zxQ9!Y{=+3N?cgktlE|OqE#ujmaALc{gN@s zUHm=KD^7^JFbVI&4s&2=^^~rl)Bk-91ZKnM3C2U{J4P| zvnRA>jEp^eG+^VSL51%nK|`tx2a%3xIB<4SP*4qX;G_^v%vWyb!@^!U;c=@i0z7B% Y7yJ&-Tg`=QfTmV;2@p&OWn8d-0MFh+7XSbN delta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