Files
firefly-iii/tests/integration/Support/NavigationCustomEndOfPeriodTest.php
Antonio Spinelli dd2f8d4404 Cover endOfPeriod method of the Navigation class
The custom frequency requires a timezone configuration, forcing it
to run in the integration test scope.

Running the integration tests requires a database connection in the
build process. It enables other case tests.

The API Tests cause interference in other tests, requiring isolating
them.
2023-10-23 10:32:38 -03:00

26 lines
680 B
PHP

<?php
namespace Tests\integration\Support;
use Carbon\Carbon;
use FireflyIII\Support\Navigation;
use Tests\integration\TestCase;
class NavigationCustomEndOfPeriodTest extends TestCase
{
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testGivenADateAndCustomFrequencyWhenCalculateTheDateThenReturnsTheEndOfMonthSuccessful()
{
$from = Carbon::parse('2023-08-05');
$expected = Carbon::parse('2023-09-04');
$navigation = new Navigation();
$period = $navigation->endOfPeriod($from, 'custom');
$this->assertEquals($expected->toDateString(), $period->toDateString());
}
}