X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=t%2Fauth%2Fevaluate_rights_ary.t;fp=t%2Fauth%2Fevaluate_rights_ary.t;h=7203d0a7679988ce76534ccf3b7af6be97721157;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hp=0000000000000000000000000000000000000000;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44;p=kivitendo-erp.git diff --git a/t/auth/evaluate_rights_ary.t b/t/auth/evaluate_rights_ary.t new file mode 100644 index 000000000..7203d0a76 --- /dev/null +++ b/t/auth/evaluate_rights_ary.t @@ -0,0 +1,29 @@ +use strict; + +use Test::More; + +use lib 't'; +use Support::TestSetup; + +Support::TestSetup::login(); + +use_ok 'SL::Auth'; + +ok( SL::Auth::evaluate_rights_ary(['1']), 'simple: right'); +ok(!SL::Auth::evaluate_rights_ary(['0']), 'simple: no right'); +ok( SL::Auth::evaluate_rights_ary(['1', '|', 0]), 'simple: or'); +ok( SL::Auth::evaluate_rights_ary(['0', '|', '1']), 'simple: or 2'); +ok(!SL::Auth::evaluate_rights_ary(['1', '&', '0']), 'simple: and'); +ok(!SL::Auth::evaluate_rights_ary(['0', '&', '1']), 'simple: and 2'); +ok( SL::Auth::evaluate_rights_ary(['1', '&', '1']), 'simple: and 3'); +ok(!SL::Auth::evaluate_rights_ary(['!', '1']), 'simple: not'); +ok( SL::Auth::evaluate_rights_ary(['!', '0']), 'simple: not 2'); +ok(!SL::Auth::evaluate_rights_ary(['!', '!', '0']), 'simple: double not'); +ok( SL::Auth::evaluate_rights_ary(['!', ['0']]), 'not 1'); +ok(!SL::Auth::evaluate_rights_ary(['!', ['1']]), 'not 2'); +ok( SL::Auth::evaluate_rights_ary(['!', '!', ['1']]), 'double not'); +ok( SL::Auth::evaluate_rights_ary([ '!', ['!', ['1', '&', '1'], '&', '!', '!', ['1', '|', '!', '1']] ]), 'something more coplex'); + +done_testing; + +1;