-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from aligent/feature/get-customer-by-id
Add helper to get customer by id.
- Loading branch information
Showing
5 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
### New Features | ||
|
||
Implemented create and update Product Variant as this has been missed previously. | ||
Until BigCommerce decide to be consistent and include a _Get Customer_ endpoint, add `CustomersApi::getById(int $id)`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,31 @@ public function testCanGetCustomers() | |
$this->setReturnData('customers__get_all.json'); | ||
$customersResponse = $this->getApi()->customers()->getAll(); | ||
$this->assertEquals(1, $customersResponse->getPagination()->total); | ||
$this->assertEquals('Jan', $customersResponse->getCustomers()[0]->first_name); | ||
$this->assertEquals('John', $customersResponse->getCustomers()[0]->first_name); | ||
} | ||
|
||
public function testCanGetCustomerByEmail() | ||
{ | ||
$this->markTestIncomplete(); | ||
$this->setReturnData('customers__get_all.json'); | ||
$customer = $this->getApi()->customers()->getByEmail('[email protected]'); | ||
|
||
$this->assertEquals('John', $customer->first_name); | ||
} | ||
|
||
public function testCanGetCustomerById() | ||
{ | ||
$this->setReturnData('customers__get_all.json'); | ||
$customer = $this->getApi()->customers()->getById(1); | ||
|
||
$this->assertEquals('[email protected]', $customer->email); | ||
} | ||
|
||
public function testCanGetNullCustomerById() | ||
{ | ||
$this->setReturnData('customers__get_all_no_results.json'); | ||
$customer = $this->getApi()->customers()->getById(2); | ||
|
||
$this->assertNull($customer); | ||
} | ||
|
||
public function testCanCreateCustomers() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,9 @@ | |
}, | ||
"company": "Aligent", | ||
"customer_group_id": 1, | ||
"email": "[email protected]", | ||
"first_name": "Jan", | ||
"last_name": "Plank", | ||
"email": "[email protected]", | ||
"first_name": "John", | ||
"last_name": "Smith", | ||
"notes": "", | ||
"phone": "", | ||
"registration_ip_address": "", | ||
|
12 changes: 12 additions & 0 deletions
12
tests/BigCommerce/responses/customers__get_all_no_results.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"data": [], | ||
"meta": { | ||
"pagination": { | ||
"total": 0, | ||
"count": 0, | ||
"per_page": 50, | ||
"current_page": 1, | ||
"total_pages": 1 | ||
} | ||
} | ||
} |