Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
The \Drupal\Component\Diff
code has no PHPUnit test coverage (and only secondary tests from the config module).
Proposed resolution
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff.txt | 1.56 KB | dawehner |
#10 | 2472633-10.patch | 5.54 KB | dawehner |
#9 | interdiff.txt | 3.02 KB | Mile23 |
#9 | 2472633_9.patch | 5.41 KB | Mile23 |
#7 | interdiff.txt | 615 bytes | Mile23 |
Comments
Comment #1
jhedstromComment #2
jhedstromComment #3
jhedstromComment #4
jhedstromComment #5
Mile23Try this on.
CRAP scores:
DiffOp 132 -> 26
HWLDFWordAccumulator also 132 -> 26
DiffEngine 12,210 -> 4,318
I only tested public methods using no mocking. Some of the higher complexity public methods look like they might not be used by core.
Diff::check()
, in fact, says it's only for debugging purposes.Also verified that patch #76 in #2337283: Add a composer.json file to every component requires drupal/utility for this component.
Some of the higher CRAP score methods really need some refactoring. That's only possible if we test them. ::gulp::
Comment #7
Mile23Typo. Amazing how PHPUnit can find it but run-tests.sh can't. :-)
Comment #8
dawehnerLet's use string keys to explain the different testcases better
Note: The recommended way is now to not use the annotation but rather the setExpectedException method, sorry
Comment #9
Mile23#8.1: Not sure what you mean. Read the test to see what it does.
#8.2: Doesn't make any sense, but OK.
Comment #10
dawehnerThis is entirely not the point. The point is having a MUCh easier time to quickly scan it, for example when you have a test failure.
PhpUnit is showing those keys additional.
Comment #11
Mile23OK, gotcha. +1
Now who will RTBC since you patched it? :-)
Comment #12
dawehnerCome on, I just changed array keys :)
Comment #13
catchCommitted/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!