Skip to content

Commit

Permalink
Revert classification enum check in InvoiceDetails::set() model.
Browse files Browse the repository at this point in the history
  • Loading branch information
firebed committed Oct 22, 2024
1 parent a8fe1f7 commit 0c36813
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
3 changes: 0 additions & 3 deletions src/Models/InvoiceDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,6 @@ public function setNotVAT195(?bool $notVAT195): static
public function set($key, $value): static
{
if (($key === 'expensesClassification' || $key === 'incomeClassification') && !is_array($value)) {
if (!($value instanceof IncomeClassification || $value instanceof ExpensesClassification)) {
throw new InvalidArgumentException("Invalid value for key $key.");
}
return $this->push($key, $value);
}

Expand Down
12 changes: 0 additions & 12 deletions tests/InvoiceDetailsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
use Firebed\AadeMyData\Models\IncomeClassification;
use Firebed\AadeMyData\Models\Invoice;
use Firebed\AadeMyData\Models\InvoiceDetails;
use Firebed\AadeMyData\Models\PaymentMethod;
use Firebed\AadeMyData\Models\Ship;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use Tests\Traits\HandlesInvoiceXml;

Expand Down Expand Up @@ -146,13 +143,4 @@ public function test_it_converts_xml_to_invoice_rows(): void
$this->assertEquals(1000, $ecls2->getAmount());
$this->assertEquals(3, $ecls2->getId());
}

public function test_it_catches_invalid_classification_arguments()
{
$this->expectException(InvalidArgumentException::class);

$details = new InvoiceDetails();
$details->set('expensesClassification', new PaymentMethod());
$details->set('incomeClassification', new Ship());
}
}

0 comments on commit 0c36813

Please sign in to comment.