Skip to content

Commit

Permalink
feat: Add mocks for reading, upserting, and deleting Cronofy events
Browse files Browse the repository at this point in the history
  • Loading branch information
owenconti committed Jan 13, 2022
1 parent 21b3d2e commit 474f739
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fixtures/cronofy/responses/v1/calendars/:id/events/post.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"event_id": "00000",
"summary": "Board meeting",
"description": "Discuss plans for the next quarter.",
"start": "2022-01-15T15:30:00Z",
"end": "2022-01-15T17:00:00Z",
"location": {
"description": "Board room"
}
}
45 changes: 45 additions & 0 deletions fixtures/cronofy/responses/v1/events/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"pages": {
"current": 1,
"total": 2,
"next_page": "https://api.cronofy.com/v1/events/pages/08a07b034306679e"
},
"events": [
{
"calendar_id": "cal_00000",
"event_uid": "evt_external_00000",
"summary": "Company Retreat",
"description": "",
"start": "2014-09-06",
"end": "2014-09-08",
"deleted": false,
"created": "2022-01-14T08:00:01Z",
"updated": "2022-01-14T09:24:16Z",
"location": {
"description": "Beach"
},
"participation_status": "needs_action",
"attendees": [
{
"email": "[email protected]",
"display_name": "Example Person",
"status": "needs_action"
}
],
"organizer": {
"email": "[email protected]",
"display_name": "Example Person"
},
"transparency": "opaque",
"status": "confirmed",
"categories": [],
"recurring": false,
"event_private": false,
"options": {
"delete": true,
"update": true,
"change_participation_status": true
}
}
]
}
18 changes: 18 additions & 0 deletions src/Providers/Cronofy/Events/DeleteEventMock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace OhSeeSoftware\LaravelVeneer\Providers\Cronofy\Events;

use OhSeeSoftware\LaravelVeneer\Providers\MockedMethod;

class DeleteEventMock extends MockedMethod
{
public function fixturePath(): ?string
{
return null;
}

public function method(): string
{
return 'deleteEvent';
}
}
18 changes: 18 additions & 0 deletions src/Providers/Cronofy/Events/ReadEventsMock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace OhSeeSoftware\LaravelVeneer\Providers\Cronofy\Events;

use OhSeeSoftware\LaravelVeneer\Providers\MockedMethod;

class ReadEventsMock extends MockedMethod
{
public function fixturePath(): ?string
{
return 'cronofy/responses/v1/events/index.json';
}

public function method(): string
{
return 'readEvents';
}
}
18 changes: 18 additions & 0 deletions src/Providers/Cronofy/Events/UpsertEventMock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace OhSeeSoftware\LaravelVeneer\Providers\Cronofy\Events;

use OhSeeSoftware\LaravelVeneer\Providers\MockedMethod;

class UpsertEventMock extends MockedMethod
{
public function fixturePath(): ?string
{
return 'cronofy/responses/v1/calendars/:id/events/post.json';
}

public function method(): string
{
return 'upsertEvent';
}
}

0 comments on commit 474f739

Please sign in to comment.