register_endpoint() public method

public register_endpoint ( string $url, array $plugins = [] )
$url string The leading URL for this endpoint
$plugins array Array of enabled plugin slugs for this endpoint
 public function test_get_requested_endpoint()
 {
     // sample endpoints
     $endpoint_1 = new Endpoint('/url-1', array('plugin-1/plugin-1.php'));
     $endpoint_2 = new Endpoint('/url-2', array('plugin-1/plugin-1.php', 'plugin-2/plugin-2.php'));
     // no registered endpoints
     $router = new Router();
     $this->assertNull($router->get_requested_endpoint());
     // 1 registered endpoint but requesting different URL
     $_SERVER['REQUEST_URI'] = '/';
     $router->register_endpoint($endpoint_1->url, $endpoint_1->active_plugins);
     $this->assertNull($router->get_requested_endpoint());
     // 2 registered endpoints, requesting url of 2nd endpoints
     $router->register_endpoint($endpoint_2->url, $endpoint_2->active_plugins);
     $_SERVER['REQUEST_URI'] = $endpoint_2->url;
     $this->assertEquals($endpoint_2, $router->get_requested_endpoint());
     // 2 registered endpoints, requesting subset of 2nd endpoint's url
     $_SERVER['REQUEST_URI'] = $endpoint_2->url . '/additional-url-string';
     $this->assertEquals($endpoint_2, $router->get_requested_endpoint());
 }