Skip to content

Commit

Permalink
Add new PHPUnit test for iis7SupportsPermalinks function
Browse files Browse the repository at this point in the history
The newly created PHPUnit test verifies the behavior of the iis7SupportsPermalinks function. Specifically, it checks that the function returns false if the server is not IIS 7 and confirms that the appropriate filter is called correctly.
  • Loading branch information
pbearne committed Dec 7, 2023
1 parent 8035bda commit fae31cf
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/phpunit/tests/functions/iis7SupportsPermalinks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
global $is_iis7;
if ( ! $is_iis7 ) {
/**
* Tests for the iis7_supports_permalinks function.
*
* @group Functions
*
* @covers ::iis7_supports_permalinks
*/
class Tests_Functions_iis7SupportsPermalinks extends WP_UnitTestCase {

/**
* check it returns false if the server is not IIS 7.
* check the filter is called
*
* @ticket 60024
*/
public function test_iis7_supports_permalinks() {
$filter = new MockAction();

add_filter( 'iis7_supports_permalinks', array( $filter, 'filter' ) );

$this->assertFalse( iis7_supports_permalinks() );

$this->assertSame( 1, $filter->get_call_count() );
}
}
}

0 comments on commit fae31cf

Please sign in to comment.