From b4b0c7e72d7eaee2fbfc7022022c9698323203dd Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 31 Dec 2009 13:16:41 +0000 Subject: import rt 3.8.7 --- rt/t/api/attribute.t | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 rt/t/api/attribute.t (limited to 'rt/t/api/attribute.t') diff --git a/rt/t/api/attribute.t b/rt/t/api/attribute.t new file mode 100644 index 000000000..cb2626ad8 --- /dev/null +++ b/rt/t/api/attribute.t @@ -0,0 +1,42 @@ + +use strict; +use warnings; +use RT; +use RT::Test tests => 7; + + +{ + +my $user = $RT::SystemUser; +my ($id, $msg) = $user->AddAttribute(Name => 'SavedSearch', Content => { Query => 'Foo'} ); +ok ($id, $msg); +my $attr = RT::Attribute->new($RT::SystemUser); +$attr->Load($id); +is($attr->Name , 'SavedSearch'); +$attr->SetSubValues( Format => 'baz'); + +my $format = $attr->SubValue('Format'); +is ($format , 'baz'); + +$attr->SetSubValues( Format => 'bar'); +$format = $attr->SubValue('Format'); +is ($format , 'bar'); + +$attr->DeleteAllSubValues(); +$format = $attr->SubValue('Format'); +is ($format, undef); + +$attr->SetSubValues(Format => 'This is a format'); + +my $attr2 = RT::Attribute->new($RT::SystemUser); +$attr2->Load($id); +is ($attr2->SubValue('Format'), 'This is a format'); +$attr2->Delete; +my $attr3 = RT::Attribute->new($RT::SystemUser); +($id) = $attr3->Load($id); +is ($id, 0); + + +} + +1; -- cgit v1.2.1