Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

Cover every supported language in ContentLanguage detection tests

Paulo Castellanoc59adb4871af
diff --git a/tests/Feature/Ai/AutofillBrandTest.php b/tests/Feature/Ai/AutofillBrandTest.php
index e4be9ded5..fd5469c0f 100644
--- a/tests/Feature/Ai/AutofillBrandTest.php
+++ b/tests/Feature/Ai/AutofillBrandTest.php
@@ -100,13 +100,29 @@ test('normalizes various language codes to supported locales', function (string
expect($result->language)->toBe($expected);
})->with([
+ // Every supported language, detected from its primary subtag.
+ ['en', 'en'],
['pt', 'pt-BR'],
+ ['es', 'es'],
+ ['fr', 'fr'],
+ ['de', 'de'],
+ ['it', 'it'],
+ ['nl', 'nl'],
+ ['pl', 'pl'],
+ ['el', 'el'],
+ ['ja', 'ja'],
+ ['ko', 'ko'],
+ ['zh', 'zh'],
+ ['ru', 'ru'],
+ ['tr', 'tr'],
+ ['ar', 'ar'],
+ // Region/script subtags still resolve to the supported language.
['pt-PT', 'pt-BR'],
['en-US', 'en'],
['es-MX', 'es'],
- ['fr', 'fr'],
['ja-JP', 'ja'],
['zh-Hans', 'zh'],
+ // Unsupported languages stay null.
['sv', null],
]);
diff --git a/tests/Unit/Enums/Workspace/ContentLanguageTest.php b/tests/Unit/Enums/Workspace/ContentLanguageTest.php
index 525d66d1a..58db56926 100644
--- a/tests/Unit/Enums/Workspace/ContentLanguageTest.php
+++ b/tests/Unit/Enums/Workspace/ContentLanguageTest.php
@@ -44,4 +44,7 @@ test('fromHtmlLang resolves the two-letter primary subtag', function (string $la
['sv', null],
['e', null],
['', null],
+ // A malformed tag is matched on its whole primary subtag, never a
+ // two-letter prefix — "english" must not resolve to English via "en".
+ ['english', null],
]);