The following patch extends the registry to record class hierarchy, interfaces implementation and to parse docblocks of each resource.
Why is this useful?
- It allows us to kill DrupalWebTestCase::getInfo() methods and replace them with docblock attributes (I already have a patch for that)
- As a consequence of that refactoring, it will allow us to create a completely clean test environment
- It allows us to replace the two new registries introduced by the handlers patch, and replace them by docblock attributes
Again, why?
Because we already have a registry, we don't need several of them. hook_slot_info, hook_handler_info, and the loading of all classes to execute ->getInfo() in simpletest are all use cases of an extended classes, interfaces and functions registry.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 393068-extend-registry-parsing.patch | 12.22 KB | damien tournoud |
| #9 | 393068-extend-registry-parsing.patch | 12.22 KB | damien tournoud |
| #8 | 393068-extend-registry-parsing.patch | 12.22 KB | damien tournoud |
| #6 | 393068-extend-registry-parsing.patch | 11.92 KB | damien tournoud |
| #2 | 393068-extend-registry-parsing.patch | 11.08 KB | damien tournoud |
Comments
Comment #1
damien tournoud commentedHere is a first version, should not break anything, but I need to extend the tests.
Comment #2
damien tournoud commentedOk, maybe it broke a few things ;)
Comment #3
damien tournoud commented#376129: Change getInfo() to a static method is building upon this patch to remove DrupalWebTestCase::getInfo(), and to avoid the need to load and instantiate all test classes before even starting running a test.
Comment #5
boombatower commented+1
Comment #6
damien tournoud commentedFixing the test. Still needs some extended tests.
Comment #7
boombatower commentedI plan to discuss this with webchick this afternoon so if you get something working on this and the hook_test() issue then that would be great to focus on getting it in.
Comment #8
damien tournoud commentedAnd the correct patch ;)
Comment #9
damien tournoud commentedRetry (test bot is having difficulties).
Comment #10
boombatower commentedwhat's wrong with bot?
EDIT: drupal.org went down temporarily which screwed up bot transfer of data.
Comment #12
damien tournoud commentedComment #13
damien tournoud commentedLet's retry.
Comment #15
pasqualle-1
Do not use docblock for application logic
Comment #16
Crell commentedI am OK with storing hierarchy information, if we can show it's a performance boost. I can see that potentially if we make our autoload callback smarter so that it can load any necessary parent classes in one shot rather than having an autoload trigger for each parent class. That could also end up increasing the cost in DB load, though. Needs benchmarks.
I do NOT, however, support making the registry dependent on @annotations. I am still not convinced that they are even a good idea in general in PHP (I know they're becoming more popular in Java, but PHP is not Java); I certainly do not want to make us dependent on them. They're also less flexible than a separate registry hook. (The next round of the handlers patch, coming as soon as I have time to work on it, includes a structural change that would make using @annotations instead of a hook impossible as they're tightly coupled to the code in question.)
Comment #17
webchickComment #18
sunObsolete due to #1541674: Remove the registry