Skip to content

Commit

Permalink
Fix code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints authored and github-actions[bot] committed Sep 2, 2024
1 parent 812e279 commit e78b942
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 33 deletions.
4 changes: 1 addition & 3 deletions src/Exceptions/VATCheckUnavailableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Exception;

class VATCheckUnavailableException extends Exception
{
}
class VATCheckUnavailableException extends Exception {}
4 changes: 2 additions & 2 deletions tests/Rules/ValidVatNumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testValidatesUnavailableVATNumberCheck()
VatCalculator::shouldReceive('isValidVATNumber')
->with($vatNumber)
->once()
->andThrow(new VATCheckUnavailableException());
->andThrow(new VATCheckUnavailableException);

$validator = Validator::make(
['vat_number' => $vatNumber],
Expand All @@ -82,7 +82,7 @@ public function testDefaultErrorMessageWorks()
VatCalculator::shouldReceive('isValidVATNumber')
->with($vatNumber)
->once()
->andThrow(new VATCheckUnavailableException());
->andThrow(new VATCheckUnavailableException);

$validator = Validator::make(
['vat_number' => $vatNumber],
Expand Down
10 changes: 5 additions & 5 deletions tests/Traits/BillableWithinTheEUTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testTaxPercentZeroByDefault()
->with(null, false)
->andReturn(0);

$billable = new BillableWithinTheEUTestStub();
$billable = new BillableWithinTheEUTestStub;
$taxPercent = $billable->getTaxPercent();
$this->assertEquals(0, $taxPercent);
}
Expand All @@ -44,7 +44,7 @@ public function testTaxPercentGetsCalculated()
->with($countryCode, $company)
->andReturn(0.19);

$billable = new BillableWithinTheEUTestStub();
$billable = new BillableWithinTheEUTestStub;
$billable->setTaxForCountry($countryCode, $company);
$taxPercent = $billable->getTaxPercent();
$this->assertEquals(19, $taxPercent);
Expand All @@ -59,7 +59,7 @@ public function testTaxPercentGetsCalculatedByUseTaxFrom()
->with($countryCode, $company)
->andReturn(0.19);

$billable = new BillableWithinTheEUTestStub();
$billable = new BillableWithinTheEUTestStub;
$billable->useTaxFrom($countryCode);
$taxPercent = $billable->getTaxPercent();
$this->assertEquals(19, $taxPercent);
Expand All @@ -74,7 +74,7 @@ public function testTaxPercentGetsCalculatedByUseTaxFromAsBusinessCustomer()
->with($countryCode, $company)
->andReturn(0);

$billable = new BillableWithinTheEUTestStub();
$billable = new BillableWithinTheEUTestStub;
$billable->useTaxFrom($countryCode)->asBusiness();
$taxPercent = $billable->getTaxPercent();
$this->assertEquals(0, $taxPercent);
Expand All @@ -90,7 +90,7 @@ public function testTaxPercentGetsCalculatedByUseTaxFromAsIndividual()
->with($countryCode, $company)
->andReturn(0.19);

$billable = new BillableWithinTheEUTestStub();
$billable = new BillableWithinTheEUTestStub;
$billable->useTaxFrom($countryCode)->asIndividual();
$taxPercent = $billable->getTaxPercent();
$this->assertEquals(19, $taxPercent);
Expand Down
46 changes: 23 additions & 23 deletions tests/VatCalculatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testCalculateVatWithoutCountryAndConfig()
{
$net = 25.00;

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$result = $vatCalculator->calculate($net);
$this->assertEquals(25.00, $result);
}
Expand Down Expand Up @@ -74,7 +74,7 @@ public function testCalculateVatWithPredefinedRulesWithoutConfig()
$net = 24.00;
$countryCode = 'DE';

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$result = $vatCalculator->calculate($net, $countryCode);
$this->assertEquals(28.56, $result);
$this->assertEquals(0.19, $vatCalculator->getTaxRate());
Expand Down Expand Up @@ -132,7 +132,7 @@ public function testCalculatVatWithCountryDirectSetWithoutConfiguration()
$net = 24.00;
$countryCode = 'DE';

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$result = $vatCalculator->calculate($net, $countryCode);
$this->assertEquals(28.56, $result);
$this->assertEquals(0.19, $vatCalculator->getTaxRate());
Expand Down Expand Up @@ -303,7 +303,7 @@ public function testCanValidateValidVATNumber()
->with('vat_calculator', [])
->andReturn([]);

$result = new \stdClass();
$result = new \stdClass;
$result->valid = true;

$vatCheck = $this->getMockFromWsdl(__DIR__.'/checkVatService.wsdl', 'VATService');
Expand All @@ -324,7 +324,7 @@ public function testCanValidateValidVATNumber()

public function testCanValidateInvalidVATNumber()
{
$result = new \stdClass();
$result = new \stdClass;
$result->valid = false;

$vatCheck = $this->getMockFromWsdl(__DIR__.'/checkVatService.wsdl', 'VATService');
Expand All @@ -337,7 +337,7 @@ public function testCanValidateInvalidVATNumber()
->willReturn($result);

$vatNumber = 'SomeInvalidNumber';
$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$vatCalculator->setSoapClient($vatCheck);
$result = $vatCalculator->isValidVATNumber($vatNumber);
$this->assertFalse($result);
Expand All @@ -355,7 +355,7 @@ public function testValidateVATNumberReturnsFalseOnSoapFailure()
->willThrowException(new \SoapFault('Server', 'Something went wrong'));

$vatNumber = 'SomeInvalidNumber';
$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$vatCalculator->setSoapClient($vatCheck);
$result = $vatCalculator->isValidVATNumber($vatNumber);
$this->assertFalse($result);
Expand Down Expand Up @@ -414,11 +414,11 @@ public function testCannotValidateVATNumberWhenServiceIsDown()
{
$this->expectException(VATCheckUnavailableException::class);

$result = new \stdClass();
$result = new \stdClass;
$result->valid = false;

$vatNumber = 'SomeInvalidNumber';
$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$vatCalculator->setSoapClient(false);
$vatCalculator->isValidVATNumber($vatNumber);
}
Expand All @@ -431,7 +431,7 @@ public function testCanValidateValidUKVATNumber()
->with('vat_calculator', [])
->andReturn([]);

$result = new \stdClass();
$result = new \stdClass;
$result->valid = true;

$vatNumber = 'GB 553557881';
Expand All @@ -448,7 +448,7 @@ public function testCanValidateInvalidUKVATNumber()
->with('vat_calculator', [])
->andReturn([]);

$result = new \stdClass();
$result = new \stdClass;
$result->valid = true;

$vatNumber = 'GB Invalid';
Expand Down Expand Up @@ -480,7 +480,7 @@ public function testCompanyInBusinessCountryGetsValidVATRateDirectSet()
$net = 24.00;
$countryCode = 'DE';

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$vatCalculator->setBusinessCountryCode('DE');
$result = $vatCalculator->calculate($net, $countryCode, null, true);
$this->assertEquals(28.56, $result);
Expand All @@ -493,7 +493,7 @@ public function testCompanyOutsideBusinessCountryGetsValidVATRate()
$net = 24.00;
$countryCode = 'DE';

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$vatCalculator->setBusinessCountryCode('NL');
$result = $vatCalculator->calculate($net, $countryCode, null, true);
$this->assertEquals(24.00, $result);
Expand All @@ -506,7 +506,7 @@ public function testReturnsZeroForInvalidCountryCode()
$net = 24.00;
$countryCode = 'XXX';

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$result = $vatCalculator->calculate($net, $countryCode, null, true);
$this->assertEquals(24.00, $result);
$this->assertEquals(0.00, $vatCalculator->getTaxRate());
Expand All @@ -516,7 +516,7 @@ public function testReturnsZeroForInvalidCountryCode()
public function testChecksPostalCodeForVATExceptions()
{
$net = 24.00;
$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$postalCode = '27498'; // Heligoland
$result = $vatCalculator->calculate($net, 'DE', $postalCode, false);
$this->assertEquals(24.00, $result);
Expand Down Expand Up @@ -551,7 +551,7 @@ public function testChecksPostalCodeForVATExceptions()
public function testPostalCodesWithoutExceptionsGetStandardRate()
{
$net = 24.00;
$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;

// Invalid post code
$postalCode = 'IGHJ987ERT35';
Expand Down Expand Up @@ -602,7 +602,7 @@ public function testPostalCodesWithoutExceptionsOverwrittenByConfiguration()

public function testShouldCollectVAT()
{
$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$this->assertTrue($vatCalculator->shouldCollectVAT('DE'));
$this->assertTrue($vatCalculator->shouldCollectVAT('NL'));
$this->assertFalse($vatCalculator->shouldCollectVAT(''));
Expand Down Expand Up @@ -647,7 +647,7 @@ public function testCalculateNetPriceWithoutCountryAndConfig()
{
$gross = 25.00;

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$result = $vatCalculator->calculateNet($gross);
$this->assertEquals(25.00, $result);
}
Expand Down Expand Up @@ -675,7 +675,7 @@ public function testCalculateNetPriceWithPredefinedRulesWithoutConfig()
$gross = 28.56;
$countryCode = 'DE';

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$result = $vatCalculator->calculateNet($gross, $countryCode);
$this->assertEquals(24.00, $result);
$this->assertEquals(0.19, $vatCalculator->getTaxRate());
Expand Down Expand Up @@ -733,7 +733,7 @@ public function testCalculateNetPriceWithCountryDirectSetWithoutConfiguration()
$gross = 28.56;
$countryCode = 'DE';

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;

$result = $vatCalculator->calculateNet($gross, $countryCode);
$this->assertEquals(24.00, $result);
Expand Down Expand Up @@ -835,7 +835,7 @@ public function testCalculateHighVatType()
$type = 'high';
$postalCode = null;

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$result = $vatCalculator->calculate($gross, $countryCode, $postalCode, $company, $type);

$this->assertEquals(29.04, $result);
Expand All @@ -849,7 +849,7 @@ public function testCalculateLowVatType()
$type = 'low';
$postalCode = null;

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;
$result = $vatCalculator->calculate($gross, $countryCode, $postalCode, $company, $type);

$this->assertEquals(26.16, $result);
Expand Down Expand Up @@ -927,7 +927,7 @@ public function testIsValidVatNumberFormat()
'SK1234567890',
];

$vatCalculator = new VatCalculator();
$vatCalculator = new VatCalculator;

foreach ($valid as $format) {
$this->assertTrue($vatCalculator->isValidVatNumberFormat($format), "{$format} did not pass validation.");
Expand Down

0 comments on commit e78b942

Please sign in to comment.