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_Install extends WP_UnitTestCase |
10
|
|
|
{ |
11
|
|
|
function setUp() |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
parent::setUp(); |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
function tearDown() |
|
|
|
|
17
|
|
|
{ |
18
|
|
|
parent::tearDown(); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
function test_requirements() |
|
|
|
|
22
|
|
|
{ |
23
|
|
|
$this->assertTrue( wsl_check_requirements() ); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
function test_tables() |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
global $wpdb; |
29
|
|
|
|
30
|
|
|
$test = $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wslusersprofiles'" ); |
31
|
|
|
$this->assertEquals( $wpdb->prefix . 'wslusersprofiles', $test ); |
32
|
|
|
|
33
|
|
|
$test = $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wsluserscontacts'" ); |
34
|
|
|
$this->assertEquals( $wpdb->prefix . 'wsluserscontacts', $test ); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
function test_options_created() |
|
|
|
|
38
|
|
|
{ |
39
|
|
|
$test = get_option( 'wsl_settings_redirect_url' ); |
40
|
|
|
$this->assertEquals( home_url(), $test ); |
41
|
|
|
|
42
|
|
|
$test = get_option( 'wsl_settings_buddypress_xprofile_map' ); |
43
|
|
|
$this->assertEquals( '', $test ); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
function test_registration_enabled() |
|
|
|
|
47
|
|
|
{ |
48
|
|
|
$test = get_option( 'wsl_settings_bouncer_registration_enabled' ); |
49
|
|
|
$this->assertEquals( 1, $test ); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
function test_authentication_enabled() |
|
|
|
|
53
|
|
|
{ |
54
|
|
|
$test = get_option( 'wsl_settings_bouncer_authentication_enabled' ); |
55
|
|
|
$this->assertEquals( 1, $test ); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
function test_default_networks_enabled() |
|
|
|
|
59
|
|
|
{ |
60
|
|
|
$test = get_option( 'wsl_settings_Facebook_enabled' ); |
61
|
|
|
$this->assertEquals( 1, $test ); |
62
|
|
|
|
63
|
|
|
$test = get_option( 'wsl_settings_Google_enabled' ); |
64
|
|
|
$this->assertEquals( 1, $test ); |
65
|
|
|
|
66
|
|
|
$test = get_option( 'wsl_settings_Twitter_enabled' ); |
67
|
|
|
$this->assertEquals( 1, $test ); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
function test_devmode_disabled() |
|
|
|
|
71
|
|
|
{ |
72
|
|
|
$test = get_option( 'wsl_settings_development_mode_enabled' ) ? 1 : null; |
73
|
|
|
$this->assertNull( $test ); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
function test_debugmode_disabled() |
|
|
|
|
77
|
|
|
{ |
78
|
|
|
$test = get_option( 'wsl_settings_debug_mode_enabled' ) ? 1 : null; |
79
|
|
|
$this->assertNull( $test ); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.