WSL_Test_Widget::test_shortcode_exists()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
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