Skip to content

Commit

Permalink
Merge pull request #6 from skuhnow/master
Browse files Browse the repository at this point in the history
feat: make custom fields protected to allow overrides in custom baske…
  • Loading branch information
mathielen authored Nov 5, 2024
2 parents 5691215 + 747fb09 commit 6ac3f74
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Mathielen/SapOci/Model/OciBaseBasketItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ class OciBaseBasketItem implements OciBasketItemInterface

private ?string $sldSysName = null;

private ?string $custField1 = null;
protected ?string $custField1 = null;

private ?string $custField2 = null;
protected ?string $custField2 = null;

private ?string $custField3 = null;
protected ?string $custField3 = null;

private ?string $custField4 = null;
protected ?string $custField4 = null;

private ?string $custField5 = null;
protected ?string $custField5 = null;

public static function create(): self
{
Expand Down
27 changes: 27 additions & 0 deletions tests/unit/Mathielen/SapOci/Model/OciExtendedBasketItemTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Mathielen\SapOci\Model;

use PHPUnit\Framework\TestCase;

class OciExtendedBasketItemTest extends TestCase
{

public function testSetOverriddenCustomField(): void
{
$sut = new OciExtendedBasketItem();
$testString21Chars = \str_repeat('x', 21);
$sut->setCustField4($testString21Chars);
$this->assertEquals($testString21Chars, $sut->getCustField4());
}
}

class OciExtendedBasketItem extends OciBaseBasketItem
{
public function setCustField4(?string $custField4 = null): OciBaseBasketItem
{
$this->custField4 = $custField4;

return $this;
}
}

0 comments on commit 6ac3f74

Please sign in to comment.