From 5e6ea9d30be8d258307357b09dea856d427ee289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Thu, 9 Jan 2025 12:56:39 +0100 Subject: [PATCH] Don't throw exceptions in tests --- .../playground/data-liberation/bootstrap.php | 2 +- .../playground/data-liberation/phpunit.xml | 2 +- .../WPFilesystemToPostHierarchyTests.php | 41 - .../tests/WPGitServerTests.php | 5 +- .../html-to-blocks/excerpt.output.html | 2885 +++++++++++++++++ 5 files changed, 2890 insertions(+), 45 deletions(-) delete mode 100644 packages/playground/data-liberation/tests/WPFilesystemToPostHierarchyTests.php diff --git a/packages/playground/data-liberation/bootstrap.php b/packages/playground/data-liberation/bootstrap.php index 3faee3a4cf..4f2983cf43 100644 --- a/packages/playground/data-liberation/bootstrap.php +++ b/packages/playground/data-liberation/bootstrap.php @@ -122,7 +122,7 @@ if ( ! function_exists( '_doing_it_wrong' ) ) { $GLOBALS['_doing_it_wrong_messages'] = array(); function _doing_it_wrong( $method, $message, $version ) { - throw new Exception( $message ); + // throw new Exception( $message ); $GLOBALS['_doing_it_wrong_messages'][] = $message; } } diff --git a/packages/playground/data-liberation/phpunit.xml b/packages/playground/data-liberation/phpunit.xml index a2046b29ec..b29fbbdbf6 100644 --- a/packages/playground/data-liberation/phpunit.xml +++ b/packages/playground/data-liberation/phpunit.xml @@ -18,7 +18,7 @@ tests/WPHTMLEntityReaderTests.php tests/WPEPubEntityReaderTests.php tests/WPDirectoryTreeEntityReaderTests.php - tests/WPFilesystemToPostHierarchyTests.php + tests/WPFilesystemToPostTreeTests.php tests/WPURLInTextProcessorTests.php tests/WPBlockMarkupProcessorTests.php tests/WPBlockMarkupUrlProcessorTests.php diff --git a/packages/playground/data-liberation/tests/WPFilesystemToPostHierarchyTests.php b/packages/playground/data-liberation/tests/WPFilesystemToPostHierarchyTests.php deleted file mode 100644 index c39c33f1ff..0000000000 --- a/packages/playground/data-liberation/tests/WPFilesystemToPostHierarchyTests.php +++ /dev/null @@ -1,41 +0,0 @@ - __DIR__ . '/fixtures/directory-tree-entity-reader', - 'first_post_id' => 2, - 'create_index_pages' => true, - 'filter_pattern' => '#\.html$#', - 'index_file_pattern' => '#root.html#', - ] - ); - $posts = []; - while ( $reader->next_post() ) { - $posts[] = $reader->get_current_post(); - } - $this->assertCount(3, $posts); - - // The root index page - // Root index page - $this->assertEquals(2, $posts[0]['post_id']); - $this->assertNull($posts[0]['parent_id']); - $this->assertEquals('file', $posts[0]['type']); - - // Nested directory page - $this->assertEquals(3, $posts[1]['post_id']); - $this->assertEquals(2, $posts[1]['parent_id']); - $this->assertEquals('directory', $posts[1]['type']); - - // Leaf page - $this->assertEquals(4, $posts[2]['post_id']); - $this->assertEquals(3, $posts[2]['parent_id']); - $this->assertEquals('file', $posts[2]['type']); - } - -} diff --git a/packages/playground/data-liberation/tests/WPGitServerTests.php b/packages/playground/data-liberation/tests/WPGitServerTests.php index 3d4a81c4c0..6fee1fb3ea 100644 --- a/packages/playground/data-liberation/tests/WPGitServerTests.php +++ b/packages/playground/data-liberation/tests/WPGitServerTests.php @@ -206,8 +206,9 @@ public function test_handle_ls_refs_returns_matching_refs($request, $expected_re array($this->main_branch_oid, $this->dev_branch_oid), $expected_response ); - $response = $this->server->handle_ls_refs_request($request); - $this->assertEquals($expected_response, $response); + $response = new BufferingResponseWriter(); + $this->server->handle_ls_refs_request($request, $response); + $this->assertEquals($expected_response, $response->get_buffered_body()); } public function provideRefRequests() { diff --git a/packages/playground/data-liberation/tests/fixtures/html-to-blocks/excerpt.output.html b/packages/playground/data-liberation/tests/fixtures/html-to-blocks/excerpt.output.html index e69de29bb2..c96636c167 100644 --- a/packages/playground/data-liberation/tests/fixtures/html-to-blocks/excerpt.output.html +++ b/packages/playground/data-liberation/tests/fixtures/html-to-blocks/excerpt.output.html @@ -0,0 +1,2885 @@ + +

