Skip to content

Commit

Permalink
Merge pull request #304 from spurwork/ss-1131-2024-federal-taxes
Browse files Browse the repository at this point in the history
SS-1131 - 2024 social security tax
  • Loading branch information
stevespur authored Apr 11, 2024
2 parents a4afe5f + 64c25bb commit 82728ae
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Countries/US/SocialSecurity/V20240101/SocialSecurity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Appleton\Taxes\Countries\US\SocialSecurity\V20240101;

use Appleton\Taxes\Countries\US\SocialSecurity\SocialSecurity as BaseSocialSecurity;

class SocialSecurity extends BaseSocialSecurity
{
public const TAX_RATE = 0.062;
public const WAGE_BASE = 168600;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Appleton\Taxes\Countries\US\SocialSecurity\V20240101;

use Appleton\Taxes\Countries\US\SocialSecurity\SocialSecurityEmployer as BaseSocialSecurityEmployer;

class SocialSecurityEmployer extends BaseSocialSecurityEmployer
{
public const TAX_RATE = SocialSecurity::TAX_RATE;
public const WAGE_BASE = SocialSecurity::WAGE_BASE;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

namespace Appleton\Taxes\Tests\Unit\Countries\US\SocialSecurity\V20240101;

use Appleton\Taxes\Countries\US\SocialSecurity\SocialSecurityEmployer;
use Appleton\Taxes\Tests\Unit\Countries\TestParameters;
use Appleton\Taxes\Tests\Unit\Countries\TestParametersBuilder;
use Appleton\Taxes\Tests\Unit\Countries\WageBaseTaxTestCase;

class SocialSecurityEmployerTest extends WageBaseTaxTestCase
{
private const DATE = '2024-01-01';
private const LOCATION = 'us';
private const TAX_CLASS = SocialSecurityEmployer::class;
private const TAX_RATE = 0.062;
private const WAGE_BASE = 16860000;

public function setUp(): void
{
parent::setUp();
$this->query_runner->addTax(self::TAX_CLASS);
}

/**
* @dataProvider provideData
*/
public function testCases(TestParameters $parameters): void
{
$this->validate($parameters);
}

/**
* @dataProvider provideWageBaseData
*/
public function testWageBase(TestParameters $parameters): void
{
$this->validateWageBase($parameters);
}

public function provideData(): array
{
$builder = new TestParametersBuilder();
$builder
->setDate(self::DATE)
->setHomeLocation(self::LOCATION)
->setTaxClass(self::TAX_CLASS)
->setPayPeriods(52);

return [
'case study A' => [
$builder
->setWagesInCents(64000)
->setYtdWagesInCents(0)
->setExpectedAmountInCents(3968)
->setExpectedEarningsInCents(64000)
->build()
],
'case study B' => [
$builder
->setWagesInCents(77428)
->setYtdWagesInCents(0)
->setExpectedAmountInCents(4801)
->setExpectedEarningsInCents(77428)
->build()
],
'case study C' => [
$builder
->setWagesInCents(64000)
->setYtdWagesInCents(13300000)
->setExpectedAmountInCents(3968)
->setExpectedEarningsInCents(64000)
->build()
],
'case study D' => [
$builder
->setWagesInCents(77428)
->setYtdWagesInCents(13300000)
->setExpectedAmountInCents(4801)
->setExpectedEarningsInCents(77428)
->build()
],
];
}

public function provideWageBaseData(): array
{
return $this->wageBaseBoundariesTestCases(
self::DATE,
self::LOCATION,
self::TAX_CLASS,
self::WAGE_BASE,
self::TAX_RATE
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

namespace Appleton\Taxes\Tests\Unit\Countries\US\SocialSecurity\V20240101;

use Appleton\Taxes\Countries\US\SocialSecurity\SocialSecurity;
use Appleton\Taxes\Tests\Unit\Countries\TestParameters;
use Appleton\Taxes\Tests\Unit\Countries\TestParametersBuilder;
use Appleton\Taxes\Tests\Unit\Countries\WageBaseTaxTestCase;

class SocialSecurityTest extends WageBaseTaxTestCase
{
private const DATE = '2024-01-01';
private const LOCATION = 'us';
private const TAX_CLASS = SocialSecurity::class;
private const WAGE_BASE_IN_CENTS = 16860000;
private const TAX_RATE = 0.062;

public function setUp(): void
{
parent::setUp();
$this->query_runner->addTax(self::TAX_CLASS);
}

/**
* @dataProvider provideTestData
*/
public function testTax(TestParameters $parameters): void
{
$this->validate($parameters);
}

/**
* @dataProvider provideWageBaseTestData
*/
public function testWageBase(TestParameters $parameters): void
{
$this->validateWageBase($parameters);
}

public function provideTestData(): array
{
$builder = new TestParametersBuilder();
$builder
->setDate(self::DATE)
->setHomeLocation(self::LOCATION)
->setTaxClass(self::TAX_CLASS)
->setPayPeriods(52);

return [
'case study A' => [
$builder
->setWagesInCents(64000)
->setYtdLiabilitiesInCents(0)
->setExpectedAmountInCents(3968)
->setExpectedEarningsInCents(64000)
->build()
],
'case study B' => [
$builder
->setWagesInCents(77428)
->setYtdLiabilitiesInCents(0)
->setExpectedAmountInCents(4801)
->setExpectedEarningsInCents(77428)
->build()
],
'case study C' => [
$builder
->setWagesInCents(64000)
->setYtdLiabilitiesInCents(13300000)
->setExpectedAmountInCents(3968)
->setExpectedEarningsInCents(64000)
->build()
],
'case study D' => [
$builder
->setWagesInCents(77428)
->setYtdLiabilitiesInCents(13300000)
->setExpectedAmountInCents(4801)
->setExpectedEarningsInCents(77428)
->build()
],
];
}

public function provideWageBaseTestData(): array
{
return $this->wageBaseBoundariesTestCases(
self::DATE,
self::LOCATION,
self::TAX_CLASS,
self::WAGE_BASE_IN_CENTS,
self::TAX_RATE
);
}
}

0 comments on commit 82728ae

Please sign in to comment.