Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML API: Run coverage tests against full HTML API #6050

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions tests/phpunit/tests/html-api/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

// CSS Processor
//require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-css.php';

// Tag Processor
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-attribute-token.php';
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-span.php';
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-text-replacement.php';
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-tag-processor.php';

// HTML Processor
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-unsupported-exception.php';
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-active-formatting-elements.php';
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-open-elements.php';
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-token.php';
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-processor-state.php';
require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-processor.php';

// Templating
//require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html-template.php';
//require_once __DIR__ . '/../../../../src/wp-includes/html-api/class-wp-html.php';

if ( ! defined( 'DIR_TESTDATA' ) ) {
define( 'DIR_TESTDATA', __DIR__ . '/../../data' );
}

if ( ! class_exists( 'WP_UnitTestCase' ) ) {
class WP_UnitTestCase extends PHPUnit\Framework\TestCase {
public $caught_doing_it_wrong = array();

public function setExpectedIncorrectUsage( $doing_it_wrong ) {

}

Check failure on line 34 in tests/phpunit/tests/html-api/bootstrap.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Function closing brace must go on the next line following the body; found 1 blank lines before brace
}
}

if ( ! function_exists( 'esc_attr' ) ) {
function esc_attr( $s ) {
return str_replace( [ '<', '>', '"' ], [ '&lt;', '&gt;', '&quot;' ], $s );

Check failure on line 40 in tests/phpunit/tests/html-api/bootstrap.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Short array syntax is not allowed

Check failure on line 40 in tests/phpunit/tests/html-api/bootstrap.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Short array syntax is not allowed
}
}

if ( ! function_exists( 'esc_html' ) ) {
function esc_html( $s ) {
return esc_attr( $s );
}
}

if ( ! function_exists( '__' ) ) {
function __( $s ) {
return $s;
}
}

if ( ! function_exists( '_doing_it_wrong' ) ) {
function _doing_it_wrong( ...$args ) {

}

Check failure on line 59 in tests/phpunit/tests/html-api/bootstrap.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Function closing brace must go on the next line following the body; found 1 blank lines before brace
}

if ( ! class_exists( 'HTMLProcessorDebugger' ) ) {
class HTMLProcessorDebugger extends WP_HTML_Tag_Processor {

}
}
29 changes: 29 additions & 0 deletions tests/phpunit/tests/html-api/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit bootstrap="bootstrap.php" testdox="true" colors="true">
<php>
<!-- <const name="DEBUG" value="FALSE"/>-->
</php>
<testsuites>
<testsuite name="html-api">
<file>WpHtmlProcessor.php</file>
<!-- <file>WpHtmlProcessorHtml5lib.php</file>-->
<file>WpHtmlProcessorSemanticRules.php</file>
<file>WpHtmlProcessorSemanticRulesHeadingElements.php</file>
<file>WpHtmlProcessorSemanticRulesListElements.php</file>
<file>WpHtmlProcessorBreadcrumbs.php</file>
<!-- <file>WpHtmlProcessorGetInnerMarkup.php</file>-->
<!-- <file>WpHtmlProcessorGetOuterMarkup.php</file>-->
<!-- <file>WpHtmlProcessorSetInnerMarkup.php</file>-->
<!-- <file>WpHtmlProcessorSetOuterMarkup.php</file>-->
<file>WpHtmlSupportRequiredHtmlProcessor.php</file>
<file>WpHtmlSupportRequiredOpenElements.php</file>
<file>WpHtmlTagProcessor.php</file>
<file>WpHtmlTagProcessor-bookmark.php</file>
<file>WpHtmlProcessor-bookmark.php</file>
<!-- <file>WpHtmlTemplate.php</file>-->
<file>WpHtmlTagProcessor-token-scanning.php</file>
<!-- <file>WpHtmlTagProcessor-internals.php</file>-->
<!-- <file>WpHtmlProcessor-stringBuilder.php</file>-->
</testsuite>
</testsuites>
</phpunit>
Loading
Loading