Skip to content

Commit

Permalink
updated account delete
Browse files Browse the repository at this point in the history
Signed-off-by: bidi <[email protected]>
  • Loading branch information
bidi47 committed Sep 4, 2024
1 parent a98b5e3 commit 906530e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/User/src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ class User extends AbstractEntity implements UserInterface
public const IS_DELETED_YES = true;
public const IS_DELETED_NO = false;

public const IS_DELETED = [
self::IS_DELETED_YES,
self::IS_DELETED_NO,
];
public const IS_DELETED = ['1', '0'];

#[ORM\OneToOne(mappedBy: 'user', targetEntity: UserDetail::class, cascade: ['persist', 'remove'])]
protected UserDetail $detail;
Expand Down
2 changes: 1 addition & 1 deletion src/User/src/InputFilter/ProfileDeleteInputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function init(): void
->attachByName(InArray::class, [
'haystack' => User::IS_DELETED,
'message' => Message::DELETE_ACCOUNT,
'strict' => InArray::COMPARE_NOT_STRICT,
'strict' => InArray::COMPARE_STRICT,
], true)
->attachByName(NotEmpty::class, [
'message' => Message::DELETE_ACCOUNT,
Expand Down
5 changes: 3 additions & 2 deletions test/Unit/User/InputFilter/ProfileDeleteInputFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace FrontendTest\Unit\User\InputFilter;

use Frontend\App\Common\Message;
use Frontend\User\Entity\User;
use Frontend\User\InputFilter\ProfileDeleteInputFilter;
use FrontendTest\Common\AbstractInputFilterTest;
use Laminas\Session\Container;
Expand Down Expand Up @@ -51,10 +52,10 @@ public function testWillPassValidation(): void
{
$hash = (new Csrf(['session' => new Container()]))->getHash();

$this->inputFilter->setData(['isDeleted' => true, 'userDeleteCsrf' => $hash]);
$this->inputFilter->setData(['isDeleted' => (string) User::IS_DELETED_YES, 'userDeleteCsrf' => $hash]);
$this->assertTrue($this->inputFilter->isValid());
$this->assertSame(
true,
(string) User::IS_DELETED_YES,
$this->inputFilter->getValue('isDeleted')
);
}
Expand Down

0 comments on commit 906530e

Please sign in to comment.