<commit_before><?php
/**
 * ModulesTest
 *
 * @package   Google\Site_Kit
 * @copyright 2021 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://sitekit.withgoogle.com
 */

namespace Google\Site_Kit\Tests\Core\Modules;

use Google\Site_Kit\Context;
use Google\Site_Kit\Core\Authentication\Authentication;
use Google\Site_Kit\Core\Modules\Modules;
use Google\Site_Kit\Core\REST_API\REST_Routes;
use Google\Site_Kit\Core\Storage\Options;
use Google\Site_Kit\Core\Storage\User_Options;
use Google\Site_Kit\Modules\AdSense;
use Google\Site_Kit\Modules\Analytics;
use Google\Site_Kit\Modules\Analytics\Settings;
use Google\Site_Kit\Modules\Analytics_4;
use Google\Site_Kit\Modules\Idea_Hub;
use Google\Site_Kit\Modules\Idea_Hub\Settings as Idea_Hub_Settings;
use Google\Site_Kit\Modules\Optimize;
use Google\Site_Kit\Modules\PageSpeed_Insights;
use Google\Site_Kit\Modules\Search_Console;
use Google\Site_Kit\Modules\Site_Verification;
use Google\Site_Kit\Modules\Subscribe_With_Google;
use Google\Site_Kit\Modules\Tag_Manager;
use Google\Site_Kit\Tests\TestCase;
use Google\Site_Kit\Tests\FakeHttpClient;
use Google\Site_Kit_Dependencies\GuzzleHttp\Message\Response;
use Google\Site_Kit_Dependencies\GuzzleHttp\Message\Request;
use WP_REST_Request;

/**
 * @group Modules
 */
class ModulesTest extends TestCase {

	public function test_get_available_modules() {
		$modules = new Modules( new Context( GOOGLESITEKIT_PLUGIN_MAIN_FILE ) );

		$available = array_map(
			function ( $instance ) {
				return get_class( $instance );
			},
			$modules->get_available_modules()
		);

		$this->assertEqualSets(
			array(
				'adsense'            => 'Google\\Site_Kit\\Modules\\AdSense',
				'analytics'          => 'Google\\Site_Kit\\Modules\\Analytics',
				'analytics-4'        => 'Google\\Site_Kit\\Modules\\Analytics_4',
				'optimize'           => 'Google\\Site_Kit\\Modules\\Optimize',
				'pagespeed-insights' => 'Google\\Site_Kit\\Modules\\PageSpeed_Insights',
				'search-console'     => 'Google\\Site_Kit\\Modules\\Search_Console',
				'site-verification'  => 'Google\\Site_Kit\\Modules\\Site_Verification',
				'tagmanager'         => 'Google\\Site_Kit\\Modules\\Tag_Manager',
			),
			$available<commit_msg>Remove unused imports.<commit_after><?php
/**
 * ModulesTest
 *
 * @package   Google\Site_Kit
 * @copyright 2021 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://sitekit.withgoogle.com
 */

namespace Google\Site_Kit\Tests\Core\Modules;

use Google\Site_Kit\Context;
use Google\Site_Kit\Core\Authentication\Authentication;
use Google\Site_Kit\Core\Modules\Modules;
use Google\Site_Kit\Core\REST_API\REST_Routes;
use Google\Site_Kit\Core\Storage\Options;
use Google\Site_Kit\Core\Storage\User_Options;
use Google\Site_Kit\Modules\AdSense;
use Google\Site_Kit\Modules\Analytics;
use Google\Site_Kit\Modules\Analytics_4;
use Google\Site_Kit\Modules\Idea_Hub;
use Google\Site_Kit\Modules\Idea_Hub\Settings as Idea_Hub_Settings;
use Google\Site_Kit\Modules\Optimize;
use Google\Site_Kit\Modules\PageSpeed_Insights;
use Google\Site_Kit\Modules\Search_Console;
use Google\Site_Kit\Modules\Site_Verification;
use Google\Site_Kit\Modules\Subscribe_With_Google;
use Google\Site_Kit\Modules\Tag_Manager;
use Google\Site_Kit\Tests\TestCase;
use Google\Site_Kit\Tests\FakeHttpClient;
use WP_REST_Request;

/**
 * @group Modules
 */
class ModulesTest extends TestCase {

	public function test_get_available_modules() {
		$modules = new Modules( new Context( GOOGLESITEKIT_PLUGIN_MAIN_FILE ) );

		$available = array_map(
			function ( $instance ) {
				return get_class( $instance );
			},
			$modules->get_available_modules()
		);

		$this->assertEqualSets(
			array(
				'adsense'            => 'Google\\Site_Kit\\Modules\\AdSense',
				'analytics'          => 'Google\\Site_Kit\\Modules\\Analytics',
				'analytics-4'        => 'Google\\Site_Kit\\Modules\\Analytics_4',
				'optimize'           => 'Google\\Site_Kit\\Modules\\Optimize',
				'pagespeed-insights' => 'Google\\Site_Kit\\Modules\\PageSpeed_Insights',
				'search-console'     => 'Google\\Site_Kit\\Modules\\Search_Console',
				'site-verification'  => 'Google\\Site_Kit\\Modules\\Site_Verification',
				'tagmanager'         => 'Google\\Site_Kit\\Modules\\Tag_Manager',
			),
			$available
{'fraction_non_alphanumeric': 0.1306141154903758, 'fraction_numerical': 0.005041246562786435, 'mean_word_length': 4.221291866028708, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2556183', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1470, 'n_words': 209}