Skip to content

Commit d79fe75

Browse files
committed
Partial fix for #953 - Message still not displayed
+ Test need fixing
1 parent 39a1d5c commit d79fe75

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

app/sprinkles/account/src/Controller/AccountController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ public function register(Request $request, Response $response, $args)
917917
$user = $registration->register();
918918
} catch (\Exception $e) {
919919
$ms->addMessageTranslated('danger', $e->getMessage(), $data);
920-
$error = true;
920+
return $response->withJson([], 400);
921921
}
922922

923923
// Success message

app/sprinkles/account/tests/Unit/RegistrationTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public function testNormalRegistration()
8181
$this->expectException(HttpException::class);
8282
$validation = $registration->validate();
8383

84+
/**
85+
* @todo --> THIS TEST IS NOT EXECUTED BECAUSE OF THE PREVIOUS EXCEPTION !!!
86+
* Plus need to validate a message is trown, because apparently it doesn't !
87+
*/
8488
// Should throw email error if we change the username
8589
$fakeUserData['user_name'] = 'BarFoo';
8690
$registration = new Registration($this->ci, $fakeUserData);
@@ -93,9 +97,6 @@ public function testNormalRegistration()
9397
*/
9498
public function testValidation()
9599
{
96-
// Reset database
97-
$this->refreshDatabase();
98-
99100
$registration = new Registration($this->ci, [
100101
'user_name' => 'FooBar',
101102
'first_name' => 'Foo',
@@ -114,9 +115,6 @@ public function testValidation()
114115
*/
115116
public function testMissingFields()
116117
{
117-
// Reset database
118-
$this->refreshDatabase();
119-
120118
$registration = new Registration($this->ci, [
121119
'user_name' => 'FooBar',
122120
//'first_name' => 'Foo',

0 commit comments

Comments
 (0)