shouldReceive('remixImage') ->once() ->with([ 'type' => 'image', 'url' => '/storage/social_assets/images/source.jpg', 'thumbnail_url' => '/storage/social_assets/images/source.jpg', ], 'Ubah jadi visual premium', 'restyle') ->andReturn([ 'provider' => 'freepik-seedream-v45-edit', 'urls' => ['https://cdn.example.com/remix-image.jpg'], ]); $storyNormalizer->shouldReceive('normalizeMany') ->once() ->with(['https://cdn.example.com/remix-image.jpg']) ->andReturn([[ 'url' => '/storage/images/remix.jpg', 'thumbnail_url' => '/storage/images/remix-thumb.jpg', 'width' => 1080, 'height' => 1920, ]]); $service = new SocialMediaStudioService( Mockery::mock(FreepikImageService::class), Mockery::mock(FreepikVideoService::class), $freepikRemix, Mockery::mock(OpenAiImageService::class), Mockery::mock(PollinationsImageService::class), Mockery::mock(PosterImageService::class), $storyNormalizer, Mockery::mock(MotionVideoService::class), ); $result = $service->remixFromAsset([ 'type' => 'image', 'url' => '/storage/social_assets/images/source.jpg', 'thumbnail_url' => '/storage/social_assets/images/source.jpg', ], 'Ubah jadi visual premium', 'restyle', 'image'); $this->assertSame('/storage/images/remix.jpg', $result['url']); $this->assertSame('freepik-seedream-v45-edit', $result['provider']); $this->assertSame('9:16', $result['aspect']); } public function test_remix_from_asset_returns_video_payload_for_story_output(): void { $freepikRemix = Mockery::mock(FreepikAssetRemixService::class); $freepikRemix->shouldReceive('remixVideo') ->once() ->with([ 'type' => 'video', 'url' => '/storage/social_assets/videos/source.mp4', 'thumbnail_url' => '/storage/social_assets/images/source-thumb.jpg', ], 'Bikin jadi video promo vertikal', 'mockup') ->andReturn([ 'url' => '/storage/videos/remix.mp4', 'provider' => 'freepik-runway-i2v', 'duration_seconds' => 5, ]); $service = new SocialMediaStudioService( Mockery::mock(FreepikImageService::class), Mockery::mock(FreepikVideoService::class), $freepikRemix, Mockery::mock(OpenAiImageService::class), Mockery::mock(PollinationsImageService::class), Mockery::mock(PosterImageService::class), Mockery::mock(StoryImageNormalizerService::class), Mockery::mock(MotionVideoService::class), ); $result = $service->remixFromAsset([ 'type' => 'video', 'url' => '/storage/social_assets/videos/source.mp4', 'thumbnail_url' => '/storage/social_assets/images/source-thumb.jpg', ], 'Bikin jadi video promo vertikal', 'mockup', 'video'); $this->assertSame('/storage/videos/remix.mp4', $result['url']); $this->assertSame('freepik-runway-i2v', $result['provider']); $this->assertSame('/storage/social_assets/images/source-thumb.jpg', $result['source_image_url']); } }