[Rt-commit] rt branch, 5.0/set-lifecycle-from-invalid-to-default, updated. rt-5.0.0-70-g9a1b222e08
? sunnavy
sunnavy at bestpractical.com
Fri Oct 30 17:52:54 EDT 2020
The branch, 5.0/set-lifecycle-from-invalid-to-default has been updated
via 9a1b222e0880e425509711d6b46ac5be3ffa357e (commit)
from 91f0e389e973ec1ee83d8a2a7935d4429d18b380 (commit)
Summary of changes:
t/web/admin_queue_lifecycle.t | 45 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
- Log -----------------------------------------------------------------
commit 9a1b222e0880e425509711d6b46ac5be3ffa357e
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Oct 31 05:51:05 2020 +0800
Test setting lifecycle from an invalid value to default on queue admin page
diff --git a/t/web/admin_queue_lifecycle.t b/t/web/admin_queue_lifecycle.t
index 6b84012833..82b0886607 100644
--- a/t/web/admin_queue_lifecycle.t
+++ b/t/web/admin_queue_lifecycle.t
@@ -1,7 +1,8 @@
use strict;
use warnings;
-use RT::Test tests => 13;
+use RT::Test tests => undef;
+use Test::Warn;
my $lifecycles = RT->Config->Get('Lifecycles');
RT->Config->Set( Lifecycles => %{$lifecycles},
@@ -47,3 +48,45 @@ $lifecycle_input = $form->find_input('Lifecycle');
is( $lifecycle_input->value, 'default',
'lifecycle is changed back to default' );
+RT::Test->stop_server;
+RT->Config->Set(
+ Lifecycles => %{$lifecycles},
+ foo => {
+ initial => ['initial'],
+ active => ['open'],
+ inactive => ['resolved'],
+ },
+ bar => {
+ initial => ['initial'],
+ active => ['open'],
+ inactive => ['resolved'],
+ },
+);
+RT::Lifecycle->FillCache();
+
+( $url, $m ) = RT::Test->started_ok;
+ok( $m->login(), 'logged in' );
+$m->get_ok( $url . '/Admin/Queues/Modify.html?id=1' );
+$form = $m->form_name('ModifyQueue');
+$m->submit_form( fields => { Lifecycle => 'bar' }, );
+$m->text_contains(q{Lifecycle changed from "default" to "bar"});
+$lifecycle_input = $form->find_input('Lifecycle');
+is( $lifecycle_input->value, 'bar', 'lifecycle is changed to bar' );
+
+RT::Test->stop_server;
+RT->Config->Set( Lifecycles => %$lifecycles );
+warning_like {
+ RT::Lifecycle->FillCache();
+} qr/Lifecycle bar is missing in %Lifecycles config/;
+
+( $url, $m ) = RT::Test->started_ok;
+ok( $m->login(), 'logged in' );
+$m->get_ok( $url . '/Admin/Queues/Modify.html?id=1' );
+$m->warning_like(qr/Unable to load lifecycle for bar/, 'warning of missing lifecycle bar');
+$form = $m->form_name('ModifyQueue');
+$m->submit_form( fields => { Lifecycle => 'default' }, );
+$m->text_contains(q{Lifecycle changed from "bar" to "default"});
+$lifecycle_input = $form->find_input('Lifecycle');
+is( $lifecycle_input->value, 'default', 'lifecycle is changed to default' );
+
+done_testing;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list