feat(wpmc S3): Helpers::current_town URI-match path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vladimir Bryzgalov
2026-05-12 19:58:19 +05:00
parent 58838b0c19
commit f81cefefbe
2 changed files with 62 additions and 0 deletions
+15
View File
@@ -50,4 +50,19 @@ final class HelpersTest extends TestCase
// Mockery ->once() at teardown verifies the cache stopped repeated calls.
self::assertTrue(true);
}
public function test_current_town_returns_slug_when_uri_matches_existing_town(): void
{
$_SERVER['REQUEST_URI'] = '/tyumen/some-service/';
\Brain\Monkey\Functions\expect('get_terms')
->once()
->with('town', \Mockery::on(function ($args) {
return ($args['hide_empty'] ?? null) === false
&& ($args['fields'] ?? null) === 'id=>slug';
}))
->andReturn([10 => 'spb', 11 => 'tyumen']);
self::assertSame('tyumen', Helpers::current_town());
}
}