Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/AbraFlexi/RW.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function assignResultIDs($candidates): void
{
foreach ($this->chained as $chid => $chained) {
$chainedEvidence = $chained->getEvidence();
$chainedExtid = $chained->getRecordID();
$chainedExtid = $chained->getRecordID() ?? '';

if (\is_array($chainedExtid)) { // if there are more IDs
foreach ($chainedExtid as $extId) { // find external ID in format ext:.....
Expand Down Expand Up @@ -253,7 +253,7 @@ public function extractResultIDs($resultInfo)
if (\array_key_exists('request-id', $insertResult)) {
$extid = $insertResult['request-id'];
} else {
$extid = null;
$extid = '';
}
Comment thread
Vitexus marked this conversation as resolved.

$evidence = explode('/', $insertResult['ref'])[3];
Expand Down
34 changes: 23 additions & 11 deletions tests/src/AbraFlexi/RWTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,29 @@ protected function tearDown(): void
// $this->markTestIncomplete('This test has not been implemented yet.');
// }
//
// /**
// * @covers \AbraFlexi\RW::extractResultIDs
// *
// * @todo Implement testextractResultIDs().
// */
// public function testextractResultIDs(): void
// {
// $this->assertEquals('', $this->object->extractResultIDs());
// // Remove the following lines when you implement this test.
// $this->markTestIncomplete('This test has not been implemented yet.');
// }
/**
* @covers \AbraFlexi\RW::extractResultIDs
*/
public function testextractResultIDs(): void
{
$resultInfo = [
[
'id' => 123,
'request-id' => 'ext:originalId:1',
'ref' => '/c/demo/faktura-vydana/123.json',
],
[
'id' => 124,
'ref' => '/c/demo/faktura-vydana/124.json',
],
];

$this->assertSame(
['faktura-vydana' => ['ext:originalId:1' => 123, '' => 124]],
$this->object->extractResultIDs($resultInfo),
);
}

//
// /**
// * @covers \AbraFlexi\RW::getLastInsertedId
Expand Down