Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from Jaimies/master
Add "RFF" Segment
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace EdifactParser\Segments; | ||
|
||
/** @psalm-immutable */ | ||
class RFFReference implements SegmentInterface | ||
{ | ||
public function __construct(private array $rawValues) | ||
{ | ||
} | ||
|
||
public function tag(): string | ||
{ | ||
return self::class; | ||
} | ||
public function subId(): string | ||
{ | ||
return $this->rawValues[1][0]; | ||
} | ||
public function rawValues(): array | ||
{ | ||
return $this->rawValues; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace EdifactParser\Tests\Unit\Segments; | ||
|
||
use EdifactParser\Segments\RFFReference; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class RFFReferenceTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function segment_values(): void | ||
{ | ||
$rawValues = ['RFF', ['ADE', '123413287423784']]; | ||
$segment = new RFFReference($rawValues); | ||
|
||
self::assertEquals(RFFReference::class, $segment->tag()); | ||
self::assertEquals('ADE', $segment->subId()); | ||
self::assertEquals($rawValues, $segment->rawValues()); | ||
} | ||
} |