Commit graph

13 commits

Author SHA1 Message Date
C. Scott Ananian
93f0648a35 [tests] Remove use of dynamic property Parser::$static_tag_buf
There are only two test cases using the <statictag> tag extension and
it's no longer entirely clear what regression they were intended to
prevent.

In any case, we can use ParserOutput to maintain our parser state
instead of the dynamic Parser::$static_tag_buf property.  That's not a
perfect solution -- T300979 says at some point in the future we won't
guarantee parse order -- but it will work for now.

Bug: T357838
Change-Id: Ia23049fc729c90a94fc16231ad89c199db5b7bc9
2024-02-22 16:02:19 -05:00
Subramanya Sastry
e55cc517da Move Parser to Mediawiki\Parser namespace
Bug: T166010
Co-Authored-By: Daimona Eaytoy <daimona.wiki@gmail.com>
Co-Authored-By: James Forrester <jforrester@wikimedia.org>
Co-Authored-By: Subramanya Sastry <ssastry@wikimedia.org>
Change-Id: I79b4e732c45095eedbaa80afa5eb7479b387ed8a
2024-02-16 09:18:38 -05:00
C. Scott Ananian
fac9f7f17d ParserTests: add <pwraptest> and <spantag> tags for use in parser tests
The <pwraptest> extension tag helps test paragraph-wrapping issues.

The <spantag> tag behaves like a simplified version of <ref> and is
used to test behavior in a standalone way without requiring the Cite
extension to be installed.

Bug: T354215
Change-Id: I73f4fa256fb9e61804a2722ac350e26423b633ca
2024-01-19 11:54:58 -05:00
Amir Sarabadani
52f33d7d72 Bump phan to 0.13.0
Change-Id: I57c25d953700ca1cd97cc71ec2a28cbeb9ee875f
2023-09-11 19:22:44 +02:00
Amir Sarabadani
7d8768e931 Reorg: Move HTML-related classes out of includes/ to Html/
Bug: T321882
Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
2023-02-16 20:40:01 +01:00
C. Scott Ananian
398e86f7c7 Make private deprecated public properties of Parser
This prepares for a split of the parser class.  These properties were
deprecated for public use in 1.35.

Some adjustments to phan annotations were necessary, as phan seems to
have a stronger analysis of the Parser class after this patch.

Bug: T236810
Bug: T236812
Change-Id: I66ad07d004a081096edec641141e787fc2cc0958
2022-09-19 23:44:56 -04:00
Umherirrender
3acc9e63c0 tests/parser: Run phan
Run phan over classes in tests/parser

The dependency of classes between parser and phpunit is not clear.
Classes used by both possible needs part of /common/

Change-Id: I2ceca6b7cd447876c127ed3b14e09f479defbd93
2022-06-02 00:13:30 +02:00
Máté Szabó
377c53ae51 Don't p-wrap <aside> tags in extension HTML
Our PortableInfobox extension uses the HTML5 <aside> tag in its generated HTML.
This tag isn't recognized as a block element (in the way e.g. <div> is) by the
legacy parser, resulting in some spurious empty paragraphs in the output.

As a fix, make the legacy parser aware of <aside> tags to avoid unnecessary
p-wrapping. Also add <aside> to the Sanitizer's internal attribute check.
I3e57f55ac69d2c1ee8a1d41c21b692e56fc7e628 takes care of updating Parsoid-PHP
accordingly.

Bug: T278565
Change-Id: I89dbdf7770e13e1b62320228a366c64e64217b0b
2021-04-06 16:26:12 +02:00
Thiemo Kreuz
a4b1014ef3 tests: Don't expect the Parser to be passed by ref
Change-Id: I6a64428e729d8675cec1978795fc2eef455432ec
2019-11-18 17:43:35 +01:00
Umherirrender
5bd311b1a2 Add public as visibility in tests folder
Add public, protected or private to function missing a visibility
Enable the tests folder for the phpcs sniff

Change-Id: Ibefce76ea9984c47e08c94889ea2eafca7565e2c
2019-10-10 21:55:37 +02:00
Fomafix
512aa4e551 Use PHP 7 '??' operator instead of if-then-else
Change-Id: Ia86f8433f30a166d38ee63d0d1745b26740767b9
2018-10-27 23:46:13 +02:00
Umherirrender
255d76f2a1 build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable

For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore

Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
2018-01-01 14:10:16 +01:00
Tim Starling
a387fee397 Split up testHelpers.inc, break off fuzz testing
* Split up testHelpers.inc into one class per file, with the file named
  after the class per the usual convention. Put them in tests/parser
  since they are all parser-related, even though a couple are reused by
  other unit tests.
* Also rename parserTest.inc and parserTestsParserHook.php to follow the
  usual convention, and split off ParserTestResultNormalizer
* Move fuzz testing out to its own maintenance script. It's really not
  helpful to have fuzz testing, which is designed to run forever,
  exposed as a PHPUnit test.
* Increased fuzz test memory limit, and increased the memory headroom for
  getMemoryBreakdown(), since HHVM's ReflectionClass has an internal
  cache which uses quite a lot of memory.
* Temporarily switched a couple of ParserTest methods from private to
  public to support fuzz testing from a separate class -- I plan on
  replacing this interface in a subsequent commit.

Change-Id: Ib1a07e109ec1005bff2751b78eb4de35f2dfc472
2016-09-08 09:06:45 +10:00
Renamed from tests/parser/parserTestsParserHook.php (Browse further)