Skip to content

Commit 4a34ed0

Browse files
committed
Fixing Bad Request response for term group creation.
1 parent 450b861 commit 4a34ed0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/presenters/GroupsPresenter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ private function isGroupSuitableForTerm(array $groups, string $groupId, string $
6363

6464
$group = $groups[$groupId];
6565
if (!$group->hasCourseAttribute()) {
66-
throw new ForbiddenRequestException("Group $groupId does not have any course attributes.");
66+
throw new BadRequestException("Group $groupId does not have any course attributes.");
6767
}
6868
if ($group->hasTermAttribute()) {
69-
throw new ForbiddenRequestException("Group $groupId have term attributes.");
69+
throw new BadRequestException("Group $groupId have term attributes.");
7070
}
7171

7272
foreach ($groups as $group) {
7373
if ($group->parentGroupId === $groupId && $group->hasTermAttribute($term)) {
74-
throw new ForbiddenRequestException(
74+
throw new BadRequestException(
7575
"One of the children of group $groupId already have associated term $term."
7676
);
7777
}

tests/Presenters/GroupsPresenter.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ class TestGroupsPresenter extends Tester\TestCase
903903
['action' => 'createTerm', 'parentId' => 'c1', 'term' => '2025-1'],
904904
['texts' => $texts]
905905
);
906-
}, ForbiddenRequestException::class);
906+
}, BadRequestException::class);
907907
}
908908

909909
public function testCreateTermGroupAlreadyExist()
@@ -938,7 +938,7 @@ class TestGroupsPresenter extends Tester\TestCase
938938
['action' => 'createTerm', 'parentId' => 'c1', 'term' => '2025-1'],
939939
['texts' => $texts]
940940
);
941-
}, ForbiddenRequestException::class);
941+
}, BadRequestException::class);
942942
}
943943

944944
public function testAddAttribute()

0 commit comments

Comments
 (0)