From: <chr...@us...> - 2006-05-15 21:24:55
|
Revision: 862 Author: chromatic Date: 2006-05-15 14:24:46 -0700 (Mon, 15 May 2006) ViewCVS: http://svn.sourceforge.net/everydevel/?rev=862&view=rev Log Message: ----------- r16712@windwheel: chromatic | 2006-05-15 14:24:25 -0700 Ported the nodemethod tests to the new form. Modified Paths: -------------- trunk/ebase/MANIFEST trunk/ebase/t/Node/nodemethod.t Added Paths: ----------- trunk/ebase/lib/Everything/Node/Test/nodemethod.pm Property Changed: ---------------- trunk/ebase/ Property changes on: trunk/ebase ___________________________________________________________________ Name: svk:merge - a6810612-c0f9-0310-9d3e-a9e4af8c5745:/ebase/offline:16711 + a6810612-c0f9-0310-9d3e-a9e4af8c5745:/ebase/offline:16712 Modified: trunk/ebase/MANIFEST =================================================================== --- trunk/ebase/MANIFEST 2006-05-15 21:24:36 UTC (rev 861) +++ trunk/ebase/MANIFEST 2006-05-15 21:24:46 UTC (rev 862) @@ -93,9 +93,10 @@ lib/Everything/Node/Test/location.pm lib/Everything/Node/Test/mail.pm lib/Everything/Node/Test/node.pm -lib/Everything/Node/Test/nodelet.pm lib/Everything/Node/Test/nodeball.pm lib/Everything/Node/Test/nodegroup.pm +lib/Everything/Node/Test/nodelet.pm +lib/Everything/Node/Test/nodemethod.pm lib/Everything/Node/Test/nodetype.pm lib/Everything/Node/Test/restricted_superdoc.pm lib/Everything/Node/Test/superdoc.pm Added: trunk/ebase/lib/Everything/Node/Test/nodemethod.pm =================================================================== --- trunk/ebase/lib/Everything/Node/Test/nodemethod.pm (rev 0) +++ trunk/ebase/lib/Everything/Node/Test/nodemethod.pm 2006-05-15 21:24:46 UTC (rev 862) @@ -0,0 +1,30 @@ +package Everything::Node::Test::nodemethod; + +use strict; +use warnings; + +use base 'Everything::Node::Test::node'; +use Test::More; + +sub test_dbtables :Test( 2 ) +{ + my $self = shift; + my $class = $self->node_class(); + + can_ok( $class, 'dbtables' ); + + my @tables = $class->dbtables(); + is_deeply( \@tables, [qw( nodemethod node )], + 'dbtables() should return node tables' ); +} + +sub test_get_identifying_fields :Test( 1 ) +{ + my $self = shift; + my $node = $self->{node}; + + is_deeply( $node->getIdentifyingFields(), [ 'supports_nodetype' ], + 'getIdentifyingFields() should report "supports_nodetype"' ); +} + +1; Property changes on: trunk/ebase/lib/Everything/Node/Test/nodemethod.pm ___________________________________________________________________ Name: svn:mime-type + text/plain; charset=UTF-8 Name: svn:eol-style + native Modified: trunk/ebase/t/Node/nodemethod.t =================================================================== --- trunk/ebase/t/Node/nodemethod.t 2006-05-15 21:24:36 UTC (rev 861) +++ trunk/ebase/t/Node/nodemethod.t 2006-05-15 21:24:46 UTC (rev 862) @@ -1,61 +1,4 @@ -#!/usr/bin/perl +#! perl -use strict; -use warnings; - -BEGIN -{ - chdir 't' if -d 't'; - use lib 'lib'; -} - -use FakeNode; -use Test::More tests => 12; - -my $module = 'Everything::Node::nodemethod'; -use_ok( $module ) or exit; - -ok( $module->isa( 'Everything::Node::node' ), 'nodemethod should extend node' ); - -ok( $INC{'Everything/Node.pm'}, - 'Everything::Node::nodemethod should use Everything::Node' -); - -can_ok( $module, 'dbtables' ); -my @tables = $module->dbtables(); -is_deeply( \@tables, [qw( nodemethod node )], - 'dbtables() should return node tables' ); - -is( Everything::Node::nodemethod::getIdentifyingFields()->[0], - 'supports_nodetype', - 'getIdentifyingFields() should report "supports_nodetype"' ); - -my $node = FakeNode->new(); -$node->{DB}{cache} = $node; -$node->{type} = 'type'; - -SKIP: -{ - my @subs = ( - \&Everything::Node::nodemethod::insert, - \&Everything::Node::nodemethod::update, - \&Everything::Node::nodemethod::nuke - ); - - skip( 'insert(), update(), nuke() not defined', 6 ) - unless grep { defined &$_ } @subs; - - foreach my $method (@subs) - { - - $node->{_calls} = []; - $method->($node); - is( $node->{_calls}[0][0], - 'SUPER', '... other methods should call SUPER()' ); - is( - join( ' ', @{ $node->{_calls}[1] } ), - 'incrementGlobalVersion type', - '... and should call incrementGlobalVersion() with type' - ); - } -} +use Everything::Node::Test::nodemethod; +Everything::Node::Test::nodemethod->runtests(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |