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.

Comments

damien tournoud’s picture

Status: Active » Needs review
StatusFileSize
new10.71 KB

Here is a first version, should not break anything, but I need to extend the tests.

damien tournoud’s picture

StatusFileSize
new11.08 KB

Ok, maybe it broke a few things ;)

damien tournoud’s picture

#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.

Status: Needs review » Needs work

The last submitted patch failed testing.

boombatower’s picture

+1

damien tournoud’s picture

Status: Needs work » Needs review
StatusFileSize
new11.92 KB

Fixing the test. Still needs some extended tests.

boombatower’s picture

I 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.

damien tournoud’s picture

StatusFileSize
new12.22 KB

And the correct patch ;)

damien tournoud’s picture

StatusFileSize
new12.22 KB

Retry (test bot is having difficulties).

boombatower’s picture

what's wrong with bot?

EDIT: drupal.org went down temporarily which screwed up bot transfer of data.

Status: Needs review » Needs work

The last submitted patch failed testing.

damien tournoud’s picture

Status: Needs work » Needs review
damien tournoud’s picture

StatusFileSize
new12.22 KB

Let's retry.

Status: Needs review » Needs work

The last submitted patch failed testing.

pasqualle’s picture

-1
Do not use docblock for application logic

Crell’s picture

I 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.)

webchick’s picture

Version: 7.x-dev » 8.x-dev
sun’s picture

Status: Needs work » Closed (won't fix)