From: <pau...@us...> - 2007-03-18 13:33:28
|
Revision: 943 http://svn.sourceforge.net/everydevel/?rev=943&view=rev Author: paul_the_nomad Date: 2007-03-16 17:28:24 -0700 (Fri, 16 Mar 2007) Log Message: ----------- FIX: Allow search on title name - bareword 'title' was used. Modified Paths: -------------- trunk/ebase/lib/Everything/Node/Test/node.pm trunk/ebase/lib/Everything/Node/node.pm Property Changed: ---------------- trunk/ebase/ Property changes on: trunk/ebase ___________________________________________________________________ Name: svk:merge - 16c2b9cb-492b-4d64-9535-64d4e875048d:/wip/ebase:949 a6810612-c0f9-0310-9d3e-a9e4af8c5745:/ebase/offline:17930 + 16c2b9cb-492b-4d64-9535-64d4e875048d:/wip/ebase:950 a6810612-c0f9-0310-9d3e-a9e4af8c5745:/ebase/offline:17930 Modified: trunk/ebase/lib/Everything/Node/Test/node.pm =================================================================== --- trunk/ebase/lib/Everything/Node/Test/node.pm 2007-03-17 00:28:00 UTC (rev 942) +++ trunk/ebase/lib/Everything/Node/Test/node.pm 2007-03-17 00:28:24 UTC (rev 943) @@ -189,7 +189,7 @@ 'insert() should return node_id if it is positive already' ); } -sub test_insert_restrict_dupes :Test( 2 ) +sub test_insert_restrict_dupes :Test( 4 ) { my $self = shift; my $node = $self->{node}; @@ -199,7 +199,7 @@ $node->{restrictdupes} = 1; $node->set_true(qw( -hasAccess -restrictTitle -getId )) ->set_always( -getTableArray => [] ); - $db->set_series( -sqlSelect => 1, 0 ) + $db->set_series( sqlSelect => 1, 0 ) ->set_always( -getFields => 'none' ) ->set_always( -now => '' ) ->set_series( -getNode => undef, { DB => $db } ) @@ -209,6 +209,20 @@ is( $node->insert( '' ), 0, 'insert() should return 0 if dupes are restricted and exist' ); + my ($method, $args) = $db->next_call; + + is ($method, 'sqlSelect', '...checks to see whether there are dupes.'); + + is_deeply( + $args, + [ + $db, 'count(*)', + 'node', 'title = ? AND type_nodetype = ?', + '', [ $node->{title}, 1 ] + ], + '...with the right title and id arguments.' + ); + $node->{restrictdupes} = 0; is( $node->insert( '' ), 100, Modified: trunk/ebase/lib/Everything/Node/node.pm =================================================================== --- trunk/ebase/lib/Everything/Node/node.pm 2007-03-17 00:28:00 UTC (rev 942) +++ trunk/ebase/lib/Everything/Node/node.pm 2007-03-17 00:28:24 UTC (rev 943) @@ -72,7 +72,7 @@ my $DUPELIST = $this->{DB} ->sqlSelect( 'count(*)', 'node', 'title = ? AND type_nodetype = ?', - '', [ 'title', $id ] ); + '', [ $this->{title}, $id ] ); # A node of this name already exists and restrict dupes is # on for this nodetype. Don't do anything This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |