Closed (fixed)
Project:
Web Links
Version:
7.x-1.x-dev
Component:
Contrib: Embed
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Sep 2015 at 16:41 UTC
Updated:
7 Nov 2015 at 08:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jonathan1055 commentedComment #3
gstegemann commentedThanks for discovering this. I really didn't know about the changes in hook_filter_info.
Comment #4
jonathan1055 commentedI'd like to get some automated tests running for the Embed sub-module. The attached patch simply adds the .test file and runs some intial set-up in the testcase, it does not actually check anything of substance in the module yet. It's better to check that tests are running first, then I will commit this, and then work on the actual test cases. I seem to recall that the new tests do not actually run when the patch to be tested includes the .info change which adds the .test file, but we'll see.
Comment #6
jonathan1055 commentedI forgot that in D.O. automated testing some of the PHP functionality differs from my local environment.
Comment #7
jonathan1055 commentedHas to be 'needs review' to get the test run
Comment #9
jonathan1055 commentedI left in a dd() call.
Comment #10
gstegemann commentedI tested your patch and ran a local test which passed.
However, the patch could not be applied to file 'weblinks_embed.info' and a reject file was created:
So I had to apply the changes manually.
Comment #11
jonathan1055 commentedYes, patching the .info file can fail if you are using a dev release (which has the datestamp and release information added in the file) and the patch was created in a git environment where the date and release details do not exist in the file.
The .test file needs much more work, but this is a good start to get the tests running. Thanks.
Comment #13
jonathan1055 commentedI've worked on the embed code and the tests. Here is a patch with just the updated tests - and this should fail in several places, showing that the embed functionality is not currently working. Later, I will upload a patch which has the tests and the corrected code.
Comment #15
gstegemann commentedI've applied the patch and a test run produced similar results as the run on d.o. did.
Comment #17
jonathan1055 commentedThanks. I'm going to add another loop to show an empty group.
Also I've realised that the unpublished group fails badly for users who do not have the authority to view unpublished content. I may add a test for that too, but I've committed what you have checked so far, so that it is easy to see the subsequent new bits.
Comment #18
jonathan1055 commentedAs promised here is patch with more indepth tests. This should fail in lots of places as it is just the tests.
Comment #19
gstegemann commentedI have applied the patch and executed the Web Links Embed tests. The reported the following results
161 passes, 29 fails, 114 exceptions, and 69 debug messagesI cannot check it that matches your results since the tests on d.o. didn't run yet. Second I have seen several PHP notices like "Undefined property", "Undefined offset", "Trying to get property of non-object" and "Invalid argument supplied for foreach()".
Comment #20
jonathan1055 commentedYes, there seems to be a hold-up on processing test, see https://qa.drupal.org/pifr/status
Thanks for testing the patch. Those errors are all to be expected, as the Embed functionality is not fully working in the existing code. Here's a patch which include the tests, plus fixes to weblinks_embed.module and a one-line corrections to weblinks.module to allow the text 'unpublished' as a weblinks-embed id (which is attempted in the existing embed process). Other features which I have fixed/improved are:
The patch has some debug in, which you can turn on if you have the devel module. I will remove this before committing anything.
Comment #21
gstegemann commentedI have tested the current patch and it works as described by you.
Just one question:
I.e. when the user has not the "Administer Web Links" permission, right?
Comment #22
jonathan1055 commentedThanks for testing.
That's a good questions regarding the permission. I had assumed that if the user had one of the core permissions 'Bypass content access control' or 'Administer content' then they would be able to (quite correctly) view the unpublished Web Links content. But it seems they cannot, I've just tested it. That may be worth looking at as a separate issue, not here. So yes, at the moment it is the same as not having 'Administer Web Links' permission. The main thing I wanted to avoid was the php errors which were created when trying to get the properties of an obejct which had not been created because the anonymous user could not see the weblinks.
Comment #23
gstegemann commentedYes.
I think that is OK for the moment.
Comment #27
jonathan1055 commentedHa! The test have suddenly awoken and fail because I've just done the commit.
Thanks for reviewing and testing. I remembered to remove all the debug before committing.
I discovered that setting the cache value to TRUE causes the automated tests to fail with
"Maximum function nesting level of '256' reached, aborting! in /includes/entity.inc on line 1270"so I put a note in the code and left it at FALSE.Comment #28
jonathan1055 commented