fix tests

This commit is contained in:
Jonny Barnes 2017-06-13 18:17:27 +01:00
parent dece5c8d0a
commit e409cf68f9
2 changed files with 3 additions and 4 deletions

View file

@ -96,13 +96,13 @@ class MicropubController extends Controller
$data['published'] = $request->input('properties.published')[0];
//create checkin place
if (array_key_exists('checkin', $request->input('properties'))) {
$data['checkin'] = $request->input('properties.checkin.0.properties.url.0');
$data['swarm-url'] = $request->input('properties.syndication.0');
try {
$place = $this->placeService->createPlaceFromCheckin($request->input('properties.checkin.0'));
$data['checkin'] = $place->longurl;
} catch (\Exception $e) {
$data['checkin'] = null;
$data['swarm-url'] = null;
}
}
} else {

View file

@ -46,8 +46,7 @@ class NoteService
//uri of form http://host/places/slug, we want slug
//get the URL path, then take last part, we can hack with basename
//as path looks like file path.
$slug = basename(parse_url($data['location'], PHP_URL_PATH));
$place = Place::where('slug', $slug)->first();
$place = Place::where('slug', basename(parse_url($data['location'], PHP_URL_PATH)))->first();
$note->place()->associate($place);
}
if (substr($data['location'], 0, 4) == 'geo:') {
@ -61,7 +60,7 @@ class NoteService
}
if (array_key_exists('checkin', $data) && $data['checkin'] !== null) {
$place = Place::where('foursquare', $data['checkin'])->first();
$place = Place::where('slug', basename(parse_url($data['checkin'], PHP_URL_PATH)))->first();
if ($place !== null) {
$note->place()->associate($place);
$note->swarm_url = $data['swarm-url'];