mirror of
https://github.com/Karaka-Management/oms-Calendar.git
synced 2026-02-14 15:38:40 +00:00
bug and media fixes
This commit is contained in:
parent
97f7fb6f91
commit
bf290b7fcc
|
|
@ -200,10 +200,10 @@ class Calendar
|
||||||
public function toArray() : array
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'description' => $this->description,
|
'description' => $this->description,
|
||||||
'createdAt' => $this->createdAt,
|
'createdAt' => $this->createdAt,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -356,17 +356,17 @@ class Event
|
||||||
public function toArray() : array
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'description' => $this->description,
|
'description' => $this->description,
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'status' => $this->status,
|
'status' => $this->status,
|
||||||
'schedule' => $this->schedule,
|
'schedule' => $this->schedule,
|
||||||
'location' => $this->location,
|
'location' => $this->location,
|
||||||
'calendar' => $this->calendar,
|
'calendar' => $this->calendar,
|
||||||
'people' => $this->people,
|
'people' => $this->people,
|
||||||
'tags' => $this->tags,
|
'tags' => $this->tags,
|
||||||
'createdAt' => $this->createdAt,
|
'createdAt' => $this->createdAt,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Modules\Calendar\Models;
|
||||||
*/
|
*/
|
||||||
final class NullCalendar extends Calendar
|
final class NullCalendar extends Calendar
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param int $id Model id
|
* @param int $id Model id
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Modules\Calendar\Models;
|
||||||
*/
|
*/
|
||||||
final class NullEvent extends Event
|
final class NullEvent extends Event
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param int $id Model id
|
* @param int $id Model id
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Modules\Calendar\Models;
|
||||||
*/
|
*/
|
||||||
final class NullSchedule extends Schedule
|
final class NullSchedule extends Schedule
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param int $id Model id
|
* @param int $id Model id
|
||||||
|
|
|
||||||
|
|
@ -302,16 +302,16 @@ class Schedule
|
||||||
public function toArray() : array
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'uuid' => $this->uid,
|
'uuid' => $this->uid,
|
||||||
'status' => $this->status,
|
'status' => $this->status,
|
||||||
'freqType' => $this->freqType,
|
'freqType' => $this->freqType,
|
||||||
'freqInterval' => $this->freqInterval,
|
'freqInterval' => $this->freqInterval,
|
||||||
'relativeInternal' => $this->relativeInternal,
|
'relativeInternal' => $this->relativeInternal,
|
||||||
'intervalType' => $this->intervalType,
|
'intervalType' => $this->intervalType,
|
||||||
'recurrenceFactor' => $this->recurrenceFactor,
|
'recurrenceFactor' => $this->recurrenceFactor,
|
||||||
'start' => $this->start,
|
'start' => $this->start,
|
||||||
'createdAt' => $this->createdAt,
|
'createdAt' => $this->createdAt,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -392,4 +392,4 @@ function phpServe() : void
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
phpServe();
|
\phpServe();
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testHasEventOnDate() : void
|
public function testHasEventOnDate() : void
|
||||||
{
|
{
|
||||||
$event = new Event();
|
$event = new Event();
|
||||||
$event->schedule->start = new \DateTime('2005-10-09');
|
$event->schedule->start = new \DateTime('2005-10-09');
|
||||||
|
|
||||||
$this->calendar->addEvent($event);
|
$this->calendar->addEvent($event);
|
||||||
|
|
@ -130,8 +130,8 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetEventsOnDate() : void
|
public function testGetEventsOnDate() : void
|
||||||
{
|
{
|
||||||
$event = new Event();
|
$event = new Event();
|
||||||
$event->name = 'Test';
|
$event->name = 'Test';
|
||||||
$event->schedule->start = new \DateTime('2005-10-09');
|
$event->schedule->start = new \DateTime('2005-10-09');
|
||||||
|
|
||||||
$this->calendar->addEvent($event);
|
$this->calendar->addEvent($event);
|
||||||
|
|
@ -145,7 +145,7 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testSerialize() : void
|
public function testSerialize() : void
|
||||||
{
|
{
|
||||||
$this->calendar->name = 'Name';
|
$this->calendar->name = 'Name';
|
||||||
$this->calendar->description = 'Description';
|
$this->calendar->description = 'Description';
|
||||||
|
|
||||||
$serialized = $this->calendar->jsonSerialize();
|
$serialized = $this->calendar->jsonSerialize();
|
||||||
|
|
@ -153,8 +153,8 @@ final class CalendarTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'name' => 'Name',
|
'name' => 'Name',
|
||||||
'description' => 'Description',
|
'description' => 'Description',
|
||||||
],
|
],
|
||||||
$serialized
|
$serialized
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ final class EventMapperTest extends \PHPUnit\Framework\TestCase
|
||||||
$calendarEvent1->description = 'Desc1';
|
$calendarEvent1->description = 'Desc1';
|
||||||
$calendarEvent1->setCreatedBy(new NullAccount(1));
|
$calendarEvent1->setCreatedBy(new NullAccount(1));
|
||||||
$calendarEvent1->schedule->createdBy = new NullAccount(1);
|
$calendarEvent1->schedule->createdBy = new NullAccount(1);
|
||||||
$calendarEvent1->calendar = 1;
|
$calendarEvent1->calendar = 1;
|
||||||
|
|
||||||
$id = EventMapper::create($calendarEvent1);
|
$id = EventMapper::create($calendarEvent1);
|
||||||
self::assertGreaterThan(0, $calendarEvent1->getId());
|
self::assertGreaterThan(0, $calendarEvent1->getId());
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ final class EventTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testSerialize() : void
|
public function testSerialize() : void
|
||||||
{
|
{
|
||||||
$this->event->name = 'Name';
|
$this->event->name = 'Name';
|
||||||
$this->event->description = 'Description';
|
$this->event->description = 'Description';
|
||||||
$this->event->setType(EventType::TEMPLATE);
|
$this->event->setType(EventType::TEMPLATE);
|
||||||
$this->event->setStatus(EventStatus::INACTIVE);
|
$this->event->setStatus(EventStatus::INACTIVE);
|
||||||
|
|
@ -185,14 +185,14 @@ final class EventTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'name' => 'Name',
|
'name' => 'Name',
|
||||||
'description' => 'Description',
|
'description' => 'Description',
|
||||||
'type' => EventType::TEMPLATE,
|
'type' => EventType::TEMPLATE,
|
||||||
'status' => EventStatus::INACTIVE,
|
'status' => EventStatus::INACTIVE,
|
||||||
'calendar' => 0,
|
'calendar' => 0,
|
||||||
'people' => [],
|
'people' => [],
|
||||||
'tags' => [],
|
'tags' => [],
|
||||||
],
|
],
|
||||||
$serialized
|
$serialized
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,12 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Calendar\tests\Models;
|
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\FrequencyInterval;
|
||||||
use Modules\Calendar\Models\FrequencyRelative;
|
use Modules\Calendar\Models\FrequencyRelative;
|
||||||
|
use Modules\Calendar\Models\FrequencyType;
|
||||||
use Modules\Calendar\Models\IntervalType;
|
use Modules\Calendar\Models\IntervalType;
|
||||||
|
use Modules\Calendar\Models\Schedule;
|
||||||
|
use Modules\Calendar\Models\ScheduleStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
|
@ -171,13 +169,13 @@ final class ScheduleTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'uuid' => '',
|
'uuid' => '',
|
||||||
'status' => ScheduleStatus::INACTIVE,
|
'status' => ScheduleStatus::INACTIVE,
|
||||||
'freqType' => FrequencyType::YEARLY,
|
'freqType' => FrequencyType::YEARLY,
|
||||||
'freqInterval' => FrequencyInterval::DAY,
|
'freqInterval' => FrequencyInterval::DAY,
|
||||||
'relativeInternal' => FrequencyRelative::LAST,
|
'relativeInternal' => FrequencyRelative::LAST,
|
||||||
'intervalType' => IntervalType::RELATIVE,
|
'intervalType' => IntervalType::RELATIVE,
|
||||||
'recurrenceFactor' => 0,
|
'recurrenceFactor' => 0,
|
||||||
],
|
],
|
||||||
$serialized
|
$serialized
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user