Skip to content

Commit

Permalink
Fixed tests and test assets
Browse files Browse the repository at this point in the history
  • Loading branch information
ruff committed Dec 26, 2022
1 parent fe5ea82 commit 9bb7577
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
Binary file modified tests/assets/reader-order-x-comfort.pdf
Binary file not shown.
44 changes: 34 additions & 10 deletions tests/testcases/OrderDocumentPdfReaderComfortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testGetDocumentInformation(): void

$this->assertEquals("PO123456789", $documentNo);
$this->assertEquals(OrderDocumentTypes::ORDER, $documentTypeCode);
$this->assertEquals("25.12.2022", $documentDate->format('d.m.Y'));
$this->assertEquals("26.12.2022", $documentDate->format('d.m.Y'));
$this->assertEquals("EUR", $documentCurrency);
$this->assertEquals("Doc Name", $documentName);
$this->assertEmpty($documentLanguageId);
Expand All @@ -96,7 +96,7 @@ public function testGetIsDocumentCopy(): void
self::$document->getIsDocumentCopy($documentIsCopy);

$this->assertNotNull($documentIsCopy);
$this->assertFalse($documentIsCopy);
$this->assertTrue($documentIsCopy);
}

/**
Expand Down Expand Up @@ -1156,9 +1156,9 @@ public function testGetDocumentRequestedDeliverySupplyChainEvent(): void
$this->assertNotNull($occurrenceDateTime);
$this->assertNotNull($startDateTime);
$this->assertNotNull($endDateTime);
$this->assertEquals("25.12.2022", $occurrenceDateTime->format('d.m.Y'));
$this->assertEquals("25.12.2022", $startDateTime->format('d.m.Y'));
$this->assertEquals("25.12.2022", $endDateTime->format('d.m.Y'));
$this->assertEquals("26.12.2022", $occurrenceDateTime->format('d.m.Y'));
$this->assertEquals("26.12.2022", $startDateTime->format('d.m.Y'));
$this->assertEquals("26.12.2022", $endDateTime->format('d.m.Y'));
}

/**
Expand Down Expand Up @@ -1486,7 +1486,7 @@ public function testGetDocumentReceivableSpecifiedTradeAccountingAccount(): void
self::$document->getDocumentReceivableSpecifiedTradeAccountingAccount($id, $typeCode);

$this->assertEquals("BUYER_ACCOUNT_REF", $id);
$this->assertEquals("", $typeCode);
$this->assertEquals("BUYER_ACCOUNT_REF_TYPE", $typeCode);
}

/**
Expand Down Expand Up @@ -2665,7 +2665,7 @@ public function testGetDocumentPositionGrossPriceAllowanceChargePos1(): void
$this->assertEquals(0, $sequence);
$this->assertEquals(0, $basisQuantity);
$this->assertEquals("", $basisQuantityUnitCode);
$this->assertEquals("", $reasonCode);
$this->assertEquals("95", $reasonCode);

self::$document->nextDocumentPositionGrossPriceAllowanceCharge();
self::$document->getDocumentPositionGrossPriceAllowanceCharge($actualAmount, $isCharge, $calculationPercent, $basisAmount, $reason, $taxTypeCode, $taxCategoryCode, $rateApplicablePercent, $sequence, $basisQuantity, $basisQuantityUnitCode, $reasonCode);
Expand All @@ -2681,7 +2681,7 @@ public function testGetDocumentPositionGrossPriceAllowanceChargePos1(): void
$this->assertEquals(0, $sequence);
$this->assertEquals(0, $basisQuantity);
$this->assertEquals("", $basisQuantityUnitCode);
$this->assertEquals("", $reasonCode);
$this->assertEquals("AEW", $reasonCode);

$this->assertFalse(self::$document->nextDocumentPositionGrossPriceAllowanceCharge());
}
Expand All @@ -2707,7 +2707,7 @@ public function testGetDocumentPositionGrossPriceAllowanceChargePos2(): void
$this->assertEquals(0, $sequence);
$this->assertEquals(0, $basisQuantity);
$this->assertEquals("", $basisQuantityUnitCode);
$this->assertEquals("", $reasonCode);
$this->assertEquals("AEW", $reasonCode);

$this->assertFalse(self::$document->nextDocumentPositionGrossPriceAllowanceCharge());
}
Expand Down Expand Up @@ -3468,7 +3468,7 @@ public function testFirstDocumentPositionTaxPos1(): void
{
self::$document->firstDocumentPosition();

$this->assertFalse(self::$document->firstDocumentPositionTax());
$this->assertTrue(self::$document->firstDocumentPositionTax());
}

/**
Expand Down Expand Up @@ -3519,4 +3519,28 @@ public function testNextDocumentPositionTaxPos3(): void
{
$this->assertFalse(self::$document->nextDocumentPositionTax());
}

/**
* @covers \horstoeko\orderx\OrderDocumentReader
* @covers \horstoeko\orderx\OrderObjectHelper
*/
public function testGetDocumentPositionTax(): void
{
self::$document->firstDocumentPosition();
self::$document->getDocumentPositionTax(
$categoryCode,
$typeCode,
$rateApplicablePercent,
$calculatedAmount,
$exemptionReason,
$exemptionReasonCode
);

$this->assertEquals("S", $categoryCode);
$this->assertEquals("VAT", $typeCode);
$this->assertEquals(19.0, $rateApplicablePercent);
$this->assertEquals(0.0, $calculatedAmount);
$this->assertEquals("", $exemptionReason);
$this->assertEquals("", $exemptionReasonCode);
}
}

0 comments on commit 9bb7577

Please sign in to comment.