@@ -21,7 +21,6 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
2121 public static function wpTearDownAfterClass () {
2222 self ::delete_user ( self ::$ author_id );
2323 self ::delete_user ( self ::$ editor_id );
24- delete_option ( 'wp_collaboration_enabled ' );
2524 }
2625
2726 public function set_up () {
@@ -86,7 +85,7 @@ private function dispatch_autosave( int $post_id, string $title, string $content
8685 * @ticket 65138
8786 */
8887 public function test_auto_draft_autosave_promotes_parent_post_when_collaboration_is_disabled () {
89- update_option ( 'wp_collaboration_enabled ' , 0 );
88+ add_filter ( 'pre_option_wp_collaboration_enabled ' , ' __return_zero ' );
9089
9190 $ post_id = $ this ->create_auto_draft ();
9291 $ title = 'No RTC autosaved title ' ;
@@ -105,7 +104,7 @@ public function test_auto_draft_autosave_promotes_parent_post_when_collaboration
105104 * @ticket 65138
106105 */
107106 public function test_auto_draft_autosave_promotes_parent_post_when_collaboration_is_enabled () {
108- update_option ( 'wp_collaboration_enabled ' , 1 );
107+ add_filter ( 'pre_option_wp_collaboration_enabled ' , ' __return_true ' );
109108
110109 $ post_id = $ this ->create_auto_draft ();
111110 $ title = 'RTC autosaved title ' ;
@@ -124,7 +123,7 @@ public function test_auto_draft_autosave_promotes_parent_post_when_collaboration
124123 * @ticket 65138
125124 */
126125 public function test_collaborator_auto_draft_autosave_promotes_parent_post_when_collaboration_is_enabled () {
127- update_option ( 'wp_collaboration_enabled ' , 1 );
126+ add_filter ( 'pre_option_wp_collaboration_enabled ' , ' __return_true ' );
128127
129128 $ post_id = $ this ->create_auto_draft ();
130129 $ title = 'RTC collaborator autosaved title ' ;
@@ -144,7 +143,7 @@ public function test_collaborator_auto_draft_autosave_promotes_parent_post_when_
144143 * @ticket 65138
145144 */
146145 public function test_draft_autosave_creates_revision_when_collaboration_is_enabled () {
147- update_option ( 'wp_collaboration_enabled ' , 1 );
146+ add_filter ( 'pre_option_wp_collaboration_enabled ' , ' __return_true ' );
148147
149148 $ original_title = 'Original RTC draft title ' ;
150149 $ original_content = '<!-- wp:paragraph --><p>Original RTC draft content</p><!-- /wp:paragraph --> ' ;
0 commit comments