Problem/Motivation
I would like to refactor the UserData class cos currently the get method looks like something the cat dragged in. Compare to the tidy MongoDB version which can be applied to the SQL version as well just the query is different, the result rows are not. But there are no tests. Woe.
Proposed resolution
Add tests.
Remaining tasks
Add tests.
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | add-tests-2373573-11.diff | 2.8 KB | avpaderno |
| #7 | interdiff-2373573-1-7.txt | 591 bytes | yogeshmpawar |
| #7 | userdata_needs_testing-2373573-7.patch | 2.74 KB | yogeshmpawar |
| #1 | 2373573-user-data-test-1.patch | 2.8 KB | vijaycs85 |
Comments
Comment #1
vijaycs85Here is the incomplete test blocked by #2373613: FakeStatement doesn't behaves as same as Statement
Comment #2
chx commentedComment #6
avpaderno@fileis not required anymore for those files.It is testing the user.data service, not the user entity class.
Comment #7
yogeshmpawarChanges done as per comment # & also added an interdiff.
Comment #9
avpadernoThe failure doesn't show any error in the patch, but rather a problem with the testing system. I am going to force a re-test.
Comment #10
avpadernoPHP_CodeSniffer is suggesting to replace
array()with[]; there are few places where that is needed, in the patch.This is the patch against the patch it reports.
I apologize for changing the status twice. I first didn't notice the file attached to the automatic comment.
Comment #11
avpadernoI also added the comma after the last array item, as per Drupal coding standards, the section about arrays.
Comment #13
avpadernoI take the error is saying that core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php doesn't exist anymore.
Comment #18
avpadernoComment #27
bradjones1Not sure this helps at all but in the course of creating an example implementation for #3343634: Add "json" as core data type to Schema and Database API, I added some test coverage for user data to ensure I was hitting (most) of this implementation. The polymorphism is strong, especially in the delete() method, but it might be something to help move this along.
https://git.drupalcode.org/project/drupal/-/blob/168d5353dcb8fc2b8decfe6...
https://git.drupalcode.org/project/drupal/-/blob/168d5353dcb8fc2b8decfe6...