bug and media fixes

This commit is contained in:
Dennis Eichhorn 2021-10-29 14:49:55 +02:00
parent 97f7fb6f91
commit bf290b7fcc
11 changed files with 49 additions and 51 deletions

View File

@ -200,10 +200,10 @@ class Calendar
public function toArray() : array
{
return [
'id' => $this->id,
'name' => $this->name,
'id' => $this->id,
'name' => $this->name,
'description' => $this->description,
'createdAt' => $this->createdAt,
'createdAt' => $this->createdAt,
];
}

View File

@ -356,17 +356,17 @@ class Event
public function toArray() : array
{
return [
'id' => $this->id,
'name' => $this->name,
'id' => $this->id,
'name' => $this->name,
'description' => $this->description,
'type' => $this->type,
'status' => $this->status,
'schedule' => $this->schedule,
'location' => $this->location,
'calendar' => $this->calendar,
'people' => $this->people,
'tags' => $this->tags,
'createdAt' => $this->createdAt,
'type' => $this->type,
'status' => $this->status,
'schedule' => $this->schedule,
'location' => $this->location,
'calendar' => $this->calendar,
'people' => $this->people,
'tags' => $this->tags,
'createdAt' => $this->createdAt,
];
}

View File

@ -24,7 +24,7 @@ namespace Modules\Calendar\Models;
*/
final class NullCalendar extends Calendar
{
/**
/**
* Constructor
*
* @param int $id Model id

View File

@ -24,7 +24,7 @@ namespace Modules\Calendar\Models;
*/
final class NullEvent extends Event
{
/**
/**
* Constructor
*
* @param int $id Model id

View File

@ -24,7 +24,7 @@ namespace Modules\Calendar\Models;
*/
final class NullSchedule extends Schedule
{
/**
/**
* Constructor
*
* @param int $id Model id

View File

@ -302,16 +302,16 @@ class Schedule
public function toArray() : array
{
return [
'id' => $this->id,
'uuid' => $this->uid,
'status' => $this->status,
'freqType' => $this->freqType,
'freqInterval' => $this->freqInterval,
'id' => $this->id,
'uuid' => $this->uid,
'status' => $this->status,
'freqType' => $this->freqType,
'freqInterval' => $this->freqInterval,
'relativeInternal' => $this->relativeInternal,
'intervalType' => $this->intervalType,
'intervalType' => $this->intervalType,
'recurrenceFactor' => $this->recurrenceFactor,
'start' => $this->start,
'createdAt' => $this->createdAt,
'start' => $this->start,
'createdAt' => $this->createdAt,
];
}

View File

@ -392,4 +392,4 @@ function phpServe() : void
});
}
phpServe();
\phpServe();

View File

@ -116,7 +116,7 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase
*/
public function testHasEventOnDate() : void
{
$event = new Event();
$event = new Event();
$event->schedule->start = new \DateTime('2005-10-09');
$this->calendar->addEvent($event);
@ -130,8 +130,8 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase
*/
public function testGetEventsOnDate() : void
{
$event = new Event();
$event->name = 'Test';
$event = new Event();
$event->name = 'Test';
$event->schedule->start = new \DateTime('2005-10-09');
$this->calendar->addEvent($event);
@ -145,7 +145,7 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase
*/
public function testSerialize() : void
{
$this->calendar->name = 'Name';
$this->calendar->name = 'Name';
$this->calendar->description = 'Description';
$serialized = $this->calendar->jsonSerialize();
@ -153,8 +153,8 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase
self::assertEquals(
[
'id' => 0,
'name' => 'Name',
'id' => 0,
'name' => 'Name',
'description' => 'Description',
],
$serialized

View File

@ -35,7 +35,7 @@ final class EventMapperTest extends \PHPUnit\Framework\TestCase
$calendarEvent1->description = 'Desc1';
$calendarEvent1->setCreatedBy(new NullAccount(1));
$calendarEvent1->schedule->createdBy = new NullAccount(1);
$calendarEvent1->calendar = 1;
$calendarEvent1->calendar = 1;
$id = EventMapper::create($calendarEvent1);
self::assertGreaterThan(0, $calendarEvent1->getId());

View File

@ -173,7 +173,7 @@ final class EventTest extends \PHPUnit\Framework\TestCase
*/
public function testSerialize() : void
{
$this->event->name = 'Name';
$this->event->name = 'Name';
$this->event->description = 'Description';
$this->event->setType(EventType::TEMPLATE);
$this->event->setStatus(EventStatus::INACTIVE);
@ -185,14 +185,14 @@ final class EventTest extends \PHPUnit\Framework\TestCase
self::assertEquals(
[
'id' => 0,
'name' => 'Name',
'id' => 0,
'name' => 'Name',
'description' => 'Description',
'type' => EventType::TEMPLATE,
'status' => EventStatus::INACTIVE,
'calendar' => 0,
'people' => [],
'tags' => [],
'type' => EventType::TEMPLATE,
'status' => EventStatus::INACTIVE,
'calendar' => 0,
'people' => [],
'tags' => [],
],
$serialized
);

View File

@ -14,14 +14,12 @@ declare(strict_types=1);
namespace Modules\Calendar\tests\Models;
use Modules\Admin\Models\Account;
use Modules\Admin\Models\NullAccount;
use Modules\Calendar\Models\Schedule;
use Modules\Calendar\Models\ScheduleStatus;
use Modules\Calendar\Models\FrequencyType;
use Modules\Calendar\Models\FrequencyInterval;
use Modules\Calendar\Models\FrequencyRelative;
use Modules\Calendar\Models\FrequencyType;
use Modules\Calendar\Models\IntervalType;
use Modules\Calendar\Models\Schedule;
use Modules\Calendar\Models\ScheduleStatus;
/**
* @internal
@ -171,13 +169,13 @@ final class ScheduleTest extends \PHPUnit\Framework\TestCase
self::assertEquals(
[
'id' => 0,
'uuid' => '',
'status' => ScheduleStatus::INACTIVE,
'freqType' => FrequencyType::YEARLY,
'freqInterval' => FrequencyInterval::DAY,
'id' => 0,
'uuid' => '',
'status' => ScheduleStatus::INACTIVE,
'freqType' => FrequencyType::YEARLY,
'freqInterval' => FrequencyInterval::DAY,
'relativeInternal' => FrequencyRelative::LAST,
'intervalType' => IntervalType::RELATIVE,
'intervalType' => IntervalType::RELATIVE,
'recurrenceFactor' => 0,
],
$serialized