prepare release 1.15 (#2707)
* bump version * fix invisible class on labels * fail safe removal of foreign key * check if optional form field exists before accessing it * silently ignore stopped timesheets * prevent colliding parameter names * make sure decimal duration is always rendered with two decimals * simplify translation * fix #2751 ANSI_QUOTES * rename composer task * fix billable statistic rates * added missing translation for export
This commit is contained in:
@@ -796,16 +796,6 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiCallValidationError($client->getResponse(), ['duration' => 'Maximum 12:30 hours allowed.']);
|
||||
}
|
||||
|
||||
public function testStopActionFailsOnStoppedEntry()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$timesheets = $this->importFixtureForUser(User::ROLE_USER);
|
||||
$id = $timesheets[0]->getId();
|
||||
$this->request($client, '/api/timesheets/' . $id . '/stop', 'PATCH');
|
||||
|
||||
$this->assertApi500Exception($client->getResponse(), 'Timesheet entry already stopped');
|
||||
}
|
||||
|
||||
public function testStopThrowsNotFound()
|
||||
{
|
||||
$this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/timesheets/11/stop', [], 'App\\Entity\\Timesheet object not found by the @ParamConverter annotation.');
|
||||
|
||||
@@ -21,7 +21,6 @@ use App\Event\TimesheetRestartPreEvent;
|
||||
use App\Repository\TimesheetRepository;
|
||||
use App\Timesheet\TimesheetService;
|
||||
use App\Timesheet\TrackingModeService;
|
||||
use App\Validator\ValidationException;
|
||||
use App\Validator\ValidationFailedException;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
@@ -246,15 +245,15 @@ class TimesheetServiceTest extends TestCase
|
||||
|
||||
public function testStoppedEntriesCannotBeStoppedAgain()
|
||||
{
|
||||
$dateTime = new \DateTime('-2 hours');
|
||||
$timesheet = new Timesheet();
|
||||
$timesheet->setEnd(new \DateTime());
|
||||
$timesheet->setEnd($dateTime);
|
||||
|
||||
$sut = $this->getSut();
|
||||
|
||||
$this->expectException(ValidationException::class);
|
||||
$this->expectExceptionMessage('Timesheet entry already stopped');
|
||||
|
||||
$sut->stopTimesheet($timesheet);
|
||||
|
||||
self::assertSame($dateTime->getTimestamp(), $timesheet->getEnd()->getTimestamp());
|
||||
}
|
||||
|
||||
public function testDeleteDispatchesEvent()
|
||||
|
||||
@@ -455,7 +455,7 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
$sut = $this->getSut($this->localeEn, 'en');
|
||||
|
||||
$this->assertEquals('00:00 h', $sut->duration(null));
|
||||
$this->assertEquals('0', $sut->duration(null, true));
|
||||
$this->assertEquals('0.00', $sut->duration(null, true));
|
||||
}
|
||||
|
||||
public function testDurationChart()
|
||||
@@ -483,15 +483,15 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
|
||||
// test negative duration
|
||||
$sut = $this->getSut($this->localeEn, 'en');
|
||||
$this->assertEquals('0', $sut->durationDecimal(-1));
|
||||
$this->assertEquals('0.00', $sut->durationDecimal(-1));
|
||||
|
||||
// test zero duration
|
||||
$sut = $this->getSut($this->localeEn, 'en');
|
||||
$this->assertEquals('0', $sut->durationDecimal(0));
|
||||
$this->assertEquals('0.00', $sut->durationDecimal(0));
|
||||
|
||||
$sut = $this->getSut($this->localeEn, 'en');
|
||||
|
||||
$this->assertEquals('0', $sut->durationDecimal(null));
|
||||
$this->assertEquals('0.00', $sut->durationDecimal(null));
|
||||
}
|
||||
|
||||
protected function getTimesheet($seconds)
|
||||
|
||||
@@ -199,18 +199,18 @@ class LocaleHelperTest extends TestCase
|
||||
$sut = $this->getSut('de');
|
||||
$this->assertEquals('2,62', $sut->durationDecimal($record->getDuration()));
|
||||
$this->assertEquals('6.328,89', $sut->durationDecimal(22784012));
|
||||
$this->assertEquals('1', $sut->durationDecimal(3600));
|
||||
$this->assertEquals('1,00', $sut->durationDecimal(3600));
|
||||
$this->assertEquals('1,01', $sut->durationDecimal(3630));
|
||||
$this->assertEquals('1,02', $sut->durationDecimal(3661));
|
||||
$this->assertEquals('1,1', $sut->durationDecimal(3960));
|
||||
$this->assertEquals('1,10', $sut->durationDecimal(3960));
|
||||
|
||||
// test negative duration
|
||||
$sut = $this->getSut('en');
|
||||
$this->assertEquals('0', $sut->durationDecimal(-1));
|
||||
$this->assertEquals('0.00', $sut->durationDecimal(-1));
|
||||
|
||||
// test zero duration
|
||||
$sut = $this->getSut('en');
|
||||
$this->assertEquals('0', $sut->durationDecimal(0));
|
||||
$this->assertEquals('0.00', $sut->durationDecimal(0));
|
||||
$this->assertEquals('6,328.89', $sut->durationDecimal(22784012));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user