Skip to content

Commit 64c7e1a

Browse files
committed
fix test helper functions
1 parent 4912fa6 commit 64c7e1a

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

test/functional/QualifyUserTest.php

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,31 @@ private function assertRequestedMembership(bool $expected, string $gid)
2323

2424
private function requestGroupCreation()
2525
{
26-
http_post(__DIR__ . "/../../webroot/panel/new_account.php", [
27-
"new_user_sel" => "pi",
28-
"eula" => "agree",
29-
"confirm_pi" => "agree",
30-
]);
26+
http_post(__DIR__ . "/../../webroot/panel/account.php", ["form_type" => "pi_request"]);
3127
}
3228

3329
private function requestGroupMembership(string $gid_or_mail)
3430
{
35-
http_post(__DIR__ . "/../../webroot/panel/new_account.php", [
36-
"new_user_sel" => "not_pi",
37-
"eula" => "agree",
31+
http_post(__DIR__ . "/../../webroot/panel/groups.php", [
32+
"form_type" => "addPIform",
33+
"tos" => "agree",
3834
"pi" => $gid_or_mail,
3935
]);
4036
}
4137

42-
private function cancelAllRequests()
38+
private function cancelRequestGroupMembership($gid)
4339
{
44-
http_post(
45-
__DIR__ . "/../../webroot/panel/new_account.php",
46-
["cancel" => "true"], // value of cancel is arbitrary
47-
);
40+
http_post(__DIR__ . "/../../webroot/panel/groups.php", [
41+
"form_type" => "cancelPIform",
42+
"pi" => $gid,
43+
]);
44+
}
45+
46+
private function cancelRequestGroupCreation()
47+
{
48+
http_post(__DIR__ . "/../../webroot/panel/account.php", [
49+
"form_type" => "cancel_pi_request",
50+
]);
4851
}
4952

5053
private function approveUserByAdmin($gid, $uid)
@@ -103,7 +106,7 @@ public function testQualifyUserByJoinGoupByPI()
103106
// $this->assertTrue($second_request_failed);
104107
$this->assertRequestedMembership(true, $gid);
105108

106-
$this->cancelAllRequests();
109+
$this->cancelRequestGroupMembership($gid);
107110
$this->assertRequestedMembership(false, $gid);
108111

109112
$this->requestGroupMembership($pi_group->gid);
@@ -200,7 +203,7 @@ public function testQualifyUserByJoinGoupByAdmin()
200203
// $this->assertTrue($second_request_failed);
201204
$this->assertRequestedMembership(true, $gid);
202205

203-
$this->cancelAllRequests();
206+
$this->cancelRequestGroupMembership($gid);
204207
$this->assertRequestedMembership(false, $gid);
205208

206209
$this->requestGroupMembership($pi_group->getOwner()->getMail());
@@ -258,7 +261,7 @@ public function testQualifyUserByCreateGroup()
258261
// $this->assertTrue($second_request_failed);
259262
$this->assertRequestedPIGroup(true);
260263

261-
$this->cancelAllRequests();
264+
$this->cancelRequestGroupCreation();
262265
$this->assertRequestedPIGroup(false);
263266

264267
$this->requestGroupCreation();

0 commit comments

Comments
 (0)