Skip to content

Commit

Permalink
NEW test for method get_rewrite_atts()
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed Sep 30, 2024
1 parent 35a8512 commit 0b2d460
Showing 1 changed file with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function test_get_slugs(): void {
$callback = function(){};
$instance = new Endpoint(
'query_var',
// 'post', // has rewrite=false , why?
'gatherpress_event',
$callback,
array(
Expand All @@ -91,4 +90,33 @@ public function test_get_slugs(): void {
);
}

/**
* Coverage for get_rewrite_atts method.
*
* @covers ::get_rewrite_atts
*
* @return void
*/
public function test_get_rewrite_atts(): void {
$callback = function(){};
$instance = new Endpoint(
'query_var',
'gatherpress_event',
$callback,
array(
new Endpoint_Template( 'endpoint_template_1', $callback ),
new Endpoint_Template( 'endpoint_template_2', $callback ),
new Endpoint_Redirect( 'endpoint_redirect_1', $callback ),
),
'reg_ex',
);
$this->assertSame(
array(
'gatherpress_event' => '$matches[1]',
'query_var' => '$matches[2]',
),
$instance->get_rewrite_atts(),
'Failed to assert that rewrite attributes match.'
);
}
}

0 comments on commit 0b2d460

Please sign in to comment.