summaryrefslogtreecommitdiff
path: root/rt/t/api/config.t
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-04-24 11:35:56 -0700
committerIvan Kohler <ivan@freeside.biz>2012-04-24 11:35:56 -0700
commit6587f6ba7d047ddc1686c080090afe7d53365bd4 (patch)
treeec77342668e8865aca669c9b4736e84e3077b523 /rt/t/api/config.t
parent47153aae5c2fc00316654e7277fccd45f72ff611 (diff)
first pass RT4 merge, RT#13852
Diffstat (limited to 'rt/t/api/config.t')
-rw-r--r--rt/t/api/config.t33
1 files changed, 33 insertions, 0 deletions
diff --git a/rt/t/api/config.t b/rt/t/api/config.t
new file mode 100644
index 000000000..a986c3c4f
--- /dev/null
+++ b/rt/t/api/config.t
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+use RT;
+use RT::Test nodb => 1, tests => 9;
+
+ok(
+ RT::Config->AddOption(
+ Name => 'foo',
+ Section => 'bar',
+ ),
+ 'added option foo'
+);
+
+my $meta = RT::Config->Meta('foo');
+is( $meta->{Section}, 'bar', 'Section is bar' );
+is( $meta->{Widget}, '/Widgets/Form/String', 'default Widget is string' );
+is_deeply( $meta->{WidgetArguments},
+ {},, 'default WidgetArguments is empty hashref' );
+
+ok(
+ RT::Config->UpdateOption(
+ Name => 'foo',
+ Section => 'baz',
+ Widget => '/Widgets/Form/Boolean',
+ ),
+ 'updated option foo to section baz'
+);
+is( $meta->{Section}, 'baz', 'section is updated to baz' );
+is( $meta->{Widget}, '/Widgets/Form/Boolean', 'widget is updated to boolean' );
+
+ok( RT::Config->DeleteOption( Name => 'foo' ), 'removed option foo' );
+is( RT::Config->Meta('foo'), undef, 'foo is indeed deleted' );
+