[Jifty-commit] r4004 - in apps/CASPlus/trunk: lib/CASPlus t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Aug 29 12:50:19 EDT 2007
Author: sterling
Date: Wed Aug 29 12:50:19 2007
New Revision: 4004
Modified:
apps/CASPlus/trunk/ (props changed)
apps/CASPlus/trunk/lib/CASPlus/ProfileMixin.pm
apps/CASPlus/trunk/t/40-many-to-one_relationships-explicit.t
Log:
r11046 at riddle: andrew | 2007-08-29 11:48:02 -0500
Finished many-parent/single-child relationship role calculation testing.
Modified: apps/CASPlus/trunk/lib/CASPlus/ProfileMixin.pm
==============================================================================
--- apps/CASPlus/trunk/lib/CASPlus/ProfileMixin.pm (original)
+++ apps/CASPlus/trunk/lib/CASPlus/ProfileMixin.pm Wed Aug 29 12:50:19 2007
@@ -137,7 +137,7 @@
);
if (looks_like_number($new_value)) {
- my $object = $relationship->relation_child->record_class->new;
+ my $object = $relationship->relation_parent->record_class->new;
$object->load($new_value);
$new_value = $object;
}
@@ -196,7 +196,7 @@
my $new_value = $args->{value};
my $old_value = delete $self->{"__set_${column}_relationship_old"};
- Test::More::diag("self = @{[$self->id.'/'.$self->unique_id]}");
+# Test::More::diag("self = @{[$self->id.'/'.$self->unique_id]}");
my $profile = CASPlus::Model::Profile->new;
$profile->load_by_profile_object($self);
@@ -214,12 +214,12 @@
);
if (looks_like_number($new_value)) {
- my $object = $relationship->relation_parent->record_class->new;
+ my $object = $relationship->relation_child->record_class->new;
$object->load($new_value);
$new_value = $object;
}
- Test::More::diag("new_value = @{[$new_value->id.'/'.$new_value->unique_id]}");
+# Test::More::diag("new_value = @{[$new_value->id.'/'.$new_value->unique_id]}");
if (defined $old_value and $old_value->id) {
# Test::More::diag("PARENT DEL :@{[$self->unique_id]}:\@@{[$relationship->id]}:@{[$old_value->unique_id]}:");
Modified: apps/CASPlus/trunk/t/40-many-to-one_relationships-explicit.t
==============================================================================
--- apps/CASPlus/trunk/t/40-many-to-one_relationships-explicit.t (original)
+++ apps/CASPlus/trunk/t/40-many-to-one_relationships-explicit.t Wed Aug 29 12:50:19 2007
@@ -3,7 +3,7 @@
use warnings;
use List::Util qw/ sum /;
-use Jifty::Test tests => 128;
+use Jifty::Test tests => 129;
my $system_user = CASPlus::CurrentUser->superuser;
@@ -232,6 +232,12 @@
# Create the relationships
+#my $tcache_paths = CASPlus::Model::RoleMemberPathCacheCollection->new(current_user => $system_user);
+#$tcache_paths->unlimit;
+#while (my $path_cache = $tcache_paths->next) {
+# diag($path_cache->cache_path);
+#}
+
{ # user-2 - first <other> relationshifirstp
my $user_obj = $user_class->new(current_user => $system_user);
$user_obj->load(2);
@@ -241,9 +247,6 @@
$other_obj->load(1);
ok($other_obj->id, 'loaded first <other>');
- is($user_obj->unique_id, 5);
- is($other_obj->unique_id, 4);
-
$other_obj->set_my_user($user_obj);
$other_obj->load(1);
@@ -555,12 +558,12 @@
my %user_results = (
1 => {
- roles => [ 1, 2, 3 ],
- perms => [ 1, 2, 3, 4, 5, 6, 7 ],
+ roles => [ ],
+ perms => [ ],
},
2 => {
- roles => [ 2, 4 ],
- perms => [ 2, 3, 4, 8, 9, 10 ],
+ roles => [ ],
+ perms => [ ],
},
3 => {
roles => [ 1, 2, 3, 4 ],
@@ -574,7 +577,6 @@
my %role_members = (
'' => [
- ':5:@2:4:',
':4:@4:3:',
':10:@2:6:',
':2:@3:7:',
@@ -582,24 +584,16 @@
':8:@2:4:',
':2:@3:3:',
],
- 1 => [
- ':5:@2:4:@4:3:',
- ],
+ 1 => [ ],
2 => [
':8:@1:2:',
],
3 => [
':8:@1:2:@3:7:',
],
- 4 => [
- ':5:@2:4:@4:9:',
- ],
- 5 => [
- ':1:@1:2:',
- ],
- 6 => [
- ':1:@1:2:@3:7:',
- ],
+ 4 => [ ],
+ 5 => [ ],
+ 6 => [ ],
7 => [
':8:@2:4:@4:3:',
':8:@1:2:@3:3:',
@@ -607,9 +601,7 @@
8 => [
':8:@2:4:@4:9:',
],
- 9 => [
- ':1:@1:2:@3:3:',
- ],
+ 9 => [ ],
);
# Run the tests on the role cache built on-the-fly
@@ -621,9 +613,9 @@
$cache_paths->unlimit;
is($cache_paths->count_all, (sum map { scalar @$_ } values %role_members), 'there are the right number of cache paths');
-while (my $path_cache = $cache_paths->next) {
- diag($path_cache->cache_path);
-}
+#while (my $path_cache = $cache_paths->next) {
+# diag($path_cache->cache_path);
+#}
my $profiles = CASPlus::Model::ProfileCollection->new(current_user => $system_user);
$profiles->unlimit;
More information about the Jifty-commit
mailing list