PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.10.0
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.10.0
2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.7 2.6.8 2.6.5 2.6.4 2.6.3 2.6.2 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1 1.1.1 1.1.2 1.2.0 2.0 2.1.0 2.1.1 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1
reviews-feed / tests / Unit / WpmlGetCurrentLanguageTest.php
reviews-feed / tests / Unit Last commit date
Doubles 3 weeks ago Providers 3 weeks ago BulkRearmOnGrowthTest.php 3 weeks ago BulkReviewsUpdateStuckStateTest.php 3 weeks ago ClearCacheRelayResetTest.php 3 weeks ago DeleteSourceRelayFailureTest.php 3 weeks ago ErrorHandlerFalsyOptionTest.php 3 weeks ago FeedCacheUpdateServiceTest.php 3 weeks ago FeedMalformedPayloadTest.php 3 weeks ago ForceKeylessRefetchTest.php 3 weeks ago LicenseDeactivateStaleStateTest.php 3 weeks ago MediaFinderMemoTest.php 3 weeks ago MultiSourceAggregationTest.php 3 weeks ago ReconcileMigratedLicenseRoutineTest.php 3 weeks ago ReconcileRemovalTest.php 3 weeks ago RegisterWebsiteRoutineTest.php 3 weeks ago RemoteRequestMemoTest.php 3 weeks ago ReviewAlertHeaderTotalsTest.php 3 weeks ago ReviewAlertPageTargetingTest.php 3 weeks ago ReviewAlertStarFillTest.php 3 weeks ago ShortcodeNeutralizationTest.php 3 weeks ago SiteMigrationRecoveryTest.php 3 weeks ago Smash1583HeaderParityTest.php 3 weeks ago Smash1631MultiLanguageBulkTest.php 3 weeks ago Smash1631UpdateSingleLangScopeTest.php 3 weeks ago Smash1706TripAdvisorPlaceIdTest.php 3 weeks ago Smash1756SchemaServiceTest.php 3 weeks ago Smash1785AvatarLocalUrlGuardTest.php 3 weeks ago Smash1785AvatarReHealTest.php 3 weeks ago Smash1795ReviewTextXssTest.php 3 weeks ago Smash782BookingHeaderRatingTest.php 3 weeks ago Smash782CountryFlagEmojiTest.php 3 weeks ago Smash782ExternalRefreshCronTest.php 3 weeks ago Smash782ExtrasTemplateTest.php 3 weeks ago Smash782ReviewAlertProviderDataTest.php 3 weeks ago SourceIdLookupTest.php 3 weeks ago WpmlGetCurrentLanguageTest.php 3 weeks ago WpmlLanguageMappingTest.php 3 weeks ago
WpmlGetCurrentLanguageTest.php
55 lines
1 <?php
2
3 namespace SmashBalloon\Reviews\Tests\Unit;
4
5 use PHPUnit\Framework\TestCase;
6 use SmashBalloon\Reviews\Pro\Helpers\SBR_WPML;
7
8 /**
9 * Pins SBR_WPML::get_current_language() — the WPML side of SMASH-1617. The old code
10 * returned the literal string `'wpml'` when WPML's language code wasn't an exact
11 * match in Google's list, so Google received `language=wpml` and left reviews
12 * untranslated. It must now map via Util::map_wpml_to_google_language() and fall
13 * back to a real code (or 'default') — NEVER 'wpml'.
14 *
15 * The mapping itself is covered exhaustively by WpmlLanguageMappingTest; here we
16 * pin the wrapper's branches (non-WPML passthrough + the WPML fallback chain).
17 */
18 final class WpmlGetCurrentLanguageTest extends TestCase
19 {
20 /**
21 * When WPML isn't active (ICL_SITEPRESS_VERSION undefined) or the localization
22 * isn't 'wpml', the value passes through unchanged.
23 */
24 public function test_non_wpml_localization_passes_through(): void
25 {
26 $this->assertSame('es-419', SBR_WPML::get_current_language('es-419'));
27 $this->assertSame('en', SBR_WPML::get_current_language('en'));
28 $this->assertSame('default', SBR_WPML::get_current_language('default'));
29 }
30
31 /**
32 * With WPML active and localization 'wpml', an unresolvable WPML language must
33 * fall back to 'default' — the literal 'wpml' must never reach the API. Run in a
34 * separate process so defining ICL_SITEPRESS_VERSION doesn't leak to other tests.
35 *
36 * (The bootstrap's apply_filters stub returns the passed value, so
37 * wpml_current_language / wpml_default_language resolve to null here, exercising
38 * the final fallback.)
39 *
40 * @runInSeparateProcess
41 * @preserveGlobalState disabled
42 */
43 public function test_wpml_fallback_never_returns_literal_wpml(): void
44 {
45 if (! defined('ICL_SITEPRESS_VERSION')) {
46 define('ICL_SITEPRESS_VERSION', '4.9.5');
47 }
48
49 $resolved = SBR_WPML::get_current_language('wpml');
50
51 $this->assertSame('default', $resolved);
52 $this->assertNotSame('wpml', $resolved);
53 }
54 }
55