WHATWG

+

HTML

+ +

Living Standard — Last Updated 12 December 2024

+ +

One-Page Version html.spec.whatwg.org Multipage Version /multipage Version for Web Devs /dev PDF Version /print.pdf Translations 日本語 • 简体中文 FAQ on GitHub Chat on Matrix Contribute on GitHub whatwg/html repository Commits on GitHub Snapshot as of this commit Twitter Updates @htmlstandard Open Issues filed on GitHub Open an Issue whatwg.org/newbug Tests web-platform-tests html/ Issues for Tests ongoing work

+

Table of contents

+ + + +

Full table of contents

+ + + +

1 Introduction

+ +

1.1 Where does this specification fit?

+ +

This specification defines a big part of the web platform, in lots of detail. Its place in the + web platform specification stack relative to other specifications can be best summed up as + follows:

+ +

1.2 Is this HTML5?

+ +

This section is non-normative.

+ +

In short: Yes.

+ +

In more length: the term "HTML5" is widely used as a buzzword to refer to modern web + technologies, many of which (though by no means all) are developed at the WHATWG. This document is + one such; others are available from the WHATWG Standards + overview .

+ +

1.3 Background

+ +

This section is non-normative.

+ +

HTML is the World Wide Web's core markup language. Originally, HTML was primarily designed as a + language for semantically describing scientific documents. Its general design, however, has + enabled it to be adapted, over the subsequent years, to describe a number of other types of + documents and even applications.

+ +

1.4 Audience

+ +

This section is non-normative.

+ +

This specification is intended for authors of documents and scripts that use the features + defined in this specification, implementers of tools that operate on pages that + use the features defined in this specification, and individuals wishing to establish the + correctness of documents or implementations with respect to the requirements of this + specification.

+ +

This document is probably not suited to readers who do not already have at least a passing + familiarity with web technologies, as in places it sacrifices clarity for precision, and brevity + for completeness. More approachable tutorials and authoring guides can provide a gentler + introduction to the topic.

+ +

In particular, familiarity with the basics of DOM is necessary for a complete understanding of + some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML, + Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not + essential.

+ +

1.5 Scope

+ +

This section is non-normative.

+ +

This specification is limited to providing a semantic-level markup language and associated + semantic-level scripting APIs for authoring accessible pages on the web ranging from static + documents to dynamic applications.

+ +

The scope of this specification does not include providing mechanisms for media-specific + customization of presentation (although default rendering rules for web browsers are included at + the end of this specification, and several mechanisms for hooking into CSS are provided as part of + the language).

+ +

The scope of this specification is not to describe an entire operating system. In particular, + hardware configuration software, image manipulation tools, and applications that users would be + expected to use with high-end workstations on a daily basis are out of scope. In terms of + applications, this specification is targeted specifically at applications that would be expected + to be used by users on an occasional basis, or regularly but from disparate locations, with low + CPU requirements. Examples of such applications include online purchasing systems, searching + systems, games (especially multiplayer online games), public telephone books or address books, + communications software (email clients, instant messaging clients, discussion software), document + editing software, etc.

+ +

1.6 History

+ +

This section is non-normative.

+ +

For its first five years (1990-1995), HTML went through a number of revisions and experienced a