WSL_Test_Widget   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 6
lcom 0
cbo 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A tearDown() 0 4 1
A test_has_action() 0 5 1
A test_shortcode_exists() 0 5 1
A test_did_actions() 0 7 1
A test_has_content() 0 13 1
1
<?php
2
/*!
3
* WordPress Social Login
4
*
5
* https://miled.github.io/wordpress-social-login/ | https://github.com/miled/wordpress-social-login
6
*   (c) 2011-2020 Mohamed Mrassi and contributors | https://wordpress.org/plugins/wordpress-social-login/
7
*/
8
9
class WSL_Test_Widget extends WP_UnitTestCase
10
{
11
	function setUp()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
12
	{
13
		parent::setUp();
14
	}
15
16
	function tearDown()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
17
	{
18
		parent::tearDown();
19
	}
20
21
	function test_has_action()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
22
	{
23
		$test = has_action( 'wordpress_social_login', 'wsl_action_wordpress_social_login' );
24
		$this->assertTrue( (bool) $test );
25
	}
26
27
	function test_shortcode_exists()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
28
	{
29
		$test = shortcode_exists( 'wordpress_social_login' );
30
		$this->assertTrue( (bool) $test );
31
	}
32
33
	function test_did_actions()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
34
	{
35
		wsl_render_auth_widget();
36
37
		$this->assertEquals( 1, did_action( 'wsl_render_auth_widget_start' ) );
38
		$this->assertEquals( 1, did_action( 'wsl_render_auth_widget_end' ) );
39
	}
40
41
	/*
42
	* hacky way of checking for correct css selectors
43
	*/
44
	function test_has_content()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
45
	{
46
		$test = wsl_render_auth_widget();
47
48
		$this->assertTrue( (bool) $test );
49
50
		$this->assertEquals( 1, substr_count( $test, '"wp-social-login-widget"'          ) );
51
		$this->assertEquals( 1, substr_count( $test, '"wp-social-login-connect-with"'    ) );
52
		$this->assertEquals( 1, substr_count( $test, '"wp-social-login-provider-list"'   ) );
53
		$this->assertEquals( 3, substr_count( $test, '"wp-social-login-provider '        ) );
54
		$this->assertEquals( 1, substr_count( $test, ' wp-social-login-provider-google'  ) );
55
		$this->assertEquals( 1, substr_count( $test, '"wp-social-login-widget-clearing"' ) );
56
	}
57
}
58