convert timesheets to UTC with support for user timezone (#372)
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace App\Tests\Repository;
|
||||
|
||||
use App\Entity\Activity;
|
||||
use App\Entity\Project;
|
||||
use App\Entity\Timesheet;
|
||||
use App\Entity\User;
|
||||
use App\Repository\Query\BaseQuery;
|
||||
@@ -93,4 +95,28 @@ class TimesheetRepositoryTest extends AbstractRepositoryTest
|
||||
$this->assertTrue($result);
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getEnd());
|
||||
}
|
||||
|
||||
public function testSave()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$activityRepository = $em->getRepository(Activity::class);
|
||||
$activity = $activityRepository->find(1);
|
||||
$projectRepository = $em->getRepository(Project::class);
|
||||
$project = $projectRepository->find(1);
|
||||
|
||||
$user = $this->getUserByRole($em, User::ROLE_USER);
|
||||
$repository = $em->getRepository(Timesheet::class);
|
||||
$timesheet = new Timesheet();
|
||||
$timesheet
|
||||
->setBegin(new \DateTime())
|
||||
->setEnd(new \DateTime())
|
||||
->setDescription('foo')
|
||||
->setUser($user)
|
||||
->setActivity($activity)
|
||||
->setProject($project);
|
||||
|
||||
$this->assertNull($timesheet->getId());
|
||||
$repository->save($timesheet);
|
||||
$this->assertEquals(1, $timesheet->getId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user