Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
node system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Jul 2014 at 13:08 UTC
Updated:
27 Jan 2017 at 17:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
alexpottComment #2
mitsuroseba commentedComment #3
anavarreTrying to understand what's the scope for this issue: should the test live in a new function or would adding it in the
testNodeCreation()function be acceptable?Also, I did try to add the below test (temporarily) in the
testNodeCreation()function but then it throws a Simpletest failure as a 403 is returned while a 200 is expected:I've noticed that the only way to fix it is to add the 'administer content types' permission to the user object.
P.S.: I did try that with and without Cottser's patch in #2073811: Add a url generator twig extension
Comment #4
alexpottA full test of the node/add functionality would include testing for users with and without
'administer content types'. For users with the'administer content types'permission we should be using WebTest's click link functionality to test that the expected link is there.Comment #5
alexpottCottser's patch in #2073811: Add a url generator twig extension is fine and works it's @dawehner's patch that exposed the missing test coverage.
Comment #6
mitsuroseba commentedComment #7
alexpottNice work - a few minor things to keep the test as simple and reliable as possible.
Lets call this
testNodeAddWithoutContentTypessince you're not creating a node.I would assert that the current user can get to node/add before deleting the content types - in it's current state this seems a bit brittle.
You only really need to do this is you are expecting the url to be different as is the case in testNodeCreation
We don't need to actually go to the node type add page - this is tested elsewhere.
Comment #8
mitsuroseba commentedThank you for review. Here a new patch.
Comment #9
mitsuroseba commentedComment #10
alexpottNearly perfect! Just a couple of very very minor nitpicks.
Actually there is no need to assert the 200 here if you are going to assert the link. And the assertLinkByHref's second argument is not needed. The default is 0.
Comment #11
mitsuroseba commentedComment #12
alexpottGreat! Thank you.
Comment #13
dawehnerCan we have a assertNoLinkByHref in case we do have node types?
Comment #14
alexpottGood point @dawehner
Comment #15
mitsuroseba commentedComment #16
alexpottThanks!
Comment #17
dawehnerperfect
Comment #19
catchCommitted/pushed to 8.0.x, thanks!
Could probably be backported.
Comment #21
pbull commentedHere's a D7 backport that adds this test to NodeCreationTestCase.
Comment #23
pbull commentedTrying again... previous D7 patch passes locally but this adds node and menu rebuilds.
Comment #25
m1r1k commentedComment #27
mitsuroseba commentedRetest