test(wpmc S3): lock per-request render cache for ShortcodeDmr

This commit is contained in:
Vladimir Bryzgalov
2026-05-12 20:07:30 +05:00
parent 9cacf18725
commit adbbd205a1
+21
View File
@@ -105,4 +105,25 @@ final class ShortcodeDmrTest extends TestCase
self::assertSame('', ShortcodeDmr::render(['id' => 42]));
}
public function test_render_caches_result_per_id_and_town(): void
{
$_SERVER['REQUEST_URI'] = '/tyumen/';
\Brain\Monkey\Functions\when('get_terms')->justReturn([11 => 'tyumen']);
$term = new \WP_Term();
$term->term_id = 11;
$term->slug = 'tyumen';
\Brain\Monkey\Functions\when('get_term_by')->justReturn($term);
\Brain\Monkey\Functions\expect('get_field')
->once()
->with('list_shortcode', 42)
->andReturn([['town' => 11, 'text' => 'Тюмень-текст']]);
ShortcodeDmr::render(['id' => 42]);
ShortcodeDmr::render(['id' => 42]);
ShortcodeDmr::render(['id' => 42]);
self::assertTrue(true);
}
}