Skip to content

Commit b2c1627

Browse files
authored
Merge pull request #131 from aligent/release/1.8.1
Release/1.8.1
2 parents d6e1e7e + 9439793 commit b2c1627

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

RELEASE_NOTES.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
### New Features
1+
### Fixes
2+
3+
- Fixes _Undefined index within customer getByEmail method_ (thanks @dniccum)
24

3-
- Implement V2 Order Products API
4-
- Implement V2 Order Shipping Addresses API (read-only)
55

66

77

src/BigCommerce/Api/Customers/CustomersApi.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getByEmail(string $email): ?Customer
3333
{
3434
$customers = $this->getAll([self::FILTER__EMAIL_IN => $email])->getCustomers();
3535

36-
if (!$customers[0]) {
36+
if (count($customers) === 0) {
3737
return null;
3838
} elseif (count($customers) > 1) {
3939
throw new UnexpectedValueException("There are more than one customer with the email address $email");

tests/BigCommerce/Api/Customers/CustomersApiTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ public function testCanGetCustomerByEmail()
3838
$this->assertEquals('John', $customer->first_name);
3939
}
4040

41+
public function testUnknownCustomerReturnsEmptyResult()
42+
{
43+
$this->setReturnData('customers__get_all_no_results.json');
44+
$customer = $this->getApi()->customers()->getByEmail('[email protected]');
45+
46+
$this->assertNull($customer);
47+
}
48+
4149
public function testCanGetCustomerById()
4250
{
4351
$this->setReturnData('customers__get_all.json');

0 commit comments

Comments
 (0)