| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/plugins/wpmudev-updates/tests/phpunit/single-site/ |
Upload File : |
<?php
/**
* Class WPMUDEV_Dashboard_Single_Site_Test_Preg_Math
*
* test preg_match regex compatibility with 7.3
*
* tests below only for functions that are being used,
* for functions that are not being used, those assumed does not need further tests
*/
class WPMUDEV_Dashboard_Single_Site_Test_Preg_Math extends WP_UnitTestCase {
public function setUp() {
add_filter( 'http_response', array( $this, 'mock_analytics_response' ), 10, 3 );
parent::setUp(); // TODO: Change the autogenerated stub
}
// always logout on teardown
public function tearDown() {
remove_filter( 'http_response', array( $this, 'mock_analytics_response' ), 10 );
WPMUDEV_Dashboard_Test_Util::logout();
parent::tearDown();
}
public function test_api_rest_url() {
$rest_url = WPMUDEV_Dashboard::$api->rest_url( 'projects' );
$this->assertSame( WPMUDEV_CUSTOM_API_SERVER . 'api/dashboard/v2/projects', $rest_url );
}
public function test_api_analytics_stats_overall() {
WPMUDEV_Dashboard_Test_Util::login();
WPMUDEV_Dashboard::$api->analytics_enable();
WPMUDEV_Dashboard::$settings->set( 'enabled', true, 'analytics' );
$overall = WPMUDEV_Dashboard::$api->analytics_stats_overall();
$this->assertNotEmpty( $overall );
}
public function test_site_to_localtime() {
$local_time = WPMUDEV_Dashboard::$site->to_localtime( time() );
$this->assertNotEmpty( $local_time );
}
public function test_lib_crypt_rsa() {
if ( ! class_exists( 'Crypt_RSA', false ) ) {
require_once WPMUDEV_Dashboard::$site->plugin_path . 'lib/PHPSecLib/Crypt/RSA.php';
}
$rsa = new Crypt_RSA();
$this->assertNotEmpty( $rsa->hashName ); // phpcs:ignore
}
public function mock_analytics_response( $response, $r, $url ) {
if ( preg_match( '/\/api\/analytics\/v1\/site\/(.*)\/overall\//i', $url ) ) {
$request_response = new Requests_Response();
$request_response->status_code = 200;
$request_response->body = WPMUDEV_Dashboard_Test_Util::open_json_data( 'analytics-overall.json' );
$response = new WP_HTTP_Requests_Response( $request_response );
$response = $response->to_array();
}
return $response;
}
}