Code Duplication    Length = 44-44 lines in 2 locations

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

@@ 1028-1071 (lines=44) @@
1025
        $this->verify_attachment_roundtrip($raw, $expected);
1026
    }
1027
1028
    public function test_attachment_roundtrip_as_editor_unfiltered_html() 
1029
    {
1030
        wp_set_current_user(self::$editor_id);
1031
        if (is_multisite() ) {
1032
            $this->assertFalse(current_user_can('unfiltered_html'));
1033
            $this->verify_attachment_roundtrip(
1034
                array(
1035
                'title'       => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1036
                'description' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1037
                'caption'     => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1038
                ), array(
1039
                'title' => array(
1040
                'raw'      => 'div <strong>strong</strong> oh noes',
1041
                'rendered' => 'div <strong>strong</strong> oh noes',
1042
                ),
1043
                'description' => array(
1044
                'raw'      => '<div>div</div> <strong>strong</strong> oh noes',
1045
                'rendered' => "<div>div</div>\n<p> <strong>strong</strong> oh noes</p>",
1046
                ),
1047
                'caption' => array(
1048
                'raw'      => '<div>div</div> <strong>strong</strong> oh noes',
1049
                'rendered' => "<div>div</div>\n<p> <strong>strong</strong> oh noes</p>",
1050
                ),
1051
                ) 
1052
            );
1053
        } else {
1054
            $this->assertTrue(current_user_can('unfiltered_html'));
1055
            $this->verify_attachment_roundtrip(
1056
                array(
1057
                'title'       => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1058
                'description' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1059
                'caption'     => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1060
                ), array(
1061
                'title' => array(
1062
                'raw'      => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1063
                'rendered' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1064
                ),
1065
                'description' => array(
1066
                'raw'      => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1067
                'rendered' => "<div>div</div>\n<p> <strong>strong</strong> <script>oh noes</script></p>",
1068
                ),
1069
                'caption' => array(
1070
                'raw'      => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
1071
                'rendered' => "<div>div</div>\n<p> <strong>strong</strong> <script>oh noes</script></p>",
1072
                ),
1073
                ) 
1074
            );

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

@@ 2707-2750 (lines=44) @@
2704
        $this->verify_post_roundtrip($raw, $expected);
2705
    }
2706
2707
    public function test_post_roundtrip_as_editor_unfiltered_html() 
2708
    {
2709
        wp_set_current_user(self::$editor_id);
2710
        if (is_multisite() ) {
2711
            $this->assertFalse(current_user_can('unfiltered_html'));
2712
            $this->verify_post_roundtrip(
2713
                array(
2714
                'title'   => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2715
                'content' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2716
                'excerpt' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2717
                ), array(
2718
                'title' => array(
2719
                'raw'      => 'div <strong>strong</strong> oh noes',
2720
                'rendered' => 'div <strong>strong</strong> oh noes',
2721
                ),
2722
                'content' => array(
2723
                'raw'      => '<div>div</div> <strong>strong</strong> oh noes',
2724
                'rendered' => "<div>div</div>\n<p> <strong>strong</strong> oh noes</p>",
2725
                ),
2726
                'excerpt' => array(
2727
                'raw'      => '<div>div</div> <strong>strong</strong> oh noes',
2728
                'rendered' => "<div>div</div>\n<p> <strong>strong</strong> oh noes</p>",
2729
                ),
2730
                ) 
2731
            );
2732
        } else {
2733
            $this->assertTrue(current_user_can('unfiltered_html'));
2734
            $this->verify_post_roundtrip(
2735
                array(
2736
                'title'   => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2737
                'content' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2738
                'excerpt' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2739
                ), array(
2740
                'title' => array(
2741
                'raw'      => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2742
                'rendered' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2743
                ),
2744
                'content' => array(
2745
                'raw'      => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2746
                'rendered' => "<div>div</div>\n<p> <strong>strong</strong> <script>oh noes</script></p>",
2747
                ),
2748
                'excerpt' => array(
2749
                'raw'      => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
2750
                'rendered' => "<div>div</div>\n<p> <strong>strong</strong> <script>oh noes</script></p>",
2751
                ),
2752
                ) 
2753
            );