json( 'POST', 'api/post', [ 'type' => ['h-entry'], 'properties' => [ 'published' => [\Carbon\Carbon::now()->toDateTimeString()], 'syndication' => ['https://www.swarmapp.com/checkin/abc'], 'content' => [[ 'value' => 'My first #checkin using Example Product', 'html' => 'My first #checkin using Example Product', ]], 'checkin' => [[ 'type' => ['h-card'], 'properties' => [ 'name' => ['Awesome Venue'], 'url' => ['https://foursquare.com/v/123456'], 'latitude' => ['1.23'], 'longitude' => ['4.56'], ], ]], ], ], ['HTTP_Authorization' => 'Bearer ' . $this->getToken()] ); $response ->assertStatus(201) ->assertJson(['response' => 'created']); $this->assertDatabaseHas('places', [ 'foursquare' => 'https://foursquare.com/v/123456' ]); } /** * Generate a valid token to be used in the tests. * * @return Lcobucci\JWT\Token\Plain $token */ private function getToken() { $signer = new Sha256(); $token = (new Builder()) ->set('client_id', 'https://ownyourswarm.p3k.io') ->set('me', 'https://jonnybarnes.localhost') ->set('scope', 'create update') ->set('issued_at', time()) ->sign($signer, env('APP_KEY')) ->getToken(); return $token; } }