diff --git a/README.md b/README.md index d8a59736..703259cc 100644 --- a/README.md +++ b/README.md @@ -300,8 +300,8 @@ n98-magerun2.phar customer:add-address [email] [website] [--firstname=STRING] [- Examples: ```sh -n98-magerun2.phar customer:add-address test@mail.de base --firstname="John" --lastname="Doe" --street="Pariser Platz" --city="Berlin" --country="DE" --postcode="10117" --telephone="1234567890" # add address of brandenburger tor to customer with email "test@mail.de" in website "base" -n98-magerun2.phar customer:add-address test@mail.de base --firstname="John" --lastname="Doe" --street="Pariser Platz" --city="Berlin" --country="DE" --postcode="10117" --telephone="1234567890" --default-billing --default-shipping # add address of brandenburger tor to customer with email "test@mail.de" in website "base" as default billing and shipping +n98-magerun2.phar customer:add-address foo@example.com base --firstname="John" --lastname="Doe" --street="Pariser Platz" --city="Berlin" --country="DE" --postcode="10117" --telephone="1234567890" # add address of brandenburger tor to customer with email "foo@example.com" in website "base" +n98-magerun2.phar customer:add-address foo@example.com base --firstname="John" --lastname="Doe" --street="Pariser Platz" --city="Berlin" --country="DE" --postcode="10117" --telephone="1234567890" --default-billing --default-shipping # add address of brandenburger tor to customer with email "foo@example.com" in website "base" as default billing and shipping ``` Adds a customer address to given customer defined by email and website diff --git a/src/N98/Magento/Command/Customer/AddAddressCommand.php b/src/N98/Magento/Command/Customer/AddAddressCommand.php index 98570259..7e7c3322 100644 --- a/src/N98/Magento/Command/Customer/AddAddressCommand.php +++ b/src/N98/Magento/Command/Customer/AddAddressCommand.php @@ -114,7 +114,8 @@ protected function execute(InputInterface $input, OutputInterface $output) try { $customer = $this->customerRepository->get($email, $website->getId()); } catch (NoSuchEntityException $e) { - $output->writeln("Customer with email '$email' not found in website '$website'."); + $websiteCode = $website->getCode(); + $output->writeln("Customer with email '$email' not found in website '$websiteCode'."); return Command::FAILURE; } diff --git a/tests/bats/functional_magerun_commands.bats b/tests/bats/functional_magerun_commands.bats index 88f4471f..f626a3e0 100755 --- a/tests/bats/functional_magerun_commands.bats +++ b/tests/bats/functional_magerun_commands.bats @@ -185,8 +185,8 @@ function cleanup_files_in_magento() { } @test "Command: customer:add-address" { - run $BIN "customer:add-address" test@mail.de base --firstname="John" --lastname="Doe" --street="Pariser Platz" --city="Berlin" --country="DE" --postcode="10117" --telephone="1234567890" --default-billing --default-shipping - assert_output --partial "Address added successfully to customer test@mail.de" + run $BIN "customer:add-address" foo@example.com base --firstname="John" --lastname="Doe" --street="Pariser Platz" --city="Berlin" --country="DE" --postcode="10117" --telephone="1234567890" --default-billing --default-shipping + assert_output --partial "Address added successfully to customer foo@example.com" } @test "Command: db:add-default-authorization-entries" {