Task to convert tests for \Drupal\Component\Transliteration to phpunit, and also expand test coverage.
Since part of the existing tests test the core override \Drupal\Core\Transliteration\PhpTransliteration, those parts will need to be left as simpletests.
| Comment | File | Size | Author |
|---|---|---|---|
| #57 | 2051467-57.patch | 15.69 KB | amateescu |
| #55 | 2051467_55.patch | 18.99 KB | mile23 |
| #53 | interdiff.txt | 840 bytes | amateescu |
| #53 | 2051467-53.patch | 15.7 KB | amateescu |
| #51 | 2051467-51.patch | 14.88 KB | amateescu |
Comments
Comment #1
jhedstromThis converts the unit-testable parts over to phpunit. I couldn't quite figure out how to expand coverage to the invalid byte-sequence parts of
PhpTransliteration.Comment #3
jhedstromFixes the strict warnings by just calling
Random::string(), adds an additional test that gets coverage to 100%.Comment #4
ParisLiakos commentedso when $case is ever set here?
Comment #5
ParisLiakos commentedComment #6
jhedstromThe code referenced in #4 was left-over from the old simpletest test. This and other old code has been removed, plus I added an additonal test to check the new max length parameter. 100% coverage.
Comment #8
jhedstromHmm, fails due to the changes from #2032453: WebTestBase::randomString returning a string containing a $ followed by a number causes assertLink() to fail.
Comment #9
dawehnerLet's remove the need for a transliteration_test module.
Yeah, this removes a webtest!
I do agree that the interdiff is more confusing as helpful.
Comment #11
dawehnerThere we go.
Comment #12
jhedstromComment #13
ParisLiakos commentedYay for getting rid a test module:D
Drupal needs a backslash in front here.. \Drupal\..
PHP should be only uppercase first ie: testPhpTransliteration
Comment #14
ParisLiakos commentedComment #15
jhedstromDoes that mean this patch should fix the class being tested and change it from
PHPTransliterationtoPhpTransliteration?Comment #16
ParisLiakos commentedwell we should at least name correctly the newly introduced code here..fixing existing code could happen in other issue, unless it is blocking us here, which i doubt?
Comment #17
jhedstromThat makes sense. This patch also adds the appropriate groups to the test class.
Comment #18
ParisLiakos commentedthanks
wrong patch though? #11 is double size
Comment #19
jhedstromOh, indeed it is the wrong patch.
Comment #20
jhedstromThis should be the correct one.
Comment #21
ParisLiakos commentedit just occured to me that the optional argument should be last, right?
hmm also what about those? why commented?
Comment #22
dawehnerThe points of paris got adressed.
Comment #23
webchickEr. They did? How?
Comment #24
dawehnerOh that is embarrassing.
Comment #25
jhedstromThe commented out tests were dependent on the test module removed in #9. We could re-order the constructor arguments.
Comment #26
ParisLiakos commentedNeeds reroll and fixing #21
Comment #27
berdirThose cases were already moved to the other test class, so let's just remove them here :)
Comment #28
ParisLiakos commentedThanks, looks good..just a small nit, in case this needs to be rerolled
does not need to be static
Comment #30
berdirConflicted in the removed info file, removed the static, good point.
Comment #31
ParisLiakos commentedthanks!
Comment #33
ParisLiakos commentedDrupal\system\Tests\Cache\ApcuBackendUnitTest random failure
30: transliteration-phpunit-2051467-30.patch queued for re-testing.
Comment #35
ParisLiakos commented30: transliteration-phpunit-2051467-30.patch queued for re-testing.
Comment #37
ParisLiakos commented30: transliteration-phpunit-2051467-30.patch queued for re-testing.
Comment #39
ParisLiakos commented30: transliteration-phpunit-2051467-30.patch queued for re-testing.
Comment #40
ParisLiakos commentedfinally
Comment #41
xjmThis sadly had a merge conflict when I tried to reroll it for #2247991: [May 27] Move all module code from …/lib/Drupal/… to …/src/… for PSR-4 so it will need a closer look.
Comment #42
sunRemoving the 'phpunit' tag — let's stop to tag every issue that just happens to add or touch phpunit tests, because that makes no sense; we're not adding a tag to all issues that happen to add or touch simpletest tests either. ;)
That's an edge-case of required/optional argument ordering, but due to the parent class constructor, I agree that the order is sensible here.
Normally,
$expectedshould be taken first (especially in this case), but upon looking further, I just realized that you're trying to keep this conversion patch as small as possible.s/@group Drupal/@group Transliteration/g
Comment #43
dawehnerIt used to be a perfect tool to push the usage of phpunit by getting more reviews on those issues.
Let's use @coversClass
We can drop those now.
it looks so wrong to use Uppercase methods.
Comment #44
herom commentedreroll, and fix #42.3 and #43.
Comment #46
herom commentedbad merge.
Comment #47
mile23Patch doesn't apply.
Comment #48
alansaviolobo commentedpatch seems to apply. re running tests.
Comment #51
amateescu commentedRerolled and reviewed locally, looks good to go if the testbot agrees.
Comment #53
amateescu commentedLooks like an easy fix.
Comment #54
daffie commentedComment #55
mile23Needed some re-roll love.
When this comes back green, I'll mark this as postponed due to the class rename issue above #2388169: Rename PHPTransliteration to PhpTransliteration. It will just need a re-roll and not much else.
Comment #56
mile23Comment #57
amateescu commentedRerolled the patch, still looks good.
Comment #58
alexpottThis changes 99% test code and inject the module handler in PhpTransliteration so is not disruptive. Committed c8c1ae1 and pushed to 8.0.x. Thanks!