5
5
*
6
6
* @package wordpress-plugins-tests
7
7
*/
8
+
9
+ require_once dirname (__FILE__ ) . '/../bootstrap.php ' ;
8
10
require_once BASE_TEST_DIR . '/clef-require.php ' ;
9
11
Clef::start ();
10
12
require_once BASE_TEST_DIR . '/includes/class.clef-session.php ' ;
@@ -14,7 +16,6 @@ class WP_Test_Login_Disable_Passwords extends WP_UnitTestCase {
14
16
15
17
public function setUp () {
16
18
parent ::setUp ();
17
- $ this ->setUpMocks ();
18
19
19
20
$ this ->settings = ClefInternalSettings::start ();
20
21
$ this ->settings ->set ('clef_settings_app_id ' , 'test_app_id ' );
@@ -30,31 +31,6 @@ public function setUp() {
30
31
$ _POST ['pwd ' ] = 'password ' ;
31
32
}
32
33
33
- function setUpMocks () {
34
- $ mock = PHPUnit_Framework_MockObject_Generator::getMock (
35
- 'ClefSession ' ,
36
- array ('start ' ),
37
- array (),
38
- '' ,
39
- false
40
- );
41
-
42
- // Replace protected self reference with mock object
43
- $ ref = new ReflectionProperty ('ClefSession ' , 'instance ' );
44
- $ ref ->setAccessible (true );
45
- $ ref ->setValue (null , $ mock );
46
-
47
- // Set expectations and return values
48
- $ mock
49
- ->expects (new PHPUnit_Framework_MockObject_Matcher_InvokedCount (1 ))
50
- ->method ('start ' )
51
- ->with (
52
- PHPUnit_Framework_Assert::equalTo ($ name )
53
- )
54
- ->will (new PHPUnit_Framework_MockObject_Stub_Return ($ replace ));
55
-
56
- }
57
-
58
34
function test_valid_override () {
59
35
global $ _POST ;
60
36
@@ -72,26 +48,32 @@ function test_invalid_override() {
72
48
$ this ->settings ->set ('clef_override_settings_key ' , $ override );
73
49
$ _POST = array ( 'override ' => 'bad ' );
74
50
75
- $ this ->assertInstanceOf (WP_Error, $ this ->login ->disable_passwords ($ this ->user ));
51
+ $ this ->assertInstanceOf (' WP_Error ' , $ this ->login ->disable_passwords ($ this ->user ));
76
52
}
77
53
78
54
function test_disabled () {
79
- $ this ->assertInstanceOf (WP_Error, $ this ->login ->disable_passwords ($ this ->user ));
55
+ $ this ->assertInstanceOf (' WP_Error ' , $ this ->login ->disable_passwords ($ this ->user ));
80
56
}
81
57
82
58
function test_empty_post () {
83
59
global $ _POST ;
84
60
$ _POST = array ();
85
61
86
- $ this ->assertInstanceOf (WP_Error, $ this ->login ->disable_passwords ($ this ->user ));
62
+ $ this ->assertInstanceOf (' WP_Error ' , $ this ->login ->disable_passwords ($ this ->user ));
87
63
}
88
64
65
+ /**
66
+ * @runInSeparateProcess
67
+ */
89
68
function test_xml_disabled () {
90
69
define ('XMLRPC_REQUEST ' , true );
91
70
92
- $ this ->assertInstanceOf (WP_Error, $ this ->login ->disable_passwords ($ this ->user ));
71
+ $ this ->assertInstanceOf (' WP_Error ' , $ this ->login ->disable_passwords ($ this ->user ));
93
72
}
94
73
74
+ /**
75
+ * @runInSeparateProcess
76
+ */
95
77
function test_xml_enabled () {
96
78
define ('XMLRPC_REQUEST ' , true );
97
79
$ this ->settings ->set ('clef_password_settings_xml_allowed ' , true );
0 commit comments