/**
  * @param string              $id
  * @param ProductDataTransfer $data
  *
  * @return bool
  */
 public function update($id, ProductDataTransfer $data)
 {
     $endpoint = new Update($this->getTransport());
     $endpoint->setId($id);
     $endpoint->setTransfer($data);
     try {
         $result = $endpoint->performRequest();
     } catch (ResourceNotFoundException $e) {
         return false;
     }
     return $result['status'] == 204;
 }
Exemplo n.º 2
0
 public function testInstance()
 {
     /** @var \Mockery\Mock|\Hitmeister\Component\Api\Transfers\ProductDataTransfer $transfer */
     $transfer = \Mockery::mock('\\Hitmeister\\Component\\Api\\Transfers\\ProductDataTransfer');
     $transfer->shouldReceive('toArray')->once()->andReturn(['condition' => 'new']);
     $update = new Update($this->transport);
     $update->setId('1231231231232');
     $update->setTransfer($transfer);
     $this->assertInstanceOf('\\Hitmeister\\Component\\Api\\Transfers\\ProductDataTransfer', $update->getTransfer());
     $this->assertEquals('1231231231232', $update->getId());
     $this->assertEquals([], $update->getParamWhiteList());
     $this->assertEquals('PATCH', $update->getMethod());
     $this->assertEquals('product-data/1231231231232/', $update->getURI());
     $body = $update->getBody();
     $this->assertArrayHasKey('condition', $body);
 }