Skip to content

Commit

Permalink
Add PHPUnit tests for force_ssl_admin function
Browse files Browse the repository at this point in the history
A new file has been introduced for the PHPUnit tests of the 'force_ssl_admin' function of WordPress. It includes a variety of tests to ensure the function behaves correctly under various parameters and conditions.
  • Loading branch information
pbearne committed Dec 6, 2023
1 parent 52854e2 commit a6cddb2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/phpunit/tests/functions/force_ssl_admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* Tests for the force_ssl_admin function.
*
* @group Functions
*
* @covers ::force_ssl_admin
*/
class Tests_Functions_force_ssl_admin extends WP_UnitTestCase {

/**
* @ticket 60018
*/
public function test_force_ssl_admin() {

$this->assertFalse( force_ssl_admin() );

$this->assertFalse( force_ssl_admin( true ) );
$this->assertTrue( force_ssl_admin() );
$this->assertTrue( force_ssl_admin() );

$this->assertTrue( force_ssl_admin( true ) );
$this->assertTrue( force_ssl_admin() );

$this->assertTrue( force_ssl_admin( false ) );
$this->assertFalse( force_ssl_admin() );

$this->assertFalse( force_ssl_admin() );

$this->assertFalse( force_ssl_admin( 'not_bool' ) );

$this->assertSame( 'not_bool', force_ssl_admin() );
}
}

0 comments on commit a6cddb2

Please sign in to comment.