trypost/tests/Feature
Paulo Castellano ee18b489e6 refactor(facebook): cleanup publishReel after review
Five small fixes scoped to the publishReel method:

1. Replace generic \Exception on media download failure with a typed
   FacebookPublishException(ServerError). The generic exception was
   landing in the \Throwable catch in PublishToSocialPlatform with
   category 'unknown', defeating the whole point of the social
   exception hierarchy.

2. Replace handleApiError($startResponse) with a direct
   FacebookPublishException throw when video_id/upload_url are missing.
   The previous code passed a successful HTTP response into a method
   built for error responses — fromApiResponse would fall into the
   default arm and surface 'An unknown Facebook error occurred.'
   ironically reintroducing the same bad UX we just spent the day
   fixing.

3. Drop the four redundant Log::error calls before handleApiError.
   FacebookPublishException::fromApiResponse already pulls the FB
   error code/subcode/message into platformErrorCode + userMessage,
   and the downstream catch in PublishToSocialPlatform::handle logs
   the exception anyway (Nightwatch picks that up). Same pattern as
   the X cleanup in PR #29.

4. Stream the upload body via fopen() resource instead of
   file_get_contents(). Eliminates loading the whole video into memory
   for large reels.

5. Replace \@unlink with unlink + Log::warning. Surfaces temp-file
   cleanup failures instead of silently leaking files.

Tests:
- Strengthened the missing-upload_url test to assert the exception
  message and class.
- Added a typed-exception test for the media-download failure path
  (would have caught the regression where we used a generic
  \Exception).
- Full suite green: 1505 passed, 2 skipped, 0 failed.
2026-05-12 20:43:32 -03:00
..
Actions feat: workspace-scoped broadcast channel and post lifecycle events 2026-05-07 16:02:22 -03:00
Ai chore: remove unused PlatformRules registry and rule classes 2026-05-11 21:08:43 -03:00
Api fix(posts): block scheduling when content exceeds any platform's char limit 2026-05-11 19:39:41 -03:00
Auth revert: keep one OAuth callback URL per provider 2026-05-04 19:42:13 -03:00
Commands fix(social): proactive token refresh actually refreshes (not just verifies) 2026-05-12 19:36:35 -03:00
Jobs fix(social): proactive token refresh actually refreshes (not just verifies) 2026-05-12 19:36:35 -03:00
Listeners chore: drop unused SubscriptionCreated event 2026-05-07 16:02:36 -03:00
Mcp refactor: move URL validation to the request layer with active_url 2026-05-04 14:35:28 -03:00
Middleware feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
Models fix: cast cached post count to int and align local cache default to redis 2026-05-07 14:31:07 -03:00
Services refactor(facebook): cleanup publishReel after review 2026-05-12 20:43:32 -03:00
Settings feat: implement consolidated authentication settings including session management and social provider integration 2026-05-03 17:42:44 -03:00
Social refactor: implement lazy token refreshing and persist Mastodon scopes 2026-05-03 21:58:25 -03:00
Workspace feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
AcceptInviteControllerTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
AccountControllerTest.php refactor: reorganize settings UI, migrate post templates to a file-based registry, and remove legacy video generation features 2026-05-03 13:44:13 -03:00
AiUsageLogTest.php feat: transition AI usage from feature-based limits to a centralized monthly credit system with token tracking. 2026-05-03 19:36:26 -03:00
ApiKeyControllerTest.php feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
AssetControllerTest.php refactor: centralize media size limits in config + drop Document type 2026-05-04 14:54:47 -03:00
BillingControllerTest.php feat(tracking): push Google Ads conversion data to dataLayer on purchase 2026-05-12 13:31:00 -03:00
ExampleTest.php refactor: settings redesign, Spanish translations, language system, strict_types 2026-03-30 00:20:43 -03:00
GitHubAuthToggleTest.php feat: capture signup UTMs/IP and add GitHub OAuth login 2026-05-04 18:42:25 -03:00
GoogleAuthToggleTest.php fix: keep Google OAuth routes always registered and add tests 2026-04-14 14:28:17 -03:00
InstagramFacebookIntegrationTest.php feat: add PostCommentCreated broadcast event 2026-04-15 20:11:36 -03:00
LimitEnforcementTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
NotificationControllerTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
PlanSeederTest.php feat: transition AI usage from feature-based limits to a centralized monthly credit system with token tracking. 2026-05-03 19:36:26 -03:00
PlanTest.php feat: transition AI usage from feature-based limits to a centralized monthly credit system with token tracking. 2026-05-03 19:36:26 -03:00
PostCommentControllerTest.php feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
PostControllerTest.php feat: pass and persist post dates through AI creation wizard and template application flows 2026-05-06 17:21:30 -03:00
PostSearchTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
PostTemplateControllerTest.php feat: pass and persist post dates through AI creation wizard and template application flows 2026-05-06 17:21:30 -03:00
SignupSuccessControllerTest.php refactor: code review fixes — policies, enums, data_get, tests 2026-03-31 00:40:18 -03:00
SocialAccountModelTest.php test(social-account): cover markAsDisconnected, notify flag, disconnected_at preservation, and i18n placeholder substitution 2026-05-12 19:17:16 -03:00
SocialAccountToggleTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
SocialControllerTest.php refactor: unify social analytics, reorganize workspace settings, and implement content validation rules 2026-05-02 12:22:42 -03:00
SocialLoginControllerTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
UpdatePostRequestTest.php fix(posts): block scheduling when content exceeds any platform's char limit 2026-05-11 19:39:41 -03:00
UsageControllerTest.php refactor: reorganize settings UI, migrate post templates to a file-based registry, and remove legacy video generation features 2026-05-03 13:44:13 -03:00
VerifyWorkspaceConnectionsTest.php fix: VerifyWorkspaceConnections uses TokenExpired/Disconnected escalation, eager load workspace 2026-04-01 11:52:03 -03:00
WorkspaceBillingTest.php feat: implement feature gating with persistent usage tracking and a reactive upgrade dialog for plan management. 2026-05-03 16:52:28 -03:00
WorkspaceControllerTest.php feat: AI image generation pipeline and post creation overhaul 2026-05-08 13:38:30 -03:00
WorkspaceInviteControllerTest.php refactor: reorganize settings UI, migrate post templates to a file-based registry, and remove legacy video generation features 2026-05-03 13:44:13 -03:00
WorkspaceLabelControllerTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
WorkspaceSignatureControllerTest.php chore: remove deprecated localization files 2026-05-03 15:23:25 -03:00
YouTubeAnalyticsTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00