File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
src/BigCommerce/Api/Customers
tests/BigCommerce/Api/Customers Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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 " );
Original file line number Diff line number Diff 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 ' );
You can’t perform that action at this time.
0 commit comments