Skip to content

Commit

Permalink
change item no to string (#36)
Browse files Browse the repository at this point in the history
* change item no to string

* cs fix
  • Loading branch information
Ibrahimhizeoui authored and Nyholm committed Aug 27, 2017
1 parent b39fe35 commit 3afdc68
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/Api/Item.php
Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions src/Model/Item/BaseItem.php
Expand Up @@ -12,7 +12,7 @@
abstract class BaseItem implements CreatableFromArray
{
/**
* @var int
* @var string
*/
protected $itemNo;

Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions tests/Api/InvoiceTest.php
Expand Up @@ -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();
Expand All @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions tests/Api/ItemTest.php
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 3afdc68

Please sign in to comment.