HEX
Server: Apache
System: Linux webd011.cluster130.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User: ezpgggd (105871)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/ezpgggd/www/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
	}
}