Code Duplication    Length = 23-24 lines in 2 locations

tests/phpunit/tests/rest-api/rest-comments-controller.php 1 location

@@ 1517-1540 (lines=24) @@
1514
        $this->assertEquals('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36', $data['author_user_agent']);
1515
    }
1516
1517
    public function test_create_comment_user_agent_header() 
1518
    {
1519
        wp_set_current_user(self::$admin_id);
1520
1521
        $params = array(
1522
         'post'         => self::$post_id,
1523
         'author_name'  => 'Homer Jay Simpson',
1524
         'author_email' => '[email protected]',
1525
         'author_url'   => 'http://compuglobalhypermeganet.com',
1526
         'content'      => 'Here\’s to alcohol: the cause of, and solution to, all of life\’s problems.',
1527
        );
1528
1529
        $request = new WP_REST_Request('POST', '/wp/v2/comments');
1530
        $request->add_header('content-type', 'application/json');
1531
        $request->add_header('user_agent', 'Mozilla/4.0 (compatible; MSIE 5.5; AOL 4.0; Windows 95)');
1532
        $request->set_body(wp_json_encode($params));
1533
1534
        $response = $this->server->dispatch($request);
1535
        $this->assertEquals(201, $response->get_status());
1536
1537
        $data = $response->get_data();
1538
1539
        $new_comment = get_comment($data['id']);
1540
        $this->assertEquals('Mozilla/4.0 (compatible; MSIE 5.5; AOL 4.0; Windows 95)', $new_comment->comment_agent);
1541
    }
1542
1543
    public function test_create_comment_author_ip() 

tests/phpunit/tests/rest-api/rest-users-controller.php 1 location

@@ 1495-1517 (lines=23) @@
1492
        $this->assertArrayNotHasKey('BeSharp', $user->caps);
1493
    }
1494
1495
    public function test_update_user_without_permission() 
1496
    {
1497
        wp_set_current_user(self::$editor);
1498
1499
        $params = array(
1500
         'username' => 'homersimpson',
1501
         'password' => 'stupidsexyflanders',
1502
         'email'    => '[email protected]',
1503
        );
1504
1505
        $request = new WP_REST_Request('PUT', sprintf('/wp/v2/users/%d', self::$user));
1506
        $request->add_header('content-type', 'application/x-www-form-urlencoded');
1507
        $request->set_body_params($params);
1508
        $response = $this->server->dispatch($request);
1509
1510
        $this->assertErrorResponse('rest_cannot_edit', $response, 403);
1511
1512
        $request = new WP_REST_Request('PUT', '/wp/v2/users/me');
1513
        $request->add_header('content-type', 'application/x-www-form-urlencoded');
1514
        $request->set_body_params($params);
1515
        $response = $this->server->dispatch($request);
1516
1517
        $this->assertErrorResponse('rest_user_invalid_argument', $response, 400);
1518
    }
1519
1520
    public function test_update_user_invalid_id()