| @@ 920-1015 (lines=96) @@ | ||
| 917 | $this->assertEquals($expected_output['caption']['raw'], $post->post_excerpt); |
|
| 918 | } |
|
| 919 | ||
| 920 | public static function attachment_roundtrip_provider() |
|
| 921 | { |
|
| 922 | return array( |
|
| 923 | array( |
|
| 924 | // Raw values. |
|
| 925 | array( |
|
| 926 | 'title' => '\o/ ¯\_(ツ)_/¯', |
|
| 927 | 'description' => '\o/ ¯\_(ツ)_/¯', |
|
| 928 | 'caption' => '\o/ ¯\_(ツ)_/¯', |
|
| 929 | ), |
|
| 930 | // Expected returned values. |
|
| 931 | array( |
|
| 932 | 'title' => array( |
|
| 933 | 'raw' => '\o/ ¯\_(ツ)_/¯', |
|
| 934 | 'rendered' => '\o/ ¯\_(ツ)_/¯', |
|
| 935 | ), |
|
| 936 | 'description' => array( |
|
| 937 | 'raw' => '\o/ ¯\_(ツ)_/¯', |
|
| 938 | 'rendered' => '<p>\o/ ¯\_(ツ)_/¯</p>', |
|
| 939 | ), |
|
| 940 | 'caption' => array( |
|
| 941 | 'raw' => '\o/ ¯\_(ツ)_/¯', |
|
| 942 | 'rendered' => '<p>\o/ ¯\_(ツ)_/¯</p>', |
|
| 943 | ), |
|
| 944 | ) |
|
| 945 | ), |
|
| 946 | array( |
|
| 947 | // Raw values. |
|
| 948 | array( |
|
| 949 | 'title' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 950 | 'description' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 951 | 'caption' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 952 | ), |
|
| 953 | // Expected returned values. |
|
| 954 | array( |
|
| 955 | 'title' => array( |
|
| 956 | 'raw' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 957 | 'rendered' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 958 | ), |
|
| 959 | 'description' => array( |
|
| 960 | 'raw' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 961 | 'rendered' => '<p>\\\&\\\ & &invalid; < < &lt;</p>', |
|
| 962 | ), |
|
| 963 | 'caption' => array( |
|
| 964 | 'raw' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 965 | 'rendered' => '<p>\\\&\\\ & &invalid; < < &lt;</p>', |
|
| 966 | ), |
|
| 967 | ), |
|
| 968 | ), |
|
| 969 | array( |
|
| 970 | // Raw values. |
|
| 971 | array( |
|
| 972 | 'title' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', |
|
| 973 | 'description' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', |
|
| 974 | 'caption' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', |
|
| 975 | ), |
|
| 976 | // Expected returned values. |
|
| 977 | array( |
|
| 978 | 'title' => array( |
|
| 979 | 'raw' => 'div <strong>strong</strong> oh noes', |
|
| 980 | 'rendered' => 'div <strong>strong</strong> oh noes', |
|
| 981 | ), |
|
| 982 | 'description' => array( |
|
| 983 | 'raw' => '<div>div</div> <strong>strong</strong> oh noes', |
|
| 984 | 'rendered' => "<div>div</div>\n<p> <strong>strong</strong> oh noes</p>", |
|
| 985 | ), |
|
| 986 | 'caption' => array( |
|
| 987 | 'raw' => '<div>div</div> <strong>strong</strong> oh noes', |
|
| 988 | 'rendered' => "<div>div</div>\n<p> <strong>strong</strong> oh noes</p>", |
|
| 989 | ), |
|
| 990 | ) |
|
| 991 | ), |
|
| 992 | array( |
|
| 993 | // Raw values. |
|
| 994 | array( |
|
| 995 | 'title' => '<a href="#" target="_blank" data-unfiltered=true>link</a>', |
|
| 996 | 'description' => '<a href="#" target="_blank" data-unfiltered=true>link</a>', |
|
| 997 | 'caption' => '<a href="#" target="_blank" data-unfiltered=true>link</a>', |
|
| 998 | ), |
|
| 999 | // Expected returned values. |
|
| 1000 | array( |
|
| 1001 | 'title' => array( |
|
| 1002 | 'raw' => '<a href="#">link</a>', |
|
| 1003 | 'rendered' => '<a href="#">link</a>', |
|
| 1004 | ), |
|
| 1005 | 'description' => array( |
|
| 1006 | 'raw' => '<a href="#" target="_blank">link</a>', |
|
| 1007 | 'rendered' => '<p><a href="#" target="_blank">link</a></p>', |
|
| 1008 | ), |
|
| 1009 | 'caption' => array( |
|
| 1010 | 'raw' => '<a href="#" target="_blank">link</a>', |
|
| 1011 | 'rendered' => '<p><a href="#" target="_blank">link</a></p>', |
|
| 1012 | ), |
|
| 1013 | ) |
|
| 1014 | ), |
|
| 1015 | ); |
|
| 1016 | } |
|
| 1017 | ||
| 1018 | /** |
|
| @@ 2599-2694 (lines=96) @@ | ||
| 2596 | $this->assertEquals($expected_output['excerpt']['raw'], $post->post_excerpt); |
|
| 2597 | } |
|
| 2598 | ||
| 2599 | public static function post_roundtrip_provider() |
|
| 2600 | { |
|
| 2601 | return array( |
|
| 2602 | array( |
|
| 2603 | // Raw values. |
|
| 2604 | array( |
|
| 2605 | 'title' => '\o/ ¯\_(ツ)_/¯', |
|
| 2606 | 'content' => '\o/ ¯\_(ツ)_/¯', |
|
| 2607 | 'excerpt' => '\o/ ¯\_(ツ)_/¯', |
|
| 2608 | ), |
|
| 2609 | // Expected returned values. |
|
| 2610 | array( |
|
| 2611 | 'title' => array( |
|
| 2612 | 'raw' => '\o/ ¯\_(ツ)_/¯', |
|
| 2613 | 'rendered' => '\o/ ¯\_(ツ)_/¯', |
|
| 2614 | ), |
|
| 2615 | 'content' => array( |
|
| 2616 | 'raw' => '\o/ ¯\_(ツ)_/¯', |
|
| 2617 | 'rendered' => '<p>\o/ ¯\_(ツ)_/¯</p>', |
|
| 2618 | ), |
|
| 2619 | 'excerpt' => array( |
|
| 2620 | 'raw' => '\o/ ¯\_(ツ)_/¯', |
|
| 2621 | 'rendered' => '<p>\o/ ¯\_(ツ)_/¯</p>', |
|
| 2622 | ), |
|
| 2623 | ) |
|
| 2624 | ), |
|
| 2625 | array( |
|
| 2626 | // Raw values. |
|
| 2627 | array( |
|
| 2628 | 'title' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 2629 | 'content' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 2630 | 'excerpt' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 2631 | ), |
|
| 2632 | // Expected returned values. |
|
| 2633 | array( |
|
| 2634 | 'title' => array( |
|
| 2635 | 'raw' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 2636 | 'rendered' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 2637 | ), |
|
| 2638 | 'content' => array( |
|
| 2639 | 'raw' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 2640 | 'rendered' => '<p>\\\&\\\ & &invalid; < < &lt;</p>', |
|
| 2641 | ), |
|
| 2642 | 'excerpt' => array( |
|
| 2643 | 'raw' => '\\\&\\\ & &invalid; < < &lt;', |
|
| 2644 | 'rendered' => '<p>\\\&\\\ & &invalid; < < &lt;</p>', |
|
| 2645 | ), |
|
| 2646 | ), |
|
| 2647 | ), |
|
| 2648 | array( |
|
| 2649 | // Raw values. |
|
| 2650 | array( |
|
| 2651 | 'title' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', |
|
| 2652 | 'content' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', |
|
| 2653 | 'excerpt' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', |
|
| 2654 | ), |
|
| 2655 | // Expected returned values. |
|
| 2656 | array( |
|
| 2657 | 'title' => array( |
|
| 2658 | 'raw' => 'div <strong>strong</strong> oh noes', |
|
| 2659 | 'rendered' => 'div <strong>strong</strong> oh noes', |
|
| 2660 | ), |
|
| 2661 | 'content' => array( |
|
| 2662 | 'raw' => '<div>div</div> <strong>strong</strong> oh noes', |
|
| 2663 | 'rendered' => "<div>div</div>\n<p> <strong>strong</strong> oh noes</p>", |
|
| 2664 | ), |
|
| 2665 | 'excerpt' => array( |
|
| 2666 | 'raw' => '<div>div</div> <strong>strong</strong> oh noes', |
|
| 2667 | 'rendered' => "<div>div</div>\n<p> <strong>strong</strong> oh noes</p>", |
|
| 2668 | ), |
|
| 2669 | ) |
|
| 2670 | ), |
|
| 2671 | array( |
|
| 2672 | // Raw values. |
|
| 2673 | array( |
|
| 2674 | 'title' => '<a href="#" target="_blank" data-unfiltered=true>link</a>', |
|
| 2675 | 'content' => '<a href="#" target="_blank" data-unfiltered=true>link</a>', |
|
| 2676 | 'excerpt' => '<a href="#" target="_blank" data-unfiltered=true>link</a>', |
|
| 2677 | ), |
|
| 2678 | // Expected returned values. |
|
| 2679 | array( |
|
| 2680 | 'title' => array( |
|
| 2681 | 'raw' => '<a href="#">link</a>', |
|
| 2682 | 'rendered' => '<a href="#">link</a>', |
|
| 2683 | ), |
|
| 2684 | 'content' => array( |
|
| 2685 | 'raw' => '<a href="#" target="_blank">link</a>', |
|
| 2686 | 'rendered' => '<p><a href="#" target="_blank">link</a></p>', |
|
| 2687 | ), |
|
| 2688 | 'excerpt' => array( |
|
| 2689 | 'raw' => '<a href="#" target="_blank">link</a>', |
|
| 2690 | 'rendered' => '<p><a href="#" target="_blank">link</a></p>', |
|
| 2691 | ), |
|
| 2692 | ) |
|
| 2693 | ), |
|
| 2694 | ); |
|
| 2695 | } |
|
| 2696 | ||
| 2697 | /** |
|