[Rt-commit] [svn] r988 - in experiments/Bamboo: .
lib/Bamboo/Controller t
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Mon May 31 23:08:20 EDT 2004
Author: jesse
Date: Mon May 31 23:08:20 2004
New Revision: 988
Modified:
experiments/Bamboo/ (props changed)
experiments/Bamboo/lib/Bamboo/Controller/MethodCollection.pm
experiments/Bamboo/t/1basicparse.t
Log:
----------------------------------------------------------------------
r1667 at debian: jesse | 2004-05-25T12:21:43.859517Z
----------------------------------------------------------------------
r1745 at debian: jesse | 2004-06-01T12:11:35.224638Z
Added new monikers stuff
----------------------------------------------------------------------
Modified: experiments/Bamboo/lib/Bamboo/Controller/MethodCollection.pm
==============================================================================
--- experiments/Bamboo/lib/Bamboo/Controller/MethodCollection.pm (original)
+++ experiments/Bamboo/lib/Bamboo/Controller/MethodCollection.pm Mon May 31 23:08:20 2004
@@ -18,6 +18,19 @@
return $self;
}
+sub get_monikers {
+ my $self = shift;
+ my $type = shift;
+ my @monikers;
+ foreach my $method (keys %{$self->methods}) {
+ if ($method =~ /^(.*?)-(.*)$/){
+ push @monikers, $2 if ($1 eq $type);
+ }
+ }
+
+ return @monikers;
+}
+
sub get {
my $self = shift;
Modified: experiments/Bamboo/t/1basicparse.t
==============================================================================
--- experiments/Bamboo/t/1basicparse.t (original)
+++ experiments/Bamboo/t/1basicparse.t Mon May 31 23:08:20 2004
@@ -13,12 +13,11 @@
sub SetStatus {
my $self = shift;
- die "Tried to set the status to ". shift ." for ". $self->{id};
+ $self->{Status} = shift;
}
package main;
-
use Test::More qw/no_plan/;
use YAML qw/Dump/;
@@ -31,20 +30,37 @@
);
-
my $controller = Bamboo::Controller->new();
-is(ref($controller), 'Bamboo::Controller');
+
+is( ref($controller), 'Bamboo::Controller' );
+
$controller->parse_param_hash(%basic_test);
-is(ref($controller->objects), 'Bamboo::Controller::ObjectCollection');
-my @objects =$controller->objects->as_array;
-is ($#objects, 1);
-my @methods = $objects[0]->methods->as_array;
-is ($#methods,0);
-my @params = $methods[0]->params->names;
+is( ref( $controller->objects ), 'Bamboo::Controller::ObjectCollection' );
+
+my @objects = $controller->objects->as_array;
+is( $#objects, 1 );
+
+# Get the object for Ticket 23;
+my $ticket_23 = $controller->objects->get( RT::MockTicket => 23 );
+is( ref($ticket_23), 'Bamboo::Controller::Object' );
+
+my @methods = $ticket_23->methods->as_array;
+
+is( $#methods, 0 );
+
+my @setstatus_monikers = $ticket_23->methods->get_monikers('SetStatus');
+
+is( $#setstatus_monikers, 0 );
+my $moniker = shift @setstatus_monikers;
+is( $moniker, 'ss1' );
+my $method_set_status = $ticket_23->methods->get( 'SetStatus', $moniker );
+is( ref($method_set_status), 'Bamboo::Controller::Method' );
+
+my @params = $method_set_status->params->names;
-is($#params,0);
+is( $#params, 0 );
-is ($methods[0]->params->get($params[0]), 'stalled');
+is( $method_set_status->params->get( $params[0] ), 'open' );
$controller->process_method_calls();
More information about the Rt-commit
mailing list