PluginProbe
Extendify / 3.0.6
Extendify v3.0.6
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / tests / Integration / Agent / Controllers / WPControllerTest.php

WPControllerTest.php in Extendify 3.0.6, at tests/Integration/Agent/Controllers/WPControllerTest.php

32 lines 979 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Extendify\Tests\Integration\Agent\Controllers;
4
5 use Extendify\Agent\Controllers\WPController;
6 use Extendify\Shared\Services\Import\Post;
7 use WP_UnitTestCase;
8
9 class WPControllerTest extends WP_UnitTestCase
10 {
11 public function test_lock_post_prevents_importer_update()
12 {
13 $postId = self::factory()->post->create(['post_content' => '<p>original</p>']);
14 $post = get_post($postId);
15
16 $user = self::factory()->user->create();
17 wp_set_current_user($user);
18
19 $request = new \WP_REST_Request();
20 $request->set_param('postId', $postId);
21 WPController::lockPost($request);
22
23 // Attempt to update as the cron user (no user).
24 wp_set_current_user(0);
25 $result = Post::update($post, '<p>imported content</p>');
26
27 $this->assertWPError($result);
28 $this->assertSame(1005, $result->get_error_code());
29 $this->assertSame('<p>original</p>', get_post($postId)->post_content);
30 }
31 }
32