From 5986a842fcd8b5b1004a09b94e1653b5bfdbf701 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 19 Aug 2024 17:29:18 +0200 Subject: [PATCH] fix: Remove superfluous if checks --- .../CustomerSearchBundleDBAL/TestCase.php | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/Functional/Bundle/CustomerSearchBundleDBAL/TestCase.php b/tests/Functional/Bundle/CustomerSearchBundleDBAL/TestCase.php index ccc4df2dd05..8ce0a674512 100644 --- a/tests/Functional/Bundle/CustomerSearchBundleDBAL/TestCase.php +++ b/tests/Functional/Bundle/CustomerSearchBundleDBAL/TestCase.php @@ -126,20 +126,18 @@ protected function createCustomer(array $customer) unset($customerData['addresses'], $customerData['orders'], $customerData['newsletter']); $customerId = $this->insert('s_user', $customerData); - if (\array_key_exists('addresses', $customer)) { - foreach ($customer['addresses'] as $address) { - $address['user_id'] = $customerId; - $addressId = $this->insert('s_user_addresses', $address); - - $this->connection->update( - 's_user', - [ - 'default_billing_address_id' => $addressId, - 'default_shipping_address_id' => $addressId, - ], - ['id' => $customerId] - ); - } + foreach ($customer['addresses'] as $address) { + $address['user_id'] = $customerId; + $addressId = $this->insert('s_user_addresses', $address); + + $this->connection->update( + 's_user', + [ + 'default_billing_address_id' => $addressId, + 'default_shipping_address_id' => $addressId, + ], + ['id' => $customerId] + ); } if (\array_key_exists('orders', $customer)) { @@ -159,11 +157,9 @@ protected function createCustomer(array $customer) $order['userID'] = $customerId; $orderId = $this->insert('s_order', $order); - if (\array_key_exists('details', $order)) { - foreach ($order['details'] as $detail) { - $detail['orderID'] = $orderId; - $this->insert('s_order_details', $detail); - } + foreach ($order['details'] as $detail) { + $detail['orderID'] = $orderId; + $this->insert('s_order_details', $detail); } } }