Skip to content

Commit 6ed95ff

Browse files
committed
minor changes (remove comments & obsolete tests)
1 parent 83fdddc commit 6ed95ff

File tree

5 files changed

+5
-139
lines changed

5 files changed

+5
-139
lines changed

api/fixtures/contentTypes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ App\Entity\ContentType:
2727
name: 'LAThematicArea'
2828
active: true
2929
entityClass: 'App\Entity\ContentNode\MultiSelect'
30-
jsonConfig: { items: [ 'outdoorTechnique', 'security', 'natureAndEnvironment' ] }
30+
jsonConfig: { items: [ 'option1', 'option2', 'option3' ] }

api/src/Entity/ContentNode/MultiSelectOption.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@
2525
'get' => [
2626
'security' => 'is_fully_authenticated()',
2727
],
28-
// 'post' => creating new options is not allowed
2928
],
3029
itemOperations: [
3130
'get' => ['security' => 'is_granted("CAMP_COLLABORATOR", object) or is_granted("CAMP_IS_PROTOTYPE", object)'],
3231
'patch' => [
3332
'denormalization_context' => ['groups' => ['write', 'update']],
3433
'security' => 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
3534
],
36-
// 'delete' => deleting single option is not allowed
3735
],
3836
denormalizationContext: ['groups' => ['write']],
3937
normalizationContext: ['groups' => ['read']],

