Dunning: Email und Zahlungsbedingung in Mahnlaufbericht aufgenommen
[kivitendo-erp.git] / t / auth / evaluate_rights_ary.t
1 use strict;
2
3 use Test::More;
4
5 use lib 't';
6 use Support::TestSetup;
7
8 Support::TestSetup::login();
9
10 use_ok 'SL::Auth';
11
12 ok( SL::Auth::evaluate_rights_ary(['1']), 'simple: right');
13 ok(!SL::Auth::evaluate_rights_ary(['0']), 'simple: no right');
14 ok( SL::Auth::evaluate_rights_ary(['1', '|', 0]), 'simple: or');
15 ok( SL::Auth::evaluate_rights_ary(['0', '|', '1']), 'simple: or 2');
16 ok(!SL::Auth::evaluate_rights_ary(['1', '&', '0']), 'simple: and');
17 ok(!SL::Auth::evaluate_rights_ary(['0', '&', '1']), 'simple: and 2');
18 ok( SL::Auth::evaluate_rights_ary(['1', '&', '1']), 'simple: and 3');
19 ok(!SL::Auth::evaluate_rights_ary(['!', '1']), 'simple: not');
20 ok( SL::Auth::evaluate_rights_ary(['!', '0']), 'simple: not 2');
21 ok(!SL::Auth::evaluate_rights_ary(['!', '!', '0']), 'simple: double not');
22 ok( SL::Auth::evaluate_rights_ary(['!', ['0']]), 'not 1');
23 ok(!SL::Auth::evaluate_rights_ary(['!', ['1']]), 'not 2');
24 ok( SL::Auth::evaluate_rights_ary(['!', '!', ['1']]), 'double not');
25 ok( SL::Auth::evaluate_rights_ary([ '!', ['!', ['1', '&', '1'], '&', '!', '!', ['1', '|', '!', '1']] ]), 'something more coplex');
26
27 done_testing;
28
29 1;