Skip to content

Commit

Permalink
Merge pull request #48 from HPInc/feat-set-sourceComponentId
Browse files Browse the repository at this point in the history
feat: set sourceComponentId on component
  • Loading branch information
joseandrespg authored Aug 16, 2023
2 parents 7bd4ab0 + 320e84f commit fd7dd02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/order/orderData/item/component/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class OneFlowComponent extends OneFlowBase {
*/
public function init() {
$this->__addProperty("componentId");
$this->__addProperty("sourceComponentId");
$this->__addProperty("type");
$this->__addProperty("code");
$this->__addProperty("path");
Expand Down Expand Up @@ -269,6 +270,17 @@ public function setComponentId($componentId) {
$this->componentId = $componentId;
}

/**
* setSourceComponentId function.
*
* @access public
* @param mixed $sourceComponentId
* @return void
*/
public function setSourceComponentId($sourceComponentId) {
$this->sourceComponentId = $sourceComponentId;
}

/**
* addAttribute function.
*
Expand Down
2 changes: 2 additions & 0 deletions tests/order/orderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function testCanBuildASingleItemOrder()
]);

$component = $item->newComponent('componentCode');
$component->setSourceComponentId('my-source-component-id');
$component->setFetchUrl('http://site.com/file.pdf');
$component->setLocalFile(false);
$component->setBarcode('customComponentBarcode');
Expand Down Expand Up @@ -151,6 +152,7 @@ public function testCanBuildASingleItemOrder()
$this->assertEquals(1, count($outputItem->components));
$outputComponent = $outputItem->components[0];
$this->assertEquals('componentCode', $outputComponent->code);
$this->assertEquals('my-source-component-id', $outputComponent->sourceComponentId);
$this->assertEquals('http://site.com/file.pdf', $outputComponent->path);
$this->assertEquals('customComponentBarcode', $outputComponent->barcode);
$this->assertEquals(true, $outputComponent->fetch);
Expand Down

0 comments on commit fd7dd02

Please sign in to comment.