[Rt-commit] r4363 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Sun Dec 25 04:09:57 EST 2005
Author: ruz
Date: Sun Dec 25 03:20:51 2005
New Revision: 4363
Added:
rt/branches/3.7-EXPERIMENTAL/lib/t/regression/15cf_external.t
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
Log:
r1585 at cubic-pc: cubic | 2005-12-25 11:23:41 +0300
r1575 at cubic-pc: cubic | 2005-12-25 11:22:05 +0300
* CF external tests
Added: rt/branches/3.7-EXPERIMENTAL/lib/t/regression/15cf_external.t
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL/lib/t/regression/15cf_external.t Sun Dec 25 03:20:51 2005
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Test::More qw(no_plan);
+
+use RT;
+RT::LoadConfig();
+RT::Init();
+
+sub new (*) {
+ my $class = shift;
+ return $class->new($RT::SystemUser);
+}
+
+use constant VALUES_CLASS => 'RT::CustomFieldValues::Groups';
+
+my $q = new( RT::Queue );
+isa_ok( $q, 'RT::Queue' );
+my ($qid) = $q->Create( Name => "CF-External-". $$ );
+ok( $qid, "created queue" );
+my %arg = ( Name => $q->Name,
+ Type => 'Select',
+ Queue => $q->id,
+ MaxValues => 1,
+ ValuesClass => VALUES_CLASS );
+
+my $cf = new( RT::CustomField );
+isa_ok( $cf, 'RT::CustomField' );
+
+{
+ my ($cfid) = $cf->Create( %arg );
+ ok( $cfid, "created cf" );
+ is( $cf->ValuesClass, VALUES_CLASS, "right values class" );
+ ok( $cf->IsExternalValues, "custom field has external values" );
+}
+
+{
+ my $values = $cf->Values;
+ isa_ok( $values, VALUES_CLASS );
+ ok( $values->Count, "we have values" );
+ my ($failure, $count) = (0, 0);
+ while( my $value = $values->Next ) {
+ $count++;
+ $failure = 1 unless $value->Name;
+ }
+ ok( !$failure, "all values have name" );
+ is( $values->Count, $count, "count is correct" );
+}
+
+exit(0);
More information about the Rt-commit
mailing list