+ $this->assertActivityExists(ActivityType::API_TOKEN_UPDATE);
+ }
+
+ public function test_token_update_with_blank_expiry_sets_to_hundred_years_away()
+ {
+ $editor = $this->getEditor();
+ $this->asAdmin()->post($editor->getEditUrl('/create-api-token'), $this->testTokenData);
+ $token = ApiToken::query()->latest()->first();
+
+ $resp = $this->put($editor->getEditUrl('/api-tokens/' . $token->id), [
+ 'name' => 'My updated token',
+ 'expires_at' => '',
+ ]);
+ $token->refresh();
+
+ $over = Carbon::now()->addYears(101);
+ $under = Carbon::now()->addYears(99);
+ $this->assertTrue(
+ ($token->expires_at < $over && $token->expires_at > $under),
+ 'Token expiry set at 100 years in future'
+ );