Make WordPress Core

Ticket #34121: 34121.2.diff

File 34121.2.diff, 2.3 KB (added by miqrogroove, 11 years ago)

Missing parts

  • tests/phpunit/includes/utils.php

     
    432432                        continue;
    433433                case PREG_RECURSION_LIMIT_ERROR:
    434434                        trigger_error('PCRE recursion limit encountered before backtrack limit.');
    435                         break;
     435                        return;
    436436                case PREG_BAD_UTF8_ERROR:
    437437                        trigger_error('UTF-8 error during PCRE benchmark.');
    438                         break;
     438                        return;
    439439                case PREG_INTERNAL_ERROR:
    440440                        trigger_error('Internal error during PCRE benchmark.');
    441                         break;
     441                        return;
    442442                default:
    443                         trigger_error('Unexpected error during PCRE benchmark.');       
     443                        trigger_error('Unexpected error during PCRE benchmark.');
     444                        return;
    444445                }
    445446        }
    446447
  • tests/phpunit/tests/formatting/WpHtmlSplit.php

     
     1<?php
     2
     3/**
     4 * @group formatting
     5 */
     6class Tests_Formatting_WpHtmlSplit extends WP_UnitTestCase {
     7
     8        /**
     9         * Basic functionality goes here.
     10         *
     11         * @dataProvider data_basic_features
     12         */
     13        function test_basic_features( $input, $output ) {
     14                return $this->assertEquals( $output, wp_html_split( $input ) );
     15        }
     16
     17        function data_basic_features() {
     18                return array(
     19                        array(
     20                                'abcd efgh',
     21                                array( 'abcd efgh' ),
     22                        ),
     23                        array(
     24                                'abcd <html> efgh',
     25                                array( 'abcd ', '<html>', ' efgh' ),
     26                        ),
     27                        array(
     28                                'abcd <!-- <html> --> efgh',
     29                                array( 'abcd ', '<!-- <html> -->', ' efgh' ),
     30                        ),
     31                        array(
     32                                'abcd <![CDATA[ <html> ]]> efgh',
     33                                array( 'abcd ', '<![CDATA[ <html> ]]>', ' efgh' ),
     34                        ),
     35                );
     36        }
     37
     38        /**
     39         * Automated performance testing of the main regex.
     40         *
     41         * @dataProvider data_whole_posts
     42         */
     43        function test_pcre_performance( $input ) {
     44                $regex = get_html_split_regex();
     45                $result = benchmark_pcre_backtracking( $regex, $input, 'split' );
     46                return $this->assertLessThan( 200, $result );
     47        }
     48
     49        function data_whole_posts() {
     50                require_once( DIR_TESTDATA . '/formatting/whole-posts.php' );
     51                return data_whole_posts();
     52        }
     53}
     54 No newline at end of file