HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /var/www/html/breadsecret.com/wp-content/plugins/wordpress-social-login/tests/test_widget.php
<?php
/*!
* WordPress Social Login
*
* https://miled.github.io/wordpress-social-login/ | https://github.com/miled/wordpress-social-login
*   (c) 2011-2020 Mohamed Mrassi and contributors | https://wordpress.org/plugins/wordpress-social-login/
*/

class WSL_Test_Widget extends WP_UnitTestCase
{
	function setUp()
	{
		parent::setUp();
	}

	function tearDown()
	{
		parent::tearDown();
	}

	function test_has_action()
	{
		$test = has_action( 'wordpress_social_login', 'wsl_action_wordpress_social_login' );
		$this->assertTrue( (bool) $test );
	}

	function test_shortcode_exists()
	{
		$test = shortcode_exists( 'wordpress_social_login' );
		$this->assertTrue( (bool) $test );
	}

	function test_did_actions()
	{
		wsl_render_auth_widget();

		$this->assertEquals( 1, did_action( 'wsl_render_auth_widget_start' ) );
		$this->assertEquals( 1, did_action( 'wsl_render_auth_widget_end' ) );
	}

	/*
	* hacky way of checking for correct css selectors
	*/
	function test_has_content()
	{
		$test = wsl_render_auth_widget();

		$this->assertTrue( (bool) $test );

		$this->assertEquals( 1, substr_count( $test, '"wp-social-login-widget"'          ) );
		$this->assertEquals( 1, substr_count( $test, '"wp-social-login-connect-with"'    ) );
		$this->assertEquals( 1, substr_count( $test, '"wp-social-login-provider-list"'   ) );
		$this->assertEquals( 3, substr_count( $test, '"wp-social-login-provider '        ) );
		$this->assertEquals( 1, substr_count( $test, ' wp-social-login-provider-google'  ) );
		$this->assertEquals( 1, substr_count( $test, '"wp-social-login-widget-clearing"' ) );
	}
}