@@ -85,6 +85,16 @@ private function ensureUserDoesNotExist()
8585 }
8686 }
8787
88+ private function ensureOrgGroupDoesNotExist ()
89+ {
90+ global $ USER ;
91+ $ org_group = $ USER ->getOrgGroup ();
92+ if ($ org_group ->exists ()) {
93+ $ org_group ->getLDAPOrgGroup ()->delete ();
94+ assert (!$ org_group ->exists ());
95+ }
96+ }
97+
8898 private function ensureUserNotInPIGroup (UnityGroup $ pi_group )
8999 {
90100 global $ USER ;
@@ -139,6 +149,7 @@ public function testCreateUserByJoinGoup()
139149 $ this ->assertNumberGroupRequests (0 );
140150 $ this ->assertTrue ($ pi_group ->userExists ($ USER ));
141151 $ this ->assertTrue ($ USER ->exists ());
152+ $ this ->assertTrue ($ USER ->getOrgGroup ()->exists ());
142153
143154 // $third_request_failed = false;
144155 // try {
@@ -152,6 +163,7 @@ public function testCreateUserByJoinGoup()
152163 } finally {
153164 $ this ->ensureUserNotInPIGroup ($ pi_group );
154165 $ this ->ensureUserDoesNotExist ();
166+ $ this ->ensureOrgGroupDoesNotExist ();
155167 }
156168 }
157169
@@ -162,6 +174,7 @@ public function testCreateUserByCreateGroup()
162174 $ pi_group = $ USER ->getPIGroup ();
163175 $ this ->assertTrue (!$ USER ->exists ());
164176 $ this ->assertTrue (!$ pi_group ->exists ());
177+ $ this ->assertTrue (!$ USER ->getOrgGroup ()->exists ());
165178 try {
166179 $ this ->requestGroupCreation ();
167180 $ this ->assertNumberGroupRequests (1 );
@@ -185,6 +198,7 @@ public function testCreateUserByCreateGroup()
185198 $ this ->assertNumberGroupRequests (0 );
186199 $ this ->assertTrue ($ pi_group ->exists ());
187200 $ this ->assertTrue ($ USER ->exists ());
201+ $ this ->assertTrue ($ USER ->getOrgGroup ()->exists ());
188202
189203 // $third_request_failed = false;
190204 // try {
@@ -197,6 +211,7 @@ public function testCreateUserByCreateGroup()
197211 } finally {
198212 $ this ->ensurePIGroupDoesNotExist ();
199213 $ this ->ensureUserDoesNotExist ();
214+ $ this ->ensureOrgGroupDoesNotExist ();
200215 }
201216 }
202217}
0 commit comments