From 3afdc68b2947b0a498dbc98844b7f56d515d3eca Mon Sep 17 00:00:00 2001 From: Ibrahimhizeoui Date: Sun, 27 Aug 2017 07:51:36 +0200 Subject: [PATCH] change item no to string (#36) * change item no to string * cs fix --- src/Api/Item.php | 6 +++--- src/Model/Item/BaseItem.php | 10 +++++----- tests/Api/InvoiceTest.php | 6 +++--- tests/Api/ItemTest.php | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Api/Item.php b/src/Api/Item.php index c248d59..f4502da 100644 --- a/src/Api/Item.php +++ b/src/Api/Item.php @@ -36,14 +36,14 @@ public function search(array $param = []) } /** - * @param int $itemNo - * @param array $param + * @param string $itemNo + * @param array $param * * @return mixed|\Psr\Http\Message\ResponseInterface * * @see https://billogram.com/api/documentation#items_fetch */ - public function fetch(int $itemNo, array $param = []) + public function fetch(string $itemNo, array $param = []) { $response = $this->httpGet('/item/'.$itemNo, $param); if (!$this->hydrator) { diff --git a/src/Model/Item/BaseItem.php b/src/Model/Item/BaseItem.php index a8f5ae4..72815dd 100644 --- a/src/Model/Item/BaseItem.php +++ b/src/Model/Item/BaseItem.php @@ -12,7 +12,7 @@ abstract class BaseItem implements CreatableFromArray { /** - * @var int + * @var string */ protected $itemNo; @@ -57,19 +57,19 @@ abstract class BaseItem implements CreatableFromArray protected $updatedAt; /** - * @return int + * @return string */ - public function getItemNo(): int + public function getItemNo() { return $this->itemNo; } /** - * @param int $itemNo + * @param string $itemNo * * @return Item */ - public function withItemNo(int $itemNo) + public function withItemNo(string $itemNo) { $new = clone $this; $new->itemNo = $itemNo; diff --git a/tests/Api/InvoiceTest.php b/tests/Api/InvoiceTest.php index c74060e..47cc375 100644 --- a/tests/Api/InvoiceTest.php +++ b/tests/Api/InvoiceTest.php @@ -30,7 +30,7 @@ public function testCreate() $customer = new Customer(); $customer = $customer->withCustomerNo(23); $item2 = new Item(); - $item2 = $item2->withItemNo(25); + $item2 = $item2->withItemNo('25'); $item2 = $item2->withCount(5); $item2 = $item2->withDiscount(0); $invoice = new Invoice(); @@ -50,11 +50,11 @@ public function testPut() $customer = new Customer(); $customer = $customer->withCustomerNo(25); $item1 = new Item(); - $item1 = $item1->withItemNo(3); + $item1 = $item1->withItemNo('3'); $item1 = $item1->withCount(5); $item1 = $item1->withDiscount(0); $item2 = new Item(); - $item2 = $item2->withItemNo(2); + $item2 = $item2->withItemNo('2'); $item2 = $item2->withCount(2); $item2 = $item2->withDiscount(1); $apiClient = BillogramClient::create('20561-3vhGtAxH', '4eddc2ab063bdd53dc64836ff3a0c7bc'); diff --git a/tests/Api/ItemTest.php b/tests/Api/ItemTest.php index c11148a..db26cce 100644 --- a/tests/Api/ItemTest.php +++ b/tests/Api/ItemTest.php @@ -46,7 +46,7 @@ public function testCreate() public function testUpdate() { $bookkeeping = Bookkeeping::createFromArray(['income_account' => '302', 'vat_account' => '303']); - $item = $this->testFetch(3); + $item = $this->testFetch('3'); $item = $item->withTitle('cc'); $item = $item->withDescription('cc'); $item = $item->withPrice(12); @@ -71,7 +71,7 @@ public function testDelete(int $itemNo = 9) $this->assertInstanceOf(Item::class, $customerDeleted); } - public function testFetch(int $itemNo = 10) + public function testFetch(string $itemNo = '10') { $cacheClient = $this->getHttpClient(); $httpClientConfigurator = new HttpClientConfigurator($cacheClient);