Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
rest.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Aug 2013 at 12:29 UTC
Updated:
29 Jul 2014 at 22:46 UTC
Jump to comment: Most recent file
Comments
Comment #1
idflood commentedAfter looking at some code I'm still not sure where the problem is but it may be more related to the rest module than views.
edit: It seems to be related to the requirements defined in rest/lib/Drupal/rest/Plugin/views/display/RestExport.php->collectRoutes.
Comment #2
idflood commentedHere is a first patch. Not sure if this really works but at least it doesn't give the error on forms.
Comment #3
idflood commentedComment #4
klausiInteresting, this totally makes sense, thanks for catching this. Of course we should not modify all routes, but only our own.
Patch looks good, but this needs a test case. I think we can just unit-test collectRoutes() and check that it only modifies its own routes that are passed in a collection.
Comment #5
idflood commentedI've started to work on a test. But it is not really executed, any idea why ? (0 pass, 0 fail, ... no test result to display)
edit: there was a little syntax error but even with it corrected it doesn't execute the test. (I was using [] instead of array() )
Comment #7
idflood commentedSame patch as #5 but with the typo corrected. The patch is still not really executed (no test result to display).
Comment #8
klausiShould be "... for the collectRoutes() method."
Scope modifier missing, I think it is protected.
All class properties should be defined explicitly.
And shouldn't you test the requirements of one valid route that belongs to the plugin and should be modified?
Comment #9
idflood commentedThanks for the review, I've updated the test.
I haven't fixed this since I have no idea of how it can be done.
I changed the test location and took example on the views module for the test on the advice of berdir. The test still doesn't work, but when executed from the command line it gives an interesting error.
The command: cd core; ./vendor/bin/phpunit --filter=CollectRoutesTest
Comment #11
larowlankicked this along some more, but stuck on
Comment #12
larowlanSorry, that was the interdiff.
Full test and interdiff
Comment #13
larowlanthis is at least major, if not critical
Comment #14
larowlanview != views - fixed
So we should have red/green here.
Comment #15
larowlanGiven that once any view of this type is added, any non GET request returns a Method Not Allowed
Comment #16
tim.plunkettThis makes a lot more sense when you view the patch without whitespace changes:
Running the test without the fix, it has 1 error:
Looks good to me, nice work.
Comment #17
catchLooks good to me. Committed/pushed to 8.x, thanks!