From d677265918412e643c6a567f38d58ea083ea9a9c Mon Sep 17 00:00:00 2001 From: Takuya Sawada Date: Mon, 10 Aug 2020 23:26:54 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=AB=E3=80=8C=E3=82=AB=E3=83=8A=E3=80=8D=E3=82=92=E5=BF=85?= =?UTF-8?q?=E9=A0=88=E9=A0=85=E7=9B=AE=E3=81=A8=E3=81=99=E3=82=8B=E3=81=8B?= =?UTF-8?q?=E9=81=B8=E6=8A=9E=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=AA=E3=83=97?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Version20200810140539.php | 28 +++++++++++++++++ src/Eccube/Entity/BaseInfo.php | 31 +++++++++++++++++++ src/Eccube/Form/Type/Admin/ShopMasterType.php | 2 ++ src/Eccube/Resource/locale/messages.en.yaml | 2 ++ src/Eccube/Resource/locale/messages.ja.yaml | 2 ++ .../admin/Setting/Shop/shop_master.twig | 11 ++++++- 6 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 app/DoctrineMigrations/Version20200810140539.php diff --git a/app/DoctrineMigrations/Version20200810140539.php b/app/DoctrineMigrations/Version20200810140539.php new file mode 100644 index 00000000000..07c99e74400 --- /dev/null +++ b/app/DoctrineMigrations/Version20200810140539.php @@ -0,0 +1,28 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE dtb_base_info ADD option_require_kana TINYINT(1) DEFAULT \'1\' NOT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE dtb_base_info DROP option_require_kana'); + } +} diff --git a/src/Eccube/Entity/BaseInfo.php b/src/Eccube/Entity/BaseInfo.php index 879064692ff..f522d36759f 100644 --- a/src/Eccube/Entity/BaseInfo.php +++ b/src/Eccube/Entity/BaseInfo.php @@ -219,6 +219,13 @@ class BaseInfo extends \Eccube\Entity\AbstractEntity */ private $option_remember_me = true; + /** + * @var boolean + * + * @ORM\Column(name="option_require_kana", type="boolean", options={"default":true}) + */ + private $option_require_kana = true; + /** * @var string|null * @@ -901,6 +908,20 @@ public function setOptionRememberMe($optionRememberMe) return $this; } + /** + * Set optionRequireKana + * + * @param boolean $optionRequireKana + * + * @return BaseInfo + */ + public function setOptionRequireKana($optionRequireKana) + { + $this->option_require_kana = $optionRequireKana; + + return $this; + } + /** * Get optionRememberMe. * @@ -911,6 +932,16 @@ public function isOptionRememberMe() return $this->option_remember_me; } + /** + * Get optionRequireKana + * + * @return boolean + */ + public function isOptionRequireKana() + { + return $this->option_require_kana; + } + /** * Set authenticationKey. * diff --git a/src/Eccube/Form/Type/Admin/ShopMasterType.php b/src/Eccube/Form/Type/Admin/ShopMasterType.php index 23774c28a79..5417303c468 100644 --- a/src/Eccube/Form/Type/Admin/ShopMasterType.php +++ b/src/Eccube/Form/Type/Admin/ShopMasterType.php @@ -167,6 +167,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('option_mypage_order_status_display', ToggleSwitchType::class) // 自動ログイン ->add('option_remember_me', ToggleSwitchType::class) + // カナ項目必須 + ->add('option_require_kana', ToggleSwitchType::class) // お気に入り商品設定 ->add('option_favorite_product', ToggleSwitchType::class) // 在庫切れ商品を非表示にする diff --git a/src/Eccube/Resource/locale/messages.en.yaml b/src/Eccube/Resource/locale/messages.en.yaml index 652266bb9cd..caaba7fed34 100644 --- a/src/Eccube/Resource/locale/messages.en.yaml +++ b/src/Eccube/Resource/locale/messages.en.yaml @@ -1096,6 +1096,7 @@ admin.setting.shop.shop.option_customer_activate: Temporary Customers admin.setting.shop.shop.option_mypage_order_status_display: Display order status in My Accounts admin.setting.shop.shop.option_favorite_product: Favorites admin.setting.shop.shop.option_remember_me: Auto Sign-in +admin.setting.shop.shop.option_require_kana: Require Kana Field admin.setting.shop.shop.option_product: Product Settings admin.setting.shop.shop.nostock_hidden: Hide out-of-stock products admin.setting.shop.shop.option_tax: Taxes @@ -1571,6 +1572,7 @@ tooltip.setting.shop.shop.option_delivery_fee_by_product: If turned on, you can tooltip.setting.shop.shop.option_customer_activate: This will register a customer as a temporary customer until email verification is completed, after which s/he will be registered as a regular customer. tooltip.setting.shop.shop.option_favorite_product: This allows users to save their favorite products as Favorites. tooltip.setting.shop.shop.option_remember_me: Allow customers to automatically sign in for certain period of time. +tooltip.setting.shop.shop.option_require_kana: Request customers to enter Kana names tooltip.setting.shop.shop.option_product_tax: If turned on, you can set the tax rate per product. tooltip.setting.shop.shop.option_point_enabled: If turned on, the point system is enabled. tooltip.setting.shop.shop.option_point_rate: You can change the point return rate by purchase amount. diff --git a/src/Eccube/Resource/locale/messages.ja.yaml b/src/Eccube/Resource/locale/messages.ja.yaml index ea35edcc335..ab13cbfc422 100644 --- a/src/Eccube/Resource/locale/messages.ja.yaml +++ b/src/Eccube/Resource/locale/messages.ja.yaml @@ -1096,6 +1096,7 @@ admin.setting.shop.shop.option_customer_activate: 仮会員機能 admin.setting.shop.shop.option_mypage_order_status_display: マイページに注文状況を表示 admin.setting.shop.shop.option_favorite_product: お気に入り商品機能 admin.setting.shop.shop.option_remember_me: 自動ログイン機能 +admin.setting.shop.shop.option_require_kana: カナを必須項目にする admin.setting.shop.shop.option_product: 商品設定 admin.setting.shop.shop.nostock_hidden: 在庫切れ商品の非表示 admin.setting.shop.shop.option_tax: 税設定 @@ -1571,6 +1572,7 @@ tooltip.setting.shop.shop.option_delivery_fee_by_product: ここをオンにす tooltip.setting.shop.shop.option_customer_activate: 顧客の会員登録直後は仮会員とし、メールアドレスの確認などを経て本会員として登録できる機能です。 tooltip.setting.shop.shop.option_favorite_product: 顧客が任意の商品をお気に入りとして登録できるようにする機能です。 tooltip.setting.shop.shop.option_remember_me: 顧客に一定期間の自動ログインを許可します。 +tooltip.setting.shop.shop.option_require_kana: 顧客登録時にカナの入力を必須にします。 tooltip.setting.shop.shop.option_product_tax: オンにすると、商品別に税率を設定することができるようになります。 tooltip.setting.shop.shop.option_point_enabled: オンにすると、ポイント機能を有効化できます。 tooltip.setting.shop.shop.option_point_rate: 購入金額に対するポイント付与率を編集できます。 diff --git a/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig b/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig index 7181e390248..31199f58833 100644 --- a/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig +++ b/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig @@ -260,6 +260,15 @@ file that was distributed with this source code. {{ form_errors(form.option_remember_me) }} +
+
+
{{ 'admin.setting.shop.shop.option_require_kana'|trans }}
+
+
+ {{ form_widget(form.option_require_kana) }} + {{ form_errors(form.option_require_kana) }} +
+
@@ -352,4 +361,4 @@ file that was distributed with this source code.
-{% endblock %} \ No newline at end of file +{% endblock %} From f38f876b2ba76559b186f223fdc710885210cf32 Mon Sep 17 00:00:00 2001 From: Takuya Sawada Date: Tue, 11 Aug 2020 10:23:07 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E5=80=A4=E3=81=AB?= =?UTF-8?q?=E5=9F=BA=E3=81=A5=E3=81=84=E3=81=A6=E3=83=95=E3=82=A9=E3=83=BC?= =?UTF-8?q?=E3=83=A0=E3=81=AE=E3=82=AB=E3=83=8A=E3=82=92=E5=BF=85=E9=A0=88?= =?UTF-8?q?=E9=A0=85=E7=9B=AE=E3=81=8B=E3=81=A9=E3=81=86=E3=81=8B=E6=B1=BA?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NonMemberShoppingController.php | 36 +++++++++++-------- src/Eccube/Form/Type/Admin/CustomerType.php | 4 +-- src/Eccube/Form/Type/Admin/OrderType.php | 9 +---- src/Eccube/Form/Type/Admin/ShippingType.php | 18 ++-------- src/Eccube/Form/Type/Front/ContactType.php | 4 +-- .../Form/Type/Front/CustomerAddressType.php | 4 +-- src/Eccube/Form/Type/Front/EntryType.php | 2 +- src/Eccube/Form/Type/Front/NonMemberType.php | 5 ++- src/Eccube/Form/Type/KanaType.php | 14 ++++++-- .../template/admin/Customer/edit.twig | 2 ++ .../Resource/template/admin/Order/edit.twig | 14 ++++++-- .../template/admin/Order/shipping.twig | 4 ++- .../template/default/Shopping/index.twig | 2 +- 13 files changed, 60 insertions(+), 58 deletions(-) diff --git a/src/Eccube/Controller/NonMemberShoppingController.php b/src/Eccube/Controller/NonMemberShoppingController.php index 5daf7b093f3..cf3321dcf6c 100644 --- a/src/Eccube/Controller/NonMemberShoppingController.php +++ b/src/Eccube/Controller/NonMemberShoppingController.php @@ -13,7 +13,9 @@ namespace Eccube\Controller; +use Eccube\Entity\BaseInfo; use Eccube\Entity\Customer; +use Eccube\Repository\BaseInfoRepository; use Eccube\Event\EccubeEvents; use Eccube\Event\EventArgs; use Eccube\Form\Type\Front\NonMemberType; @@ -49,21 +51,29 @@ class NonMemberShoppingController extends AbstractShoppingController */ protected $cartService; + /** + * @var BaseInfo + */ + protected $baseInfo; + /** * NonMemberShoppingController constructor. * * @param ValidatorInterface $validator + * @param BaseInfoRepository $baseInfoRepository * @param PrefRepository $prefRepository * @param OrderHelper $orderHelper * @param CartService $cartService */ public function __construct( ValidatorInterface $validator, + BaseInfoRepository $baseInfoRepository, PrefRepository $prefRepository, OrderHelper $orderHelper, CartService $cartService ) { $this->validator = $validator; + $this->baseInfo = $baseInfoRepository->get(); $this->prefRepository = $prefRepository; $this->orderHelper = $orderHelper; $this->cartService = $cartService; @@ -269,24 +279,20 @@ protected function customerValidation(array &$data) ] ); - $data['customer_kana01'] = mb_convert_kana($data['customer_kana01'], 'CV', 'utf-8'); - $errors[] = $this->validator->validate( - $data['customer_kana01'], - [ - new Assert\NotBlank(), + $kanaValidators = [ new Assert\Length(['max' => $this->eccubeConfig['eccube_kana_len']]), new Assert\Regex(['pattern' => '/^[ァ-ヶヲ-゚ー]+$/u']), - ] - ); - $data['customer_kana02'] = mb_convert_kana($data['customer_kana02'], 'CV', 'utf-8'); - $errors[] = $this->validator->validate( - $data['customer_kana02'], - [ - new Assert\NotBlank(), - new Assert\Length(['max' => $this->eccubeConfig['eccube_kana_len']]), - new Assert\Regex(['pattern' => '/^[ァ-ヶヲ-゚ー]+$/u']), - ]); + ]; + if ($this->baseInfo->isOptionRequireKana()) { + $kanaValidators []= new Assert\NotBlank(); + } + + $data['customer_kana01'] = mb_convert_kana($data['customer_kana01'], 'CV', 'utf-8'); + $errors[] = $this->validator->validate($data['customer_kana01'], $kanaValidators); + + $data['customer_kana02'] = mb_convert_kana($data['customer_kana02'], 'CV', 'utf-8'); + $errors[] = $this->validator->validate($data['customer_kana02'], $kanaValidators); $errors[] = $this->validator->validate( $data['customer_company_name'], [ diff --git a/src/Eccube/Form/Type/Admin/CustomerType.php b/src/Eccube/Form/Type/Admin/CustomerType.php index d53b7fe3cd9..fce04ebaecc 100644 --- a/src/Eccube/Form/Type/Admin/CustomerType.php +++ b/src/Eccube/Form/Type/Admin/CustomerType.php @@ -64,9 +64,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('name', NameType::class, [ 'required' => true, ]) - ->add('kana', KanaType::class, [ - 'required' => true, - ]) + ->add('kana', KanaType::class) ->add('company_name', TextType::class, [ 'required' => false, 'constraints' => [ diff --git a/src/Eccube/Form/Type/Admin/OrderType.php b/src/Eccube/Form/Type/Admin/OrderType.php index 6205343f9d2..53cab0e3641 100644 --- a/src/Eccube/Form/Type/Admin/OrderType.php +++ b/src/Eccube/Form/Type/Admin/OrderType.php @@ -99,14 +99,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ], ], ]) - ->add('kana', KanaType::class, [ - 'required' => false, - 'options' => [ - 'constraints' => [ - new Assert\NotBlank(), - ], - ], - ]) + ->add('kana', KanaType::class) ->add('company_name', TextType::class, [ 'required' => false, 'constraints' => [ diff --git a/src/Eccube/Form/Type/Admin/ShippingType.php b/src/Eccube/Form/Type/Admin/ShippingType.php index a1c54287976..77272a00f4b 100644 --- a/src/Eccube/Form/Type/Admin/ShippingType.php +++ b/src/Eccube/Form/Type/Admin/ShippingType.php @@ -90,22 +90,8 @@ public function __construct( public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('name', NameType::class, [ - 'required' => false, - 'options' => [ - 'constraints' => [ - new Assert\NotBlank(), - ], - ], - ]) - ->add('kana', KanaType::class, [ - 'required' => false, - 'options' => [ - 'constraints' => [ - new Assert\NotBlank(), - ], - ], - ]) + ->add('name', NameType::class) + ->add('kana', KanaType::class) ->add('company_name', TextType::class, [ 'required' => false, 'constraints' => [ diff --git a/src/Eccube/Form/Type/Front/ContactType.php b/src/Eccube/Form/Type/Front/ContactType.php index 49bf97361a1..49ea22db080 100644 --- a/src/Eccube/Form/Type/Front/ContactType.php +++ b/src/Eccube/Form/Type/Front/ContactType.php @@ -52,9 +52,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('name', NameType::class, [ 'required' => true, ]) - ->add('kana', KanaType::class, [ - 'required' => false, - ]) + ->add('kana', KanaType::class) ->add('postal_code', PostalType::class, [ 'required' => false, ]) diff --git a/src/Eccube/Form/Type/Front/CustomerAddressType.php b/src/Eccube/Form/Type/Front/CustomerAddressType.php index e676b2139f5..a96f1313735 100644 --- a/src/Eccube/Form/Type/Front/CustomerAddressType.php +++ b/src/Eccube/Form/Type/Front/CustomerAddressType.php @@ -49,9 +49,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('name', NameType::class, [ 'required' => true, ]) - ->add('kana', KanaType::class, [ - 'required' => true, - ]) + ->add('kana', KanaType::class) ->add('company_name', TextType::class, [ 'required' => false, 'constraints' => [ diff --git a/src/Eccube/Form/Type/Front/EntryType.php b/src/Eccube/Form/Type/Front/EntryType.php index 7982f497a20..473042fdcb7 100644 --- a/src/Eccube/Form/Type/Front/EntryType.php +++ b/src/Eccube/Form/Type/Front/EntryType.php @@ -61,7 +61,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('name', NameType::class, [ 'required' => true, ]) - ->add('kana', KanaType::class, []) + ->add('kana', KanaType::class) ->add('company_name', TextType::class, [ 'required' => false, 'constraints' => [ diff --git a/src/Eccube/Form/Type/Front/NonMemberType.php b/src/Eccube/Form/Type/Front/NonMemberType.php index f4ceb1d8133..8ebe65bc4c0 100644 --- a/src/Eccube/Form/Type/Front/NonMemberType.php +++ b/src/Eccube/Form/Type/Front/NonMemberType.php @@ -14,6 +14,7 @@ namespace Eccube\Form\Type\Front; use Eccube\Common\EccubeConfig; +use Eccube\Repository\BaseInfoRepository; use Eccube\Form\Type\AddressType; use Eccube\Form\Type\KanaType; use Eccube\Form\Type\NameType; @@ -51,9 +52,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('name', NameType::class, [ 'required' => true, ]) - ->add('kana', KanaType::class, [ - 'required' => true, - ]) + ->add('kana', KanaType::class) ->add('company_name', TextType::class, [ 'required' => false, 'constraints' => [ diff --git a/src/Eccube/Form/Type/KanaType.php b/src/Eccube/Form/Type/KanaType.php index 9a5666886dd..63c69a3759e 100644 --- a/src/Eccube/Form/Type/KanaType.php +++ b/src/Eccube/Form/Type/KanaType.php @@ -14,6 +14,8 @@ namespace Eccube\Form\Type; use Eccube\Common\EccubeConfig; +use Eccube\Entity\BaseInfo; +use Eccube\Repository\BaseInfoRepository; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -22,18 +24,25 @@ class KanaType extends AbstractType { /** - * @var \Eccube\Common\EccubeConfig + * @var EccubeConfig */ protected $eccubeConfig; + /** + * @var BaseInfo + */ + protected $baseInfo; + /** * KanaType constructor. * * @param EccubeConfig $eccubeConfig + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(EccubeConfig $eccubeConfig) + public function __construct(EccubeConfig $eccubeConfig, BaseInfoRepository $baseInfoRepository) { $this->eccubeConfig = $eccubeConfig; + $this->baseInfo = $baseInfoRepository->get(); } /** @@ -52,6 +61,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ + 'required' => $this->baseInfo->isOptionRequireKana(), 'lastname_options' => [ 'attr' => [ 'placeholder' => 'common.last_name_kana', diff --git a/src/Eccube/Resource/template/admin/Customer/edit.twig b/src/Eccube/Resource/template/admin/Customer/edit.twig index d5cda78bad3..384b794cc3f 100644 --- a/src/Eccube/Resource/template/admin/Customer/edit.twig +++ b/src/Eccube/Resource/template/admin/Customer/edit.twig @@ -87,7 +87,9 @@ file that was distributed with this source code.
{{ 'admin.common.kana'|trans }} + {% if BaseInfo.option_require_kana %} {{ 'admin.common.required'|trans }} + {% endif %}
diff --git a/src/Eccube/Resource/template/admin/Order/edit.twig b/src/Eccube/Resource/template/admin/Order/edit.twig index e65e7067ce2..54377873ec9 100644 --- a/src/Eccube/Resource/template/admin/Order/edit.twig +++ b/src/Eccube/Resource/template/admin/Order/edit.twig @@ -409,7 +409,12 @@ file that was distributed with this source code.
- +
@@ -552,7 +557,12 @@ file that was distributed with this source code.
- +
diff --git a/src/Eccube/Resource/template/admin/Order/shipping.twig b/src/Eccube/Resource/template/admin/Order/shipping.twig index 318d2631e9d..cfde6cd2cd3 100644 --- a/src/Eccube/Resource/template/admin/Order/shipping.twig +++ b/src/Eccube/Resource/template/admin/Order/shipping.twig @@ -335,10 +335,12 @@ file that was distributed with this source code.
diff --git a/src/Eccube/Resource/template/default/Shopping/index.twig b/src/Eccube/Resource/template/default/Shopping/index.twig index fcc1b4d9160..35ec833adcc 100644 --- a/src/Eccube/Resource/template/default/Shopping/index.twig +++ b/src/Eccube/Resource/template/default/Shopping/index.twig @@ -187,7 +187,7 @@ file that was distributed with this source code.
- {{ 'common.required'|trans }} + {{ BaseInfo.option_require_kana ? 'common.required'|trans }}
From cafcfe92cd6c1d22e21032bc46978561da7ddc35 Mon Sep 17 00:00:00 2001 From: Takuya Sawada Date: Tue, 11 Aug 2020 11:14:45 +0900 Subject: [PATCH 3/7] =?UTF-8?q?Fix=20#4636=20=E3=82=AB=E3=83=8A=E3=83=95?= =?UTF-8?q?=E3=82=A3=E3=83=BC=E3=83=AB=E3=83=89=E3=81=AE=E5=85=A5=E5=8A=9B?= =?UTF-8?q?=E3=81=8C=20Null=20=E3=81=A0=E3=81=A8=E4=BE=8B=E5=A4=96?= =?UTF-8?q?=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 例外が発生時に、バリデーションエラーが正常に画面に反映されない問題が修正されます --- src/Eccube/Form/EventListener/ConvertKanaListener.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Eccube/Form/EventListener/ConvertKanaListener.php b/src/Eccube/Form/EventListener/ConvertKanaListener.php index 2ed4292a26d..50b246ed7c4 100644 --- a/src/Eccube/Form/EventListener/ConvertKanaListener.php +++ b/src/Eccube/Form/EventListener/ConvertKanaListener.php @@ -45,6 +45,9 @@ public static function getSubscribedEvents() public function onPreSubmit(FormEvent $event) { $data = $event->getData(); + if (is_null($data)) { + return; + } if (is_array($data)) { foreach ($data as &$value) { From ea48065b92e550963723f96a40b361385b4ba387 Mon Sep 17 00:00:00 2001 From: kiy0taka Date: Tue, 2 Mar 2021 15:29:50 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E3=83=9E?= =?UTF-8?q?=E3=82=A4=E3=82=B0=E3=83=AC=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=82=AF=E3=83=A9=E3=82=B9=E3=81=AE=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Version20200810140539.php | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 app/DoctrineMigrations/Version20200810140539.php diff --git a/app/DoctrineMigrations/Version20200810140539.php b/app/DoctrineMigrations/Version20200810140539.php deleted file mode 100644 index 07c99e74400..00000000000 --- a/app/DoctrineMigrations/Version20200810140539.php +++ /dev/null @@ -1,28 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE dtb_base_info ADD option_require_kana TINYINT(1) DEFAULT \'1\' NOT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE dtb_base_info DROP option_require_kana'); - } -} From 663d186b71aefa01d5951daaadc9efc55d6dfaf2 Mon Sep 17 00:00:00 2001 From: kiy0taka Date: Tue, 9 Mar 2021 15:45:53 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=E5=90=8D=E5=89=8D=E3=81=AF=E5=BF=85?= =?UTF-8?q?=E9=A0=88=E3=81=AE=E3=81=BE=E3=81=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Form/Type/Admin/ShippingType.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Eccube/Form/Type/Admin/ShippingType.php b/src/Eccube/Form/Type/Admin/ShippingType.php index 77272a00f4b..185cd88df3e 100644 --- a/src/Eccube/Form/Type/Admin/ShippingType.php +++ b/src/Eccube/Form/Type/Admin/ShippingType.php @@ -90,7 +90,14 @@ public function __construct( public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('name', NameType::class) + ->add('name', NameType::class, [ + 'required' => false, + 'options' => [ + 'constraints' => [ + new Assert\NotBlank(), + ], + ], + ]) ->add('kana', KanaType::class) ->add('company_name', TextType::class, [ 'required' => false, From 71cb168d6c67902d30eb76efd11bc2b128290d8e Mon Sep 17 00:00:00 2001 From: kiy0taka Date: Tue, 9 Mar 2021 16:03:53 +0900 Subject: [PATCH 6/7] =?UTF-8?q?=E3=81=8A=E5=95=8F=E3=81=84=E5=90=88?= =?UTF-8?q?=E3=82=8F=E3=81=9B=E3=81=AE=E3=82=AB=E3=83=8A=E3=81=AF=E5=B8=B8?= =?UTF-8?q?=E3=81=AB=E3=82=AA=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Form/Type/Front/ContactType.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Eccube/Form/Type/Front/ContactType.php b/src/Eccube/Form/Type/Front/ContactType.php index 49ea22db080..49bf97361a1 100644 --- a/src/Eccube/Form/Type/Front/ContactType.php +++ b/src/Eccube/Form/Type/Front/ContactType.php @@ -52,7 +52,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('name', NameType::class, [ 'required' => true, ]) - ->add('kana', KanaType::class) + ->add('kana', KanaType::class, [ + 'required' => false, + ]) ->add('postal_code', PostalType::class, [ 'required' => false, ]) From 9c57c01f80697fd1fd554ee23efc8c478c27970c Mon Sep 17 00:00:00 2001 From: kiy0taka Date: Tue, 23 Mar 2021 15:54:28 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=E3=82=AB=E3=83=8A=E5=85=A5=E5=8A=9B?= =?UTF-8?q?=E4=B8=8D=E8=A6=81=E6=99=82=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=82=B1=E3=83=BC=E3=82=B9=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_support/Page/Admin/OrderEditPage.php | 5 + .../_support/Page/Admin/ShopSettingPage.php | 11 + .../Page/Front/CustomerAddressAddPage.php | 28 ++- .../_support/Page/Front/EntryConfirmPage.php | 78 +++++++ codeception/_support/Page/Front/EntryPage.php | 132 ++++++++++++ .../Page/Front/ShoppingNonmemberPage.php | 3 + codeception/acceptance/EF04CustomerCest.php | 161 ++++++++------- .../EF07BasicCustomerOptionCest.php | 190 ++++++++++++++++++ 8 files changed, 520 insertions(+), 88 deletions(-) create mode 100644 codeception/_support/Page/Front/EntryConfirmPage.php create mode 100644 codeception/_support/Page/Front/EntryPage.php create mode 100644 codeception/acceptance/EF07BasicCustomerOptionCest.php diff --git a/codeception/_support/Page/Admin/OrderEditPage.php b/codeception/_support/Page/Admin/OrderEditPage.php index e480606c538..634ce4b68ca 100644 --- a/codeception/_support/Page/Admin/OrderEditPage.php +++ b/codeception/_support/Page/Admin/OrderEditPage.php @@ -207,4 +207,9 @@ public function お届け先の追加() return $this; } + + public function 注文番号() + { + return $this->tester->grabTextFrom(['css' => '#orderOverview > div > div > div:nth-child(1) > div:nth-child(1) > div.col']); + } } diff --git a/codeception/_support/Page/Admin/ShopSettingPage.php b/codeception/_support/Page/Admin/ShopSettingPage.php index 0aa286cbdf1..43bbee31db5 100644 --- a/codeception/_support/Page/Admin/ShopSettingPage.php +++ b/codeception/_support/Page/Admin/ShopSettingPage.php @@ -36,6 +36,17 @@ public function 入力_会社名($value) return $this; } + public function 切替_カナ必須項目($value) + { + $cssClass = $this->tester->grabAttributeFrom(['css' => 'span.shop_master_option_require_kana-on'], 'class'); + $optionOn = strpos($cssClass, 'd-none') === false; + $this->tester->scrollTo(['xpath' => '//label[@for="shop_master_option_require_kana"]'], 0, 100); + if (($optionOn && !$value) || (!$optionOn && $value)) { + $this->tester->click(['xpath' => '//label[@for="shop_master_option_require_kana"]']); + } + return $this; + } + public function 登録() { $this->tester->click('#point_form > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button'); diff --git a/codeception/_support/Page/Front/CustomerAddressAddPage.php b/codeception/_support/Page/Front/CustomerAddressAddPage.php index 909d43b22a5..45ce67da539 100644 --- a/codeception/_support/Page/Front/CustomerAddressAddPage.php +++ b/codeception/_support/Page/Front/CustomerAddressAddPage.php @@ -20,6 +20,14 @@ public function __construct(\AcceptanceTester $I) parent::__construct($I); } + public static function go($I) + { + $page = new self($I); + $page->goPage('/mypage/delivery/new'); + + return $page; + } + public static function at($I) { $page = new self($I); @@ -30,69 +38,69 @@ public static function at($I) public function 入力_姓($value) { - $this->tester->fillField(['id' => 'shopping_shipping_name_name01'], $value); + $this->tester->fillField(['id' => 'customer_address_name_name01'], $value); return $this; } public function 入力_名($value) { - $this->tester->fillField(['id' => 'shopping_shipping_name_name02'], $value); + $this->tester->fillField(['id' => 'customer_address_name_name02'], $value); return $this; } public function 入力_セイ($value) { - $this->tester->fillField(['id' => 'shopping_shipping_kana_kana01'], $value); + $this->tester->fillField(['id' => 'customer_address_kana_kana02'], $value); return $this; } public function 入力_メイ($value) { - $this->tester->fillField(['id' => 'shopping_shipping_kana_kana02'], $value); + $this->tester->fillField(['id' => 'customer_address_kana_kana02'], $value); return $this; } public function 入力_郵便番号($value) { - $this->tester->fillField(['id' => 'shopping_shipping_postal_code'], $value); + $this->tester->fillField(['id' => 'customer_address_postal_code'], $value); return $this; } public function 入力_都道府県($value) { - $this->tester->selectOption(['id' => 'shopping_shipping_address_pref'], $value); + $this->tester->selectOption(['id' => 'customer_address_address_pref'], $value); return $this; } public function 入力_市区町村名($value) { - $this->tester->fillField(['id' => 'shopping_shipping_address_addr01'], $value); + $this->tester->fillField(['id' => 'customer_address_address_addr01'], $value); return $this; } public function 入力_番地_ビル名($value) { - $this->tester->fillField(['id' => 'shopping_shipping_address_addr02'], $value); + $this->tester->fillField(['id' => 'customer_address_address_addr02'], $value); return $this; } public function 入力_電話番号($value) { - $this->tester->fillField(['id' => 'shopping_shipping_phone_number'], $value); + $this->tester->fillField(['id' => 'customer_address_phone_number'], $value); return $this; } public function 登録する() { - $this->tester->click('div.ec-registerRole button.ec-blockBtn--action'); + $this->tester->click('button.ec-blockBtn--cancel'); } } diff --git a/codeception/_support/Page/Front/EntryConfirmPage.php b/codeception/_support/Page/Front/EntryConfirmPage.php new file mode 100644 index 00000000000..7f0b6bcf257 --- /dev/null +++ b/codeception/_support/Page/Front/EntryConfirmPage.php @@ -0,0 +1,78 @@ +goPage('/entry'); + + return $page; + } + + public static function at($I) + { + $page = new self($I); + $page->tester->see('新規会員登録(確認)', ['css' => 'div.ec-pageHeader > h1']); + + return $page; + } + + public function お名前() + { + return $this->tester->grabTextFrom(['css' => '.ec-registerRole form .ec-borderedDefs dl:nth-child(1) dd']); + } + + public function お名前カナ() + { + return $this->tester->grabTextFrom(['css' => '.ec-registerRole form .ec-borderedDefs dl:nth-child(2) dd']); + } + + public function 住所() + { + return $this->tester->grabTextFrom(['css' => '.ec-registerRole form .ec-borderedDefs dl:nth-child(4) dd']); + } + + public function 電話番号() + { + return $this->tester->grabTextFrom(['css' => '.ec-registerRole form .ec-borderedDefs dl:nth-child(5) dd']); + } + + public function メールアドレス() + { + return $this->tester->grabTextFrom(['css' => '.ec-registerRole form .ec-borderedDefs dl:nth-child(6) dd']); + } + + public function 職業() + { + return $this->tester->grabTextFrom(['css' => '.ec-registerRole form .ec-borderedDefs dl:nth-child(10) dd']); + } + + public function 会員登録をする() + { + $this->tester->click(['css' => 'form > div.ec-registerRole__actions button.ec-blockBtn--action']); + } + + public function 戻る() + { + $this->tester->click('.ec-registerRole form button.ec-blockBtn--cancel'); + } +} diff --git a/codeception/_support/Page/Front/EntryPage.php b/codeception/_support/Page/Front/EntryPage.php new file mode 100644 index 00000000000..b37382b1b2d --- /dev/null +++ b/codeception/_support/Page/Front/EntryPage.php @@ -0,0 +1,132 @@ +goPage('/entry'); + + return $page; + } + + public static function at($I) + { + $page = new self($I); + $page->tester->see('新規会員登録', ['css' => 'div.ec-pageHeader > h1']); + + return $page; + } + + public function 入力_姓($value) + { + $this->tester->fillField(['id' => 'entry_name_name01'], $value); + return $this; + } + + public function 入力_名($value) + { + $this->tester->fillField(['id' => 'entry_name_name02'], $value); + return $this; + } + + public function 入力_姓カナ($value) + { + $this->tester->fillField(['id' => 'entry_kana_kana01'], $value); + return $this; + } + + public function 入力_名カナ($value) + { + $this->tester->fillField(['id' => 'entry_kana_kana02'], $value); + return $this; + } + + public function 入力_郵便番号($value) + { + $this->tester->fillField(['id' => 'entry_postal_code'], $value); + return $this; + } + + public function 入力_都道府県($value) + { + $this->tester->selectOption(['id' => 'entry_address_pref'], $value); + return $this; + } + + public function 入力_市区町村($value) + { + $this->tester->fillField(['id' => 'entry_address_addr01'], $value); + return $this; + } + + public function 入力_住所($value) + { + $this->tester->fillField(['id' => 'entry_address_addr02'], $value); + return $this; + } + + public function 入力_電話番号($value) { + $this->tester->fillField(['id' => 'entry_phone_number'], $value); + return $this; + } + + public function 入力_メールアドレス($value) + { + $this->tester->fillField(['id' => 'entry_email_first'], $value); + return $this; + } + + public function 入力_メールアドレス確認($value) + { + $this->tester->fillField(['id' => 'entry_email_second'], $value); + return $this; + } + + public function 入力_パスワード($value) + { + $this->tester->fillField(['id' => 'entry_password_first'], $value); + return $this; + } + + public function 入力_パスワード確認($value) + { + $this->tester->fillField(['id' => 'entry_password_second'], $value); + return $this; + } + + public function 入力_職業($value) + { + $this->tester->selectOption(['id' => 'entry_job'], $value); + return $this; + } + + public function 入力_利用規約同意() + { + $this->tester->checkOption(['id' => 'entry_user_policy_check']); + return $this; + } + + public function 同意して登録() + { + $this->tester->click(['css' => 'form > div.ec-registerRole__actions button']); + } +} diff --git a/codeception/_support/Page/Front/ShoppingNonmemberPage.php b/codeception/_support/Page/Front/ShoppingNonmemberPage.php index c24a0f6a2c2..858934fa1db 100644 --- a/codeception/_support/Page/Front/ShoppingNonmemberPage.php +++ b/codeception/_support/Page/Front/ShoppingNonmemberPage.php @@ -54,6 +54,9 @@ public function 入力_メイ($value) public function 入力_郵便番号($value) { $this->tester->fillField(['id' => 'nonmember_postal_code'], $value); + if ($value) { + $this->tester->wait(5); + } return $this; } diff --git a/codeception/acceptance/EF04CustomerCest.php b/codeception/acceptance/EF04CustomerCest.php index 8eb682514bc..f23a5b96058 100644 --- a/codeception/acceptance/EF04CustomerCest.php +++ b/codeception/acceptance/EF04CustomerCest.php @@ -12,6 +12,8 @@ */ use Codeception\Util\Fixtures; +use Page\Front\EntryConfirmPage; +use Page\Front\EntryPage; /** * @group front @@ -23,45 +25,47 @@ class EF04CustomerCest public function customer_会員登録正常(\AcceptanceTester $I) { $I->wantTo('EF0401-UC01-T01 会員登録 正常パターン'); - $I->amOnPage('/entry'); $faker = Fixtures::get('faker'); $BaseInfo = Fixtures::get('baseinfo'); $new_email = microtime(true).'.'.$faker->safeEmail; + // 会員情報入力フォームに、会員情報を入力する // 「同意する」ボタンを押下する - $form = [ - 'entry[name][name01]' => '姓', - 'entry[name][name02]' => '名', - 'entry[kana][kana01]' => 'セイ', - 'entry[kana][kana02]' => 'メイ', - 'entry[postal_code]' => '530-0001', - 'entry[address][pref]' => ['value' => '27'], - 'entry[address][addr01]' => '大阪市北区', - 'entry[address][addr02]' => '梅田2-4-9 ブリーゼタワー13F', - 'entry[phone_number]' => '111-111-111', - 'entry[email][first]' => $new_email, - 'entry[email][second]' => $new_email, - 'entry[password][first]' => 'password', - 'entry[password][second]' => 'password', - 'entry[job]' => ['value' => '1'], - 'entry[user_policy_check]' => '1', - ]; + $EntryPage = EntryPage::go($I) + ->入力_姓('姓') + ->入力_名('名') + ->入力_姓カナ('セイ') + ->入力_名カナ('メイ') + ->入力_郵便番号('530-0001') + ->入力_都道府県(['value' => '27']) + ->入力_市区町村('大阪市北区') + ->入力_住所('梅田2-4-9 ブリーゼタワー13F') + ->入力_電話番号('111-111-111') + ->入力_メールアドレス($new_email) + ->入力_メールアドレス確認($new_email) + ->入力_パスワード('password') + ->入力_パスワード確認('password') + ->入力_職業(['value' => '1']) + ->入力_利用規約同意(); $findPluginByCode = Fixtures::get('findPluginByCode'); $Plugin = $findPluginByCode('MailMagazine'); if ($Plugin) { $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します'); $form['entry[mailmaga_flg]'] = '1'; } - $I->submitForm(['css' => '.ec-layoutRole__main form'], $form, ['css' => 'button.ec-blockBtn--action']); + $EntryPage->同意して登録(); // 入力した会員情報を確認する。 - $I->see('姓 名', '.ec-registerRole form .ec-borderedDefs dl:nth-child(1) dd'); - $I->see('111111111', '.ec-registerRole form .ec-borderedDefs dl:nth-child(5) dd'); - $I->see($new_email, '.ec-registerRole form .ec-borderedDefs dl:nth-child(6) dd'); + $EntryConfirmPage = EntryConfirmPage::at($I); + $I->assertEquals('姓 名', $EntryConfirmPage->お名前()); + $I->assertEquals('セイ メイ', $EntryConfirmPage->お名前カナ()); + $I->assertEquals('〒5300001 大阪府 大阪市北区 梅田2-4-9 ブリーゼタワー13F', $EntryConfirmPage->住所()); + $I->assertEquals('111111111', $EntryConfirmPage->電話番号()); + $I->assertEquals($new_email, $EntryConfirmPage->メールアドレス()); + $I->assertEquals('公務員', $EntryConfirmPage->職業()); $I->resetEmails(); - // 「会員登録をする」ボタンを押下する - $I->click('.ec-registerRole form button.ec-blockBtn--action'); + $EntryConfirmPage->会員登録をする(); $I->seeEmailCount(2); foreach ([$new_email, $BaseInfo->getEmail01()] as $email) { @@ -96,28 +100,29 @@ public function customer_会員登録正常(\AcceptanceTester $I) public function customer_会員登録異常1(\AcceptanceTester $I) { $I->wantTo('EF0401-UC01-T02 会員登録 異常パターン 重複'); - $I->amOnPage('/entry'); $createCustomer = Fixtures::get('createCustomer'); $customer = $createCustomer(); // 会員情報入力フォームに、会員情報を入力する // 「同意する」ボタンを押下する - $I->submitForm(['css' => '.ec-layoutRole__main form'], [ - 'entry[name][name01]' => '姓', - 'entry[name][name02]' => '名', - 'entry[kana][kana01]' => 'セイ', - 'entry[kana][kana02]' => 'メイ', - 'entry[postal_code]' => '530-0001', - 'entry[address][pref]' => ['value' => '27'], - 'entry[address][addr01]' => '大阪市北区', - 'entry[address][addr02]' => '梅田2-4-9 ブリーゼタワー13F', - 'entry[phone_number]' => '111-111-111', - 'entry[email][first]' => $customer->getEmail(), // 会員登録済みのメールアドレスを入力する - 'entry[email][second]' => $customer->getEmail(), - 'entry[password][first]' => 'password', - 'entry[password][second]' => 'password', - ], ['css' => 'button.ec-blockBtn--action']); + EntryPage::go($I) + ->入力_姓('姓') + ->入力_名('名') + ->入力_姓カナ('セイ') + ->入力_名カナ('メイ') + ->入力_郵便番号('530-0001') + ->入力_都道府県(['value' => '27']) + ->入力_市区町村('大阪市北区') + ->入力_住所('梅田2-4-9 ブリーゼタワー13F') + ->入力_電話番号('111-111-111') + ->入力_メールアドレス($customer->getEmail()) // 会員登録済みのメールアドレスを入力する + ->入力_メールアドレス確認($customer->getEmail()) + ->入力_パスワード('password') + ->入力_パスワード確認('password') + ->入力_職業(['value' => '1']) + ->入力_利用規約同意() + ->同意して登録(); // 入力した会員情報を確認する。 $I->see('このメールアドレスは利用できません', '.ec-registerRole form .ec-borderedDefs dl:nth-child(6) dd'); @@ -126,33 +131,32 @@ public function customer_会員登録異常1(\AcceptanceTester $I) public function customer_会員登録異常2(\AcceptanceTester $I) { $I->wantTo('EF0401-UC01-T03 会員登録 異常パターン 入力ミス'); - $I->amOnPage('/entry'); $faker = Fixtures::get('faker'); $new_email = microtime(true).'.'.$faker->safeEmail; // 会員情報入力フォームに、会員情報を入力する // 「同意する」ボタンを押下する - $I->submitForm(['css' => '.ec-layoutRole__main form'], [ - 'entry[name][name01]' => '', - 'entry[name][name02]' => '名', - 'entry[kana][kana01]' => 'セイ', - 'entry[kana][kana02]' => 'メイ', - 'entry[postal_code]' => '530-0001', - 'entry[address][pref]' => ['value' => '27'], - 'entry[address][addr01]' => '大阪市北区', - 'entry[address][addr02]' => '梅田2-4-9 ブリーゼタワー13F', - 'entry[phone_number]' => '111-111-111', - 'entry[email][first]' => $new_email, - 'entry[email][second]' => $new_email, - 'entry[password][first]' => 'password', - 'entry[password][second]' => 'password', - ], ['css' => 'button.ec-blockBtn--action']); + EntryPage::go($I) + ->入力_姓('') + ->入力_名('名') + ->入力_姓カナ('セイ') + ->入力_名カナ('メイ') + ->入力_郵便番号('530-0001') + ->入力_都道府県(['value' => '27']) + ->入力_市区町村('大阪市北区') + ->入力_住所('梅田2-4-9 ブリーゼタワー13F') + ->入力_電話番号('111-111-111') + ->入力_メールアドレス($new_email) + ->入力_メールアドレス確認($new_email) + ->入力_パスワード('password') + ->入力_パスワード確認('password') + ->入力_職業(['value' => '1']) + ->入力_利用規約同意() + ->同意して登録(); // 入力した会員情報を確認する。 $I->see('新規会員登録', '.ec-pageHeader h1'); - - // TODO [fixture] 確認画面のあとでのメールアドレス重複エラー } public function customer_会員登録同意しない(\AcceptanceTester $I) @@ -174,23 +178,22 @@ public function customer_会員登録戻る(\AcceptanceTester $I) // 会員情報入力フォームに、会員情報を入力する // 「同意する」ボタンを押下する - $form = [ - 'entry[name][name01]' => '姓', - 'entry[name][name02]' => '名', - 'entry[kana][kana01]' => 'セイ', - 'entry[kana][kana02]' => 'メイ', - 'entry[postal_code]' => '530-0001', - 'entry[address][pref]' => ['value' => '27'], - 'entry[address][addr01]' => '大阪市北区', - 'entry[address][addr02]' => '梅田2-4-9 ブリーゼタワー13F', - 'entry[phone_number]' => '111-111-111', - 'entry[email][first]' => $new_email, - 'entry[email][second]' => $new_email, - 'entry[password][first]' => 'password', - 'entry[password][second]' => 'password', - 'entry[job]' => ['value' => '1'], - 'entry[user_policy_check]' => '1', - ]; + $EntryPage = EntryPage::go($I) + ->入力_姓('姓') + ->入力_名('名') + ->入力_姓カナ('セイ') + ->入力_名カナ('メイ') + ->入力_郵便番号('530-0001') + ->入力_都道府県(['value' => '27']) + ->入力_市区町村('大阪市北区') + ->入力_住所('梅田2-4-9 ブリーゼタワー13F') + ->入力_電話番号('111-111-111') + ->入力_メールアドレス($new_email) + ->入力_メールアドレス確認($new_email) + ->入力_パスワード('password') + ->入力_パスワード確認('password') + ->入力_職業(['value' => '1']) + ->入力_利用規約同意(); $findPluginByCode = Fixtures::get('findPluginByCode'); $Plugin = $findPluginByCode('MailMagazine'); @@ -198,10 +201,12 @@ public function customer_会員登録戻る(\AcceptanceTester $I) $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します'); $form['entry[mailmaga_flg]'] = '1'; } - $I->submitForm(['css' => '.ec-layoutRole__main form'], $form, ['css' => 'button.ec-blockBtn--action']); + $EntryPage->同意して登録(); - $I->click('.ec-registerRole form button.ec-blockBtn--cancel'); - $I->see('新規会員登録', '.ec-pageHeader h1'); + EntryConfirmPage::at($I) + ->戻る(); + + EntryPage::at($I); } public function customer_会員登録利用規約(\AcceptanceTester $I) diff --git a/codeception/acceptance/EF07BasicCustomerOptionCest.php b/codeception/acceptance/EF07BasicCustomerOptionCest.php new file mode 100644 index 00000000000..9a0449e61a9 --- /dev/null +++ b/codeception/acceptance/EF07BasicCustomerOptionCest.php @@ -0,0 +1,190 @@ +loginAsAdmin(); + ShopSettingPage::go($I) + ->切替_カナ必須項目(false) + ->登録(); + } + + /** + * @group require_kana + * @before disableOptionRequireKana + */ + public function test_新規会員登録(\AcceptanceTester $I) + { + $I->wantTo('カナ入力なしで会員登録できる'); + + $faker = Fixtures::get('faker'); + $new_email = microtime(true).'.'.$faker->safeEmail; + + // 新規会員登録 + EntryPage::go($I) + ->入力_姓('姓') + ->入力_名('名') + ->入力_姓カナ('') + ->入力_名カナ('') + ->入力_郵便番号('530-0001') + ->入力_都道府県(['value' => '27']) + ->入力_市区町村('大阪市北区') + ->入力_住所('梅田2-4-9 ブリーゼタワー13F') + ->入力_電話番号('111-111-111') + ->入力_メールアドレス($new_email) + ->入力_メールアドレス確認($new_email) + ->入力_パスワード('password') + ->入力_パスワード確認('password') + ->入力_職業(['value' => '1']) + ->入力_利用規約同意() + ->同意して登録(); + + EntryConfirmPage::at($I); + } + + /** + * @group require_kana + * @before disableOptionRequireKana + */ + public function test_お届け先追加(\AcceptanceTester $I) + { + $I->wantTo('カナ入力なしでお届け先を追加できる'); + + $I->logoutAsMember(); + + $createCustomer = Fixtures::get('createCustomer'); + /** @var Customer $customer */ + $customer = $createCustomer(); + $I->loginAsMember($customer->getEmail(), 'password'); + CustomerAddressAddPage::go($I) + ->入力_姓('性') + ->入力_名('名') + ->入力_セイ('') + ->入力_メイ('') + ->入力_郵便番号('060-0000') + ->入力_都道府県(['1' => '北海道']) + ->入力_市区町村名('bbb') + ->入力_番地_ビル名('bbb') + ->入力_電話番号('111-111-111') + ->登録する(); + + CustomerAddressListPage::at($I); + } + + /** + * @group require_kana + * @before disableOptionRequireKana + */ + public function test_ゲスト購入(\AcceptanceTester $I) + { + $I->wantTo('カナ入力なしでゲスト購入できる'); + + $I->logoutAsMember(); + + $faker = Fixtures::get('faker'); + $new_email = microtime(true).'.'.$faker->safeEmail; + $BaseInfo = Fixtures::get('baseinfo'); + + ProductDetailPage::go($I, 2) + ->カートに入れる(1) + ->カートへ進む(); + + CartPage::go($I) + ->レジに進む(); + + $ShoppingLoginPage = ShoppingLoginPage::at($I)->ゲスト購入(); + $ShoppingLoginPage + ->入力_姓('姓') + ->入力_名('名') + ->入力_セイ('') + ->入力_メイ('') + ->入力_郵便番号('530-0001') + ->入力_都道府県(['value' => '27']) + ->入力_市区町村名('大阪市北区') + ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F') + ->入力_電話番号('111-111-111') + ->入力_Eメール($new_email) + ->入力_Eメール確認($new_email) + ->次へ(); + + ShoppingPage::at($I); + } + + /** + * @group require_kana + * @before disableOptionRequireKana + */ + public function test_受注出荷登録(\AcceptanceTester $I) + { + $I->wantTo('カナ入力なしで受注/出荷登録できる'); + + // 受注登録 + $OrderEditPage = OrderEditPage::go($I) + ->入力_支払方法(['4' => '郵便振替']) + ->入力_姓('order1') + ->入力_名('order1') + ->入力_セイ('') + ->入力_メイ('') + ->入力_郵便番号('060-0000') + ->入力_都道府県(['1' => '北海道']) + ->入力_市区町村名('bbb') + ->入力_番地_ビル名('bbb') + ->入力_Eメール('test@test.com') + ->入力_電話番号('111-111-111') + ->注文者情報をコピー() + ->入力_配送業者([1 => 'サンプル業者']) + ->商品検索('チェリーアイスサンド') + ->商品検索結果_選択(1) + ->受注情報登録(); + + $I->see('保存しました', OrderEditPage::$登録完了メッセージ); + + // 出荷登録 + $OrderEditPage->お届け先の追加(); + + ShippingEditPage::at($I) + ->入力_姓('aaa') + ->入力_セイ('') + ->入力_メイ('') + ->入力_郵便番号('060-0000') + ->入力_都道府県(['1' => '北海道']) + ->入力_市区町村名('bbb') + ->入力_番地_ビル名('bbb') + ->入力_電話番号('111-111-111') + ->入力_番地_ビル名('address 2') + ->出荷情報登録(); + + $I->see('保存しました', ShippingEditPage::$登録完了メッセージ); + } +}