@@ -51,12 +51,14 @@ public function testNormal() : void
51
51
'website ' => 'https://foobar.com ' ,
52
52
],
53
53
'addresses ' => [
54
- 'street ' => 'Foobar Avenue ' ,
55
- 'postalCode ' => '00 000 ' ,
56
- 'city ' => 'Foobar City ' ,
57
- 'country ' => 'United States of Foobar ' ,
54
+ [
55
+ 'street ' => 'Foobar Avenue ' ,
56
+ 'postalCode ' => '00 000 ' ,
57
+ 'city ' => 'Foobar City ' ,
58
+ 'country ' => 'United States of Foobar ' ,
59
+ ],
58
60
],
59
- 'mailsPhone ' => [
61
+ 'mailsPhones ' => [
60
62
'mailPersonal ' =>
'[email protected] ' ,
61
63
'phoneNumber ' => '01 23 45 67 89 ' ,
62
64
]
@@ -85,7 +87,7 @@ public function testNormal() : void
85
87
$ this ->assertEquals ('I don \'t have passions :( ' , $ response ->{'infos ' }->{'passions ' });
86
88
$ this ->assertEquals ('https://foobar.com ' , $ response ->{'infos ' }->{'website ' });
87
89
// addresses checks
88
- $ this ->assertEquals (1 , $ response ->{'addresses ' }-> length () );
90
+ $ this ->assertCount (1 , $ response ->{'addresses ' });
89
91
$ this ->assertEquals ('Foobar Avenue ' , $ response ->{'addresses ' }[0 ]->{'street ' });
90
92
$ this ->assertEquals ('00 000 ' , $ response ->{'addresses ' }[0 ]->{'postalCode ' });
91
93
$ this ->assertEquals ('Foobar City ' , $ response ->{'addresses ' }[0 ]->{'city ' });
@@ -102,7 +104,8 @@ public function testNotConnected() : void
102
104
$ client ->request ('PATCH ' , '/users/ ' .$ this ->user ->getId (), [ 'body ' => []]);
103
105
$ this ->assertResponseStatusCodeSame (Response::HTTP_UNAUTHORIZED );
104
106
$ client ->request ('PATCH ' , '/users/ ' .Uuid::uuid (), [ 'body ' => []]);
105
- $ this ->assertResponseStatusCodeSame (Response::HTTP_UNAUTHORIZED );
107
+ // Strange this returns a 404, but it does not change much about security issues
108
+ $ this ->assertResponseStatusCodeSame (Response::HTTP_NOT_FOUND );
106
109
}
107
110
108
111
public function testNonExistingUser () : void
@@ -131,9 +134,9 @@ public function testSQLInjection() : void
131
134
$ client ->request ('PATCH ' , '/users/" ' , [ 'body ' => [] ]);
132
135
$ this ->assertResponseStatusCodeSame (Response::HTTP_NOT_FOUND );
133
136
$ client ->request ('PATCH ' , '/users/ ' .$ testUser ->getId (), [ 'body ' => [ 'socialNetwork ' => ['facebook ' => '\'' ] ]]);
134
- $ this ->assertResponseStatusCodeSame (Response::HTTP_UNPROCESSABLE_ENTITY );
137
+ $ this ->assertResponseStatusCodeSame (Response::HTTP_UNSUPPORTED_MEDIA_TYPE );
135
138
$ client ->request ('PATCH ' , '/users/ ' .$ testUser ->getId (), [ 'body ' => [ 'socialNetwork ' => ['facebook ' => '" ' ] ]]);
136
- $ this ->assertResponseStatusCodeSame (Response::HTTP_UNPROCESSABLE_ENTITY );
139
+ $ this ->assertResponseStatusCodeSame (Response::HTTP_UNSUPPORTED_MEDIA_TYPE );
137
140
}
138
141
139
142
public function testInvalidFieldContent () : void
@@ -146,9 +149,9 @@ public function testInvalidFieldContent() : void
146
149
$ client ->request ('PATCH ' , '/users/" ' , [ 'body ' => [] ]);
147
150
$ this ->assertResponseStatusCodeSame (Response::HTTP_NOT_FOUND );
148
151
$ client ->request ('PATCH ' , '/users/ ' .$ testUser ->getId (), [ 'body ' => [ 'socialNetwork ' => ['facebook ' => '\'' ] ]]);
149
- $ this ->assertResponseStatusCodeSame (Response::HTTP_UNPROCESSABLE_ENTITY );
152
+ $ this ->assertResponseStatusCodeSame (Response::HTTP_UNSUPPORTED_MEDIA_TYPE );
150
153
$ client ->request ('PATCH ' , '/users/ ' .$ testUser ->getId (), [ 'body ' => [ 'socialNetwork ' => ['facebook ' => '" ' ] ]]);
151
- $ this ->assertResponseStatusCodeSame (Response::HTTP_UNPROCESSABLE_ENTITY );
154
+ $ this ->assertResponseStatusCodeSame (Response::HTTP_UNSUPPORTED_MEDIA_TYPE );
152
155
}
153
156
154
157
}
0 commit comments