11
11
12
12
/**
13
13
* Test Surge integration.
14
+ *
15
+ * @group integration
16
+ * @coversDefaultClass \Activitypub\Integration\Surge
14
17
*/
15
18
class Test_Surge extends \WP_UnitTestCase {
16
19
/**
@@ -21,11 +24,11 @@ class Test_Surge extends \WP_UnitTestCase {
21
24
private $ test_file ;
22
25
23
26
/**
24
- * Original config file path .
27
+ * Config contents .
25
28
*
26
29
* @var string
27
30
*/
28
- private $ original_config_file ;
31
+ private $ config_contents ;
29
32
30
33
/**
31
34
* Original cache config.
@@ -83,7 +86,7 @@ public function test_add_cache_config() {
83
86
84
87
$ this ->assertStringContainsString ( '<?php ' , $ file , 'File should start with PHP opening tag ' );
85
88
$ this ->assertStringContainsString ( "/* That's all, stop editing! */ " , $ file , 'Comment should be present ' );
86
- $ this ->assertStringContainsString ( Surge::$ cache_config , $ file , 'Config line should be present ' );
89
+ $ this ->assertStringContainsString ( Surge::get_cache_config () , $ file , 'Config line should be present ' );
87
90
}
88
91
89
92
/**
@@ -101,7 +104,7 @@ public function test_remove_cache_config() {
101
104
// phpcs:ignore
102
105
$ actual = \file_get_contents ( Surge::get_config_file_path () );
103
106
$ this ->assertStringContainsString ( '<?php ' , $ actual , 'File should start with PHP opening tag ' );
104
- $ this ->assertStringNotContainsString ( Surge::$ cache_config , $ actual , 'Config line should be removed ' );
107
+ $ this ->assertStringNotContainsString ( Surge::get_cache_config () , $ actual , 'Config line should be removed ' );
105
108
$ this ->assertStringContainsString ( "/* That's all, stop editing! */ " , $ actual , 'Comment should be present ' );
106
109
}
107
110
@@ -115,7 +118,7 @@ public function test_init_with_surge_active() {
115
118
116
119
// phpcs:ignore
117
120
$ before = \file_get_contents ( Surge::get_config_file_path () );
118
- $ this ->assertStringNotContainsString ( Surge::$ cache_config , $ before );
121
+ $ this ->assertStringNotContainsString ( Surge::get_cache_config () , $ before );
119
122
120
123
Surge::init ();
121
124
@@ -124,7 +127,7 @@ public function test_init_with_surge_active() {
124
127
125
128
// phpcs:ignore
126
129
$ after = \file_get_contents ( Surge::get_config_file_path () );
127
- $ this ->assertStringContainsString ( Surge::$ cache_config , $ after );
130
+ $ this ->assertStringContainsString ( Surge::get_cache_config () , $ after );
128
131
129
132
\remove_all_filters ( 'pre_option_active_plugins ' );
130
133
}
@@ -145,7 +148,7 @@ public function get_active_plugins() {
145
148
*/
146
149
public function test_init_with_surge_inactive () {
147
150
// phpcs:ignore
148
- \file_put_contents ( Surge::get_config_file_path (), "<?php \n" . Surge::$ cache_config . "\n\n/* That's all, stop editing! */ " );
151
+ \file_put_contents ( Surge::get_config_file_path (), "<?php \n" . Surge::get_cache_config () . "\n\n/* That's all, stop editing! */ " );
149
152
\add_filter ( 'pre_option_active_plugins ' , array ( $ this , 'get_inactive_plugins ' ) );
150
153
151
154
Surge::init ();
@@ -155,7 +158,7 @@ public function test_init_with_surge_inactive() {
155
158
156
159
// phpcs:ignore
157
160
$ after = \file_get_contents ( Surge::get_config_file_path () );
158
- $ this ->assertStringNotContainsString ( Surge::$ cache_config , $ after );
161
+ $ this ->assertStringNotContainsString ( Surge::get_cache_config () , $ after );
159
162
160
163
\remove_all_filters ( 'pre_option_active_plugins ' );
161
164
}
0 commit comments