HEX
Server: Apache
System: Linux p3plzcpnl489499.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: dwauav0tm6jp (6177017)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/dwauav0tm6jp/public_html/newvsi/wp-content/plugins/wpmudev-updates/tests/phpunit/util.php
<?php

class WPMUDEV_Dashboard_Test_Util {

	const WPMUDEV_API_KEY = '703cd83f1f7f929ebe5994207847e907ca1b3faa';

	public static $is_logged_in = false;

	public static function login() {
		WPMUDEV_Dashboard::$api->set_key( self::WPMUDEV_API_KEY );
		WPMUDEV_Dashboard::$api->hub_sync( false, true );
		self::$is_logged_in = true;
	}

	public static function logout() {
		if ( ! self::$is_logged_in ) {
			return;
		}
		WPMUDEV_Dashboard::$api->revoke_remote_access();
		WPMUDEV_Dashboard::$api->analytics_disable();
		WPMUDEV_Dashboard::$settings->reset();
		WPMUDEV_Dashboard::$api->set_key( '' );
		WPMUDEV_Dashboard::$api->hub_sync( false, true ); // force a sync so that site is removed from user's hub.
		self::$is_logged_in = false;
	}

	public static function open_json_data( $file_name ) {
		return file_get_contents( dirname( __FILE__ ) . '/data/' . $file_name );// phpcs:ignore WordPress.WP.AlternativeFunctions -- Internal usage for test purpose only
	}
}