added drag and drop for new records via calendar (#1962)

This commit is contained in:
Kevin Papst
2020-09-17 01:13:48 +02:00
committed by GitHub
parent 14b3de4300
commit 9ef32e75c5
82 changed files with 2808 additions and 385 deletions

View File

@@ -9,8 +9,9 @@
namespace App\Tests\Controller;
use App\Configuration\CalendarConfiguration;
use App\Configuration\SystemConfiguration;
use App\Tests\Configuration\TestConfigLoader;
use App\Tests\DataFixtures\TimesheetFixtures;
/**
* @group integration
@@ -25,21 +26,27 @@ class CalendarControllerTest extends ControllerBaseTest
public function testCalendarAction()
{
$client = $this->getClientForAuthenticatedUser();
$fixtures = new TimesheetFixtures($this->getUserByRole(), 10);
$fixtures->setStartDate(new \DateTime('-6 month'));
$this->importFixture($fixtures);
$this->request($client, '/calendar/');
$this->assertTrue($client->getResponse()->isSuccessful());
$crawler = $client->getCrawler();
$calendar = $crawler->filter('div#timesheet_calendar');
$this->assertEquals(1, $calendar->count());
$dragAndDropBoxes = $crawler->filter('div.box-body.drag-and-drop-source');
$this->assertEquals(1, $dragAndDropBoxes->count());
}
public function testCalendarActionWithGoogleSource()
{
$loader = new TestConfigLoader([]);
$config = new CalendarConfiguration($loader, $this->getDefaultSettings());
$config = new SystemConfiguration($loader, $this->getDefaultSettings());
$client = $this->getClientForAuthenticatedUser();
static::$kernel->getContainer()->set(CalendarConfiguration::class, $config);
static::$kernel->getContainer()->set(SystemConfiguration::class, $config);
$this->request($client, '/calendar/');
$this->assertTrue($client->getResponse()->isSuccessful());
@@ -57,32 +64,37 @@ class CalendarControllerTest extends ControllerBaseTest
protected function getDefaultSettings()
{
return [
'businessHours' => [
'days' => [2, 4, 6],
'begin' => '07:49',
'end' => '19:27'
'timesheet' => [
'default_begin' => '08:30:00',
],
'visibleHours' => [
'begin' => '07:49',
'end' => '19:27'
'calendar' => [
'businessHours' => [
'days' => [2, 4, 6],
'begin' => '07:49',
'end' => '19:27'
],
'visibleHours' => [
'begin' => '07:49',
'end' => '19:27'
],
'day_limit' => 20,
'week_numbers' => false,
'slot_duration' => '00:15:00',
'google' => [
'api_key' => 'wertwertwegsdfbdf243w567fg8ihuon',
'sources' => [
'holidays' => [
'id' => 'de.german#holiday@group.v.calendar.google.com',
'color' => '#ccc',
],
'holidays_en' => [
'id' => 'en.german#holiday@group.v.calendar.google.com',
'color' => '#fff',
],
]
],
'weekends' => true,
],
'day_limit' => 20,
'week_numbers' => false,
'slot_duration' => '00:15:00',
'google' => [
'api_key' => 'wertwertwegsdfbdf243w567fg8ihuon',
'sources' => [
'holidays' => [
'id' => 'de.german#holiday@group.v.calendar.google.com',
'color' => '#ccc',
],
'holidays_en' => [
'id' => 'en.german#holiday@group.v.calendar.google.com',
'color' => '#fff',
],
]
],
'weekends' => true,
];
}
}