@@ -11,7 +11,11 @@ public function testQualifyUser()
1111 $ pi_group = $ USER ->getPIGroup ();
1212 $ this ->switchUser ("Blank " );
1313 $ user = $ USER ;
14- $ expectedOutput = ["added " => [$ user ->uid ], "removed " => []];
14+ $ expectedOutput = [
15+ "added " => [$ user ->uid ],
16+ "removed " => [],
17+ "not removed (non-native) " => [],
18+ ];
1519 try {
1620 $ pi_group_entry = $ LDAP ->getPIGroupEntry ($ pi_group ->gid );
1721 $ pi_group_entry ->appendAttribute ("memberuid " , $ user ->uid );
@@ -36,7 +40,11 @@ public function testDisqualifyUser()
3640 {
3741 global $ USER , $ LDAP , $ SQL , $ MAILER , $ WEBHOOK ;
3842 $ this ->switchUser ("Blank " );
39- $ expectedOutput = ["added " => [], "removed " => [$ USER ->uid ]];
43+ $ expectedOutput = [
44+ "added " => [],
45+ "removed " => [$ USER ->uid ],
46+ "not removed (non-native) " => [],
47+ ];
4048 try {
4149 $ qualified_user_group = $ LDAP ->userFlagGroups ["qualified " ];
4250 $ qualified_user_group ->addMemberUID ($ USER ->uid );
@@ -54,4 +62,33 @@ public function testDisqualifyUser()
5462 }
5563 }
5664 }
65+
66+ public function testIgnoreNonNativeUser ()
67+ {
68+ global $ USER , $ LDAP , $ SQL , $ MAILER , $ WEBHOOK ;
69+ $ this ->switchUser ("Blank " );
70+ $ expectedOutput = [
71+ "added " => [],
72+ "removed " => [],
73+ "not removed (non-native) " => ["non_native_user1 " ],
74+ ];
75+ try {
76+ $ qualified_user_group = $ LDAP ->userFlagGroups ["qualified " ];
77+ $ qualified_user_group ->addMemberUID ("non_native_user1 " );
78+ [$ _ , $ output_lines ] = executeWorker ("update-qualified-users-group.php " );
79+ $ output_str = implode ("\n" , $ output_lines );
80+ $ output = jsonDecode ($ output_str , associative: true );
81+ $ this ->assertEquals ($ expectedOutput , $ output );
82+ // refresh LDAP to pick up changes from subprocess
83+ unset($ GLOBALS ["ldapconn " ]);
84+ $ this ->switchUser ("Blank " );
85+ $ this ->assertTrue (
86+ $ LDAP ->userFlagGroups ["qualified " ]->memberUIDExists ("non_native_user1 " ),
87+ );
88+ } finally {
89+ if ($ LDAP ->userFlagGroups ["qualified " ]->memberUIDExists ("non_native_user1 " )) {
90+ $ LDAP ->userFlagGroups ["qualified " ]->removeMemberUID ("non_native_user1 " );
91+ }
92+ }
93+ }
5794}
0 commit comments