api/tests/Api/ContentNodes/MultiSelect/CreateMultiSelectTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ public function testCreateMultiSelectCopiesOptionsFromContentType() {
2828
'_embedded' => [
2929
'options' => [
3030
[
31-
'translateKey' => 'outdoorTechnique',
31+
'translateKey' => 'option1',
3232
'checked' => false,
3333
'pos' => 0,
3434
],
3535
[
36-
'translateKey' => 'security',
36+
'translateKey' => 'option2',
3737
'checked' => false,
3838
'pos' => 1,
3939
],
4040
[
41-
'translateKey' => 'natureAndEnvironment',
41+
'translateKey' => 'option3',
4242
'checked' => false,
4343
'pos' => 2,
4444
],

api/tests/Api/ContentNodes/MultiSelect/Option/CreateMultiSelectOptionTest.php

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -29,90 +29,6 @@ public function testCreateMethodIsNotAllowed() {
2929
$this->assertResponseStatusCodeSame(405);
3030
}
3131

32-
// Standard security checks.
33-
34-
/*
35-
public function testCreateIsDeniedForAnonymousUser() {
36-
static::createBasicClient()->request('POST', $this->endpoint, ['json' => $this->getExampleWritePayload()]);
37-
$this->assertResponseStatusCodeSame(401);
38-
$this->assertJsonContains([
39-
'code' => 401,
40-
'message' => 'JWT Token not found',
41-
]);
42-
}
43-
44-
public function testCreateIsDeniedForInvitedCollaborator() {
45-
// when
46-
$this->create(user: static::$fixtures['user6invited']);
47-
48-
// then: throws "item not found" because multiSelect1 is not readable
49-
$this->assertResponseStatusCodeSame(400);
50-
$this->assertJsonContains([
51-
'title' => 'An error occurred',
52-
'detail' => 'Item not found for "'.$this->getIriFor($this->defaultMultiSelect).'".',
53-
]);
54-
}
55-
56-
public function testCreateIsDeniedForInactiveCollaborator() {
57-
// when
58-
$this->create(user: static::$fixtures['user5inactive']);
59-
60-
// then: throws "item not found" because multiSelect1 is not readable
61-
$this->assertResponseStatusCodeSame(400);
62-
$this->assertJsonContains([
63-
'title' => 'An error occurred',
64-
'detail' => 'Item not found for "'.$this->getIriFor($this->defaultMultiSelect).'".',
65-
]);
66-
}
67-
68-
public function testCreateIsDeniedForUnrelatedUser() {
69-
// when
70-
$this->create(user: static::$fixtures['user4unrelated']);
71-
72-
// then: throws "item not found" because multiSelect1 is not readable
73-
$this->assertResponseStatusCodeSame(400);
74-
$this->assertJsonContains([
75-
'title' => 'An error occurred',
76-
'detail' => 'Item not found for "'.$this->getIriFor($this->defaultMultiSelect).'".',
77-
]);
78-
}
79-
80-
public function testCreateIsDeniedForGuest() {
81-
// when
82-
$this->create(user: static::$fixtures['user3guest']);
83-
84-
// then
85-
$this->assertResponseStatusCodeSame(403);
86-
$this->assertJsonContains([
87-
'title' => 'An error occurred',
88-
'detail' => 'Access Denied.',
89-
]);
90-
}
91-
92-
public function testCreateIsDeniedForMember() {
93-
// when
94-
$this->create(user: static::$fixtures['user2member']);
95-
96-
// then
97-
$this->assertResponseStatusCodeSame(403);
98-
$this->assertJsonContains([
99-
'title' => 'An error occurred',
100-
'detail' => 'Access Denied.',
101-
]);
102-
}
103-
104-
public function testCreateIsDeniedForManager() {
105-
// when
106-
$response = $this->create(user: static::$fixtures['user1manager']);
107-
108-
// then
109-
$this->assertResponseStatusCodeSame(403);
110-
$this->assertJsonContains([
111-
'title' => 'An error occurred',
112-
'detail' => 'Access Denied.',
113-
]);
114-
}*/
115-
11632
// Payload setup.
11733
protected function getExampleWritePayload($attributes = [], $except = []) {
11834
return [];

api/tests/Api/ContentNodes/MultiSelect/Option/DeleteMultiSelectOptionTest.php

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,59 +15,11 @@ public function setUp(): void {
1515
$this->defaultEntity = static::$fixtures['multiSelectOption1'];
1616
}
1717

18-
public function testCreateMethodIsNotAllowed() {
18+
public function testDeleteMethodIsNotAllowed() {
1919
// when
2020
$this->delete(user: static::$fixtures['user1manager']);
2121

2222
// then
2323
$this->assertResponseStatusCodeSame(405);
2424
}
25-
26-
/*
27-
public function testDeleteIsDeniedForAnonymousUser() {
28-
static::createBasicClient()->request('DELETE', "{$this->endpoint}/".$this->defaultEntity->getId());
29-
$this->assertResponseStatusCodeSame(401);
30-
$this->assertJsonContains([
31-
'code' => 401,
32-
'message' => 'JWT Token not found',
33-
]);
34-
35-
$this->assertEntityStillExists();
36-
}
37-
38-
public function testDeleteIsDeniedForInvitedCollaborator() {
39-
$this->delete(user: static::$fixtures['user6invited']);
40-
$this->assertResponseStatusCodeSame(404);
41-
$this->assertEntityStillExists();
42-
}
43-
44-
public function testDeleteIsDeniedForInactiveCollaborator() {
45-
$this->delete(user: static::$fixtures['user5inactive']);
46-
$this->assertResponseStatusCodeSame(404);
47-
$this->assertEntityStillExists();
48-
}
49-
50-
public function testDeleteIsDeniedForUnrelatedUser() {
51-
$this->delete(user: static::$fixtures['user4unrelated']);
52-
$this->assertResponseStatusCodeSame(404);
53-
$this->assertEntityStillExists();
54-
}
55-
56-
public function testDeleteIsDeniedForGuest() {
57-
$this->delete(user: static::$fixtures['user3guest']);
58-
$this->assertResponseStatusCodeSame(403);
59-
$this->assertEntityStillExists();
60-
}
61-
62-
public function testDeleteIsDeniedForMember() {
63-
$this->delete(user: static::$fixtures['user2member']);
64-
$this->assertResponseStatusCodeSame(403);
65-
$this->assertEntityStillExists();
66-
}
67-
68-
public function testDeleteIsDeniedForManager() {
69-
$this->delete(user: static::$fixtures['user1manager']);
70-
$this->assertResponseStatusCodeSame(403);
71-
$this->assertEntityStillExists();
72-
}*/
7325
}

0 commit comments

Comments
 (0)