Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Tests?

webchick’s picture

Issue tags: +Needs tests
chx’s picture

Status: Needs work » Reviewed & tested by the community

Forget it, thanks! :) You want me to write put another storage engine into core to test this?

Edit: obviously now I have another storage engine which made me find this bug and believe me, I would be happy to add the mongodb storage engine into core just to test this ;) but I somewhat think that might meet a little resistance here and there.

yched’s picture

Not sure if that's relevant, but we do have a test storage engine in core : modules/field/tests/field_test.module / field_test.storage.inc

chx’s picture

Then just bury this patch as so many was buried before and make the subsystem unusable. I don't care. I won't write a 100 LoC patch just to write the storage query for that storage. It's not impossible it's just an incredible lot of work for nothing. It's hard to describe the frustration one feels when a trivial oneliner can't get in because "it needs tests"! Noone wanted tests for this feature when the original went in, why the fuss now?

jhodgdon’s picture

This fix doesn't look like it requires a test. It's a simple matter of making the code correctly call $function = $this->executeCallback;
to make sure that the executeCallback function is what is executed, rather than the literal member function executeCallback(). This is a no brainer. +1 on RTBC.

Damien Tournoud’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
4.61 KB

I actually agree that this needs test.

Here.

chx’s picture

Status: Needs review » Needs work

Sure. But then please add inline comment for if (function_exists($this->executeCallback)) in the new method and I think return $storage . '_field_storage_query'; needs a coment too. Also if you are hell bent on testing this you need a module which alters the query setting executeCallback

Damien Tournoud’s picture

Status: Needs work » Needs review
FileSize
6.72 KB

Same patch with more comments, and a test for executeCallback in hook_entity_query_alter().

Damien Tournoud’s picture

FileSize
6.8 KB

Even more inline comments (from chx).

chx’s picture

Status: Needs review » Reviewed & tested by the community

That's nice :) (and it adds 94 LoC. I was not that far off by saying this takes 100 LoC. Thanks Damien.)

webchick’s picture

Priority: Critical » Normal
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs documentation, +API change

Yes, and 20 of those lines are further improvements based on things found by writing tests. ;)

Thanks, great work! Committed to HEAD!

This looks like it changes APIs. Could someone please write a couple lines that summarize the changes for modules implementing field queries?

webchick’s picture

Issue tags: -Needs tests
jhodgdon’s picture

Status: Needs work » Fixed

Actually, I don't think it changes APIs. It just makes it so that the execute() method actually does what was intended (and previously documented) for executeCallback() instead of having a broken executeCallback().

Tentatively marking back to Fixed, but feel free to set back to CNW if I'm wrong about that.

Damien Tournoud’s picture

Agreed, there is no API change here.

webchick’s picture

Cool. Sorry, my mistake.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.