aboutsummaryrefslogtreecommitdiffstats
path: root/tests/parser/TestFileEditor.php
Commit message (Collapse)AuthorAgeFilesLines
* tests: Use type declaration on undocumented private functionsUmherirrender2025-03-301-3/+3
| | | | Change-Id: I56b31870ce9be46d15fcd9095f9a12e0f2488ed9
* Improve type documentation in parser test runner classesthiemowmde2024-01-201-2/+2
| | | | | | Mostly unspecific "array" type hints that can be made more specific. Change-Id: I5ceb042d0a8740867ae7e5718dfed1f4b632596f
* Replace generic `new Exception` with more generic onesthiemowmde2023-10-171-3/+3
| | | | | | | | | | … or with $this->fail() from the PHPUnit TestCase base class. I hope this makes the code more readable, i.e. communicate the intention better. The output should be the same, i.e. the test fails as before in case of an error. Change-Id: Ied8a045141ac92d6af6398682bb5d9ca7ca88c49
* TestFileEditor: Fix string interpolationReedy2022-11-041-1/+1
| | | | | Bug: T314096 Change-Id: Id689bf648f64e27585907ecf04a36d23b28b684e
* tests/parser: Add documentation for class propertiesUmherirrender2022-06-011-0/+7
| | | | | | Also add missing properties Change-Id: Ia2443348a40fc46afb9133c997db7120461373f4
* Move property initialisation out of the constructorThiemo Kreuz2022-01-271-4/+2
| | | | | | | | | When the value is a constant, the initialization can be done way up together with the property declaration. I believe this makes the code easier to read because it's not spread out so much. Change-Id: I5af482feccb746c144c0f318e119165cf5a56cbe
* Use array_fill_keys() instead of array_flip() if that reflects the ↵Tim Starling2021-06-151-1/+1
| | | | | | | | | | | | | | | | | | developer's intention array_fill_keys() was introduced in PHP 5.2.0 and works like array_flip() except that it does only one thing (copying keys) instead of two things (copying keys and values). That makes it faster and more obvious. When array_flip() calls were paired, I left them as is, because that pattern is too cute. I couldn't kill something so cute. Sometimes it was hard to figure out whether the values in array_flip() result were used. That's the point of this change. If you use array_fill_keys(), the intention is obvious. Change-Id: If8d340a8bc816a15afec37e64f00106ae45e10ed
* Parser: remove leftover "transparent hook" codeC. Scott Ananian2020-01-281-1/+0
| | | | | Followup-To: I8384f47bbcde7604efa41b83db0dbc4f429219a8 Change-Id: I6da8cefad8bc70631277f9b7bd5d1af5474259ab
* Rewrite confusing loop in TestFileEditor helper classThiemo Kreuz2019-11-111-7/+3
| | | | | | | | | | | | | I had to write a little test to understand what this loop is supposed to do: All it really does is counting the number of consecutive empty lines in the $this->lines array, starting at the offset $this->pos. The only edge-case is when the array does not contain anything but empty lines. In this case, the last empty line is skipped. This is because explode( …, "\n\n\n" ) returns 4 elements, but we want to count the number of newline characters, which is 3. Change-Id: I74ae1ed6ba0a8d65a92a1dd07f681fd7ae4221b4
* Require indentation of CASE statements in PHP codeHuji Lee2017-12-101-12/+12
| | | | | Bug: T182546 Change-Id: I91a9555893a08e4ec58da97c6cc4d1e70000ff6b
* parser test editor: Fix emitting of !! hooksKunal Mehta2017-01-311-1/+1
| | | | | | | | | | | | | The first newline was missing so a block like: !! hooks source !! endhooks would turn into: !! hookssource !! endhooks Change-Id: I2a4c5e52050d55fb0c9b4f5d0494eb00e34b233c
* Parser test file editorTim Starling2016-10-281-0/+196
Add editTests.php, which provides an interactive interface to the parser tests, with semi-automated editing. Change-Id: I1a20d007ba4627d562a16c03849bbad7aec0e516