feat(wpmc S4): Helpers::is_routable_path with page_no_rep exclusions

This commit is contained in:
Vladimir Bryzgalov
2026-05-16 19:22:01 +05:00
parent f4184a7777
commit d122bfacb5
2 changed files with 58 additions and 0 deletions
+34
View File
@@ -231,4 +231,38 @@ final class HelpersTest extends TestCase
self::assertNull(Helpers::main_town_slug());
}
public function test_is_routable_path_returns_true_when_no_exclusions(): void
{
\Brain\Monkey\Functions\expect('get_field')
->once()
->with('page_no_rep', 'option')
->andReturn(false);
self::assertTrue(Helpers::is_routable_path('/foo/bar/'));
}
public function test_is_routable_path_returns_false_when_path_matches_exclusion(): void
{
\Brain\Monkey\Functions\expect('get_field')
->once()
->with('page_no_rep', 'option')
->andReturn([
['link' => '/privacy/'],
['link' => '/terms/'],
]);
self::assertFalse(Helpers::is_routable_path('/privacy/'));
}
public function test_is_routable_path_uses_request_uri_when_path_null(): void
{
$_SERVER['REQUEST_URI'] = '/terms/';
\Brain\Monkey\Functions\expect('get_field')
->once()
->with('page_no_rep', 'option')
->andReturn([['link' => '/terms/']]);
self::assertFalse(Helpers::is_routable_path());
}
}