Done !
| Server IP : 46.105.57.169 / Your IP : 216.73.216.67 Web Server : Apache System : Linux webm002.cluster120.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : verseaumee ( 152031) PHP Version : 8.5.7 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/verseaumee/blueversion/wp-content/plugins/really-simple-ssl/tests/ |
Upload File : |
<?php
class RSSSLUserEnumerationTest extends WP_UnitTestCase {
public function setUp(): void {
parent::setUp();
require_once __DIR__ . '/../security/wordpress/user-enumeration.php';
}
/**
* Test if rsssl_check_user_enumeration is hooked to the 'init' action.
*
* @return void
*/
public function test_rsssl_check_user_enumeration() {
$this->assertTrue(has_action('init', 'rsssl_check_user_enumeration') !== false);
}
/**
* Test if rsssl_remove_author_from_yoast_sitemap filter works as expected.
*
* @return void
*/
public function test_rsssl_remove_author_from_yoast_sitemap() {
// Mock the wpseo_sitemap_exclude_author filter
add_filter('wpseo_sitemap_exclude_author', 'rsssl_remove_author_from_yoast_sitemap', 10, 1);
$this->assertNotFalse(has_filter('wpseo_sitemap_exclude_author', 'rsssl_remove_author_from_yoast_sitemap'));
$this->assertSame(false, apply_filters('wpseo_sitemap_exclude_author', true));
}
/**
* Test if rsssl_rest_endpoints_callback function works as expected.
*
* @return void
*/
public function rsssl_test_rest_endpoints_callback($endpoints) {
if ( !is_user_logged_in() || !current_user_can('edit_posts') ) {
if ( isset( $endpoints['/wp/v2/users'] ) ) {
unset( $endpoints['/wp/v2/users'] );
}
if ( isset( $endpoints['/wp/v2/users/(?P[\d]+)'] ) ) {
unset( $endpoints['/wp/v2/users/(?P[\d]+)'] );
}
}
return $endpoints;
}
/**
* Test if rsssl_wp_sitemaps_add_provider filter works as expected.
*
* @return void
*/
public function test_rsssl_rest_endpoints_filter() {
$endpoints = [
'/wp/v2/users' => 'some_value',
'/wp/v2/users/(?P[\d]+)' => 'some_value',
];
// Add the helper function to the 'rest_endpoints' filter
add_filter('rest_endpoints', [$this, 'rsssl_test_rest_endpoints_callback']);
$filtered_endpoints = apply_filters('rest_endpoints', $endpoints);
$this->assertFalse(isset($filtered_endpoints['/wp/v2/users']));
$this->assertFalse(isset($filtered_endpoints['/wp/v2/users/(?P[\d]+)']));
}
public function test_rsssl_wp_sitemaps_add_provider() {
$provider = 'some_value';
add_filter('wp_sitemaps_add_provider', function($provider, $name) {
if ('users' === $name) {
return false;
}
return $provider;
}, 10, 2);
$filtered_provider = apply_filters('wp_sitemaps_add_provider', $provider, 'users');
$this->assertFalse($filtered_provider);
}
}