feat(wpmc S3): Helpers::current_town URI-match path
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user