From 66acb0c1afd108cb3282dcbdb694640156da3178 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Mon, 11 Jul 2022 11:22:10 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=91=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=82=92=E7=A9=BA=E6=AC=84=E3=81=AB=E3=81=97=E3=81=9F=E5=A0=B4?= =?UTF-8?q?=E5=90=88,=20=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA?= =?UTF-8?q?=E3=82=8B=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 以下のエラーを修正 > Expected argument of type "string", "null" given ato property path "plain_password". --- src/Eccube/Entity/Member.php | 2 +- .../Setting/System/MemberControllerTest.php | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Eccube/Entity/Member.php b/src/Eccube/Entity/Member.php index ba2bc1edd82..18127b3ebe9 100644 --- a/src/Eccube/Entity/Member.php +++ b/src/Eccube/Entity/Member.php @@ -287,7 +287,7 @@ public function getPlainPassword(): ?string * * @return $this */ - public function setPlainPassword(string $password): self + public function setPlainPassword(?string $password): self { $this->plainPassword = $password; diff --git a/tests/Eccube/Tests/Web/Admin/Setting/System/MemberControllerTest.php b/tests/Eccube/Tests/Web/Admin/Setting/System/MemberControllerTest.php index a2f34fa6eed..d3a6bdd8181 100644 --- a/tests/Eccube/Tests/Web/Admin/Setting/System/MemberControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Setting/System/MemberControllerTest.php @@ -222,6 +222,32 @@ public function testMemberEditSubmitFail() $this->assertTrue($this->client->getResponse()->isSuccessful()); } + /** + * @see https://github.com/EC-CUBE/ec-cube/issues/5420 + */ + public function testMemberEditSubmitFailWithPlainPasswordIsEmpty() + { + // before + $formData = $this->createFormData(); + $formData['plain_password'] = [ + 'first' => '', + 'second' => '' + ]; + $Member = $this->createMember(); + $Member->setPassword('**********'); + $this->entityManager->persist($Member); + $this->entityManager->flush(); + $mid = $Member->getId(); + + // main + $this->client->request('POST', + $this->generateUrl('admin_setting_system_member_edit', ['id' => $mid]), + ['admin_member' => $formData] + ); + + $this->assertTrue($this->client->getResponse()->isSuccessful()); + } + public function testMemberUpNotFoundMember() { // before