PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.6.7
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.6.7
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 2 months ago Providers 2 months ago BulkReviewsUpdateStuckStateTest.php 2 months ago ClearCacheRelayResetTest.php 2 months ago DeleteSourceRelayFailureTest.php 2 months ago ErrorHandlerFalsyOptionTest.php 2 months ago FeedCacheUpdateServiceTest.php 2 months ago FeedMalformedPayloadTest.php 2 months ago ForceKeylessRefetchTest.php 2 months ago LicenseDeactivateStaleStateTest.php 2 months ago MediaFinderMemoTest.php 2 months ago MultiSourceAggregationTest.php 2 months ago ReconcileMigratedLicenseRoutineTest.php 2 months ago ReconcileRemovalTest.php 2 months ago RegisterWebsiteRoutineTest.php 2 months ago RemoteRequestMemoTest.php 2 months ago ReviewAlertHeaderTotalsTest.php 2 months ago ReviewAlertPageTargetingTest.php 2 months ago ReviewAlertStarFillTest.php 2 months ago ShortcodeNeutralizationTest.php 2 months ago SiteMigrationRecoveryTest.php 2 months ago Smash1583HeaderParityTest.php 2 months ago SourceIdLookupTest.php 2 months ago WpmlGetCurrentLanguageTest.php 2 months ago WpmlLanguageMappingTest.php 2 months 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