PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.11.0
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.11.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 1 week ago Providers 1 week ago BulkRearmOnGrowthTest.php 1 week ago BulkReviewsUpdateStuckStateTest.php 1 week ago ClearCacheRelayResetTest.php 1 week ago DeleteSourceRelayFailureTest.php 1 week ago ErrorHandlerFalsyOptionTest.php 1 week ago FeedCacheUpdateServiceTest.php 1 week ago FeedMalformedPayloadTest.php 1 week ago ForceKeylessRefetchTest.php 1 week ago LicenseDeactivateStaleStateTest.php 1 week ago MediaFinderMemoTest.php 1 week ago MultiSourceAggregationTest.php 1 week ago ReconcileMigratedLicenseRoutineTest.php 1 week ago ReconcileRemovalTest.php 1 week ago RegisterWebsiteRoutineTest.php 1 week ago RelaySlowEndpointsTest.php 1 week ago RemoteRequestMemoTest.php 1 week ago ReviewAlertHeaderTotalsTest.php 1 week ago ReviewAlertPageTargetingTest.php 1 week ago ReviewAlertStarFillTest.php 1 week ago ShortcodeNeutralizationTest.php 1 week ago SiteMigrationRecoveryTest.php 1 week ago Smash1130UsageTrackingHardeningTest.php 1 week ago Smash1130UsageTrackingHooksTest.php 1 week ago Smash1583HeaderParityTest.php 1 week ago Smash1631MultiLanguageBulkTest.php 1 week ago Smash1631UpdateSingleLangScopeTest.php 1 week ago Smash1706TripAdvisorPlaceIdTest.php 1 week ago Smash1756SchemaServiceTest.php 1 week ago Smash1785AvatarLocalUrlGuardTest.php 1 week ago Smash1785AvatarReHealTest.php 1 week ago Smash1795ReviewTextXssTest.php 1 week ago Smash1835TripAdvisorKeyShapeTest.php 1 week ago Smash1973WordpressOrgPlaceIdNullTest.php 1 week ago Smash1987NestedSourceErrorShapeTest.php 1 week ago Smash782BookingHeaderRatingTest.php 1 week ago Smash782CountryFlagEmojiTest.php 1 week ago Smash782ExternalRefreshCronTest.php 1 week ago Smash782ExtrasTemplateTest.php 1 week ago Smash782ReviewAlertProviderDataTest.php 1 week ago SourceIdLookupTest.php 1 week ago WpmlGetCurrentLanguageTest.php 1 week ago WpmlLanguageMappingTest.php 1 week 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