Code Duplication    Length = 8-10 lines in 8 locations

tests/Integration/UserUnauthenticatedTest.php 8 locations

@@ 75-82 (lines=8) @@
72
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
73
  }
74
75
  public function testEmailRequiredValidationLogin()
76
  {
77
    entity(User::class)->create(['originalPassword' => 'testPassword']);
78
    $this->json('POST', '/login', [
79
      'password' => 'testPassword'
80
    ])->seeStatusCode(422)->seeJsonEquals(["errors" => ["email" => ["The email field is required."]],
81
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
82
  }
83
84
  public function testInvalidCredentials()
85
  {
@@ 99-106 (lines=8) @@
96
    self::assertNull($this->response->headers->get('jwt-token'));
97
  }
98
99
  public function testInvalidEmailValidation()
100
  {
101
    $this->json('POST', '/register', [
102
      'email' => 'invalidEmail',
103
      'password' => 'testPassword'
104
    ])->seeStatusCode(422)->seeJsonEquals(["errors" => ["email" => ["The email must be a valid email address."]],
105
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
106
  }
107
108
  public function testInvalidEmailValidationLogin()
109
  {
@@ 133-142 (lines=10) @@
130
    self::assertNull($this->response->headers->get('jwt-token'));
131
  }
132
133
  public function testInvalidLastConfirmedAGBVersion()
134
  {
135
    $this->json('POST', '/register', [
136
      'email' => '[email protected]',
137
      'password' => 'testPassword',
138
      'confirmedAGBVersion' => 'noInt',
139
    ])->seeStatusCode(422)->seeJsonEquals(["errors" => ["confirmedAGBVersion" =>
140
      ["The confirmed a g b version must be an integer."]],
141
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
142
  }
143
144
  public function testLogin()
145
  {
@@ 156-165 (lines=10) @@
153
    self::assertNotNull($this->response->headers->get('jwt-token'));
154
  }
155
156
  public function testMultipleValidationErrors()
157
  {
158
    $this->json('POST', '/register', [
159
      'password' => 5
160
    ])->seeStatusCode(422)->seeJsonEquals(
161
      ["errors" => [
162
        "email" => ["The email field is required."],
163
        "password" => ["The password must be a string.", "The password must be at least 8 characters."]
164
      ], "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
165
  }
166
167
  public function testNegativeLastConfirmedAGBVersion()
168
  {
@@ 167-176 (lines=10) @@
164
      ], "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
165
  }
166
167
  public function testNegativeLastConfirmedAGBVersion()
168
  {
169
    $this->json('POST', '/register', [
170
      'email' => '[email protected]',
171
      'password' => 'testPassword',
172
      'confirmedAGBVersion' => -1,
173
    ])->seeStatusCode(422)->seeJsonEquals(["errors" => ["confirmedAGBVersion" =>
174
      ["The confirmed a g b version must be at least 0."]],
175
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
176
  }
177
178
  public function testNoStringPassword()
179
  {
@@ 178-185 (lines=8) @@
175
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
176
  }
177
178
  public function testNoStringPassword()
179
  {
180
    $this->json('POST', '/register', [
181
      'email' => '[email protected]',
182
      'password' => 16511233
183
    ])->seeStatusCode(422)->seeJsonEquals(["errors" => ["password" => ["The password must be a string."]],
184
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
185
  }
186
187
  public function testNoStringPasswordLogin()
188
  {
@@ 238-247 (lines=10) @@
235
    self::assertEquals(5, $user->getConfirmedAGBVersion());
236
  }
237
238
  public function testRegistrationWithStringAsLastConfirmedAGBVersion()
239
  {
240
    $this->json('POST', '/register', [
241
      'email' => '[email protected]',
242
      'password' => 'testPassword',
243
      'confirmedAGBVersion' => "5"
244
    ])->seeStatusCode(422)->seeJsonEquals(["errors" =>
245
      ["confirmedAGBVersion" => ["The confirmed a g b version must be an integer."]],
246
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
247
  }
248
249
  public function testTooShortPassword()
250
  {
@@ 249-257 (lines=9) @@
246
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
247
  }
248
249
  public function testTooShortPassword()
250
  {
251
    $this->json('POST', '/register', [
252
      'email' => '[email protected]',
253
      'password' => 'short'
254
    ])->seeStatusCode(422)->seeJsonEquals(["errors" =>
255
      ["password" => ["The password must be at least 8 characters."]],
256
      "message" => "The given data was invalid.", "name" => "ValidationException", "status" => 422]);
257
  }
258
259
  public function testTooShortPasswordLogin()
260
  {