Closed (fixed)
Project:
Drupal core
Version:
8.8.x-dev
Component:
entity system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 Apr 2019 at 18:35 UTC
Updated:
19 Jun 2019 at 17:15 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mikelutzBaseline, triggering an error but not removing usages.
Comment #3
mikelutzFirst attempt at testbot fodder.
Comment #4
berdir$this->node->get('type')->entity->delete() should work too for this.
The whole thing is a bit weird though, was $this->node already deleted?
why sometimes $this->container and sometimes \Drupal::entityTypeManager(), I'd always use the second.
I'm not sure what this is testing, but that description is weird. We definitely don't delete vocabularies when you delete terms, what it is testing is that there are no other terms in that vocabulary, not sure what the point of that is though.
lets just @deprecate this function too?
Comment #6
mikelutz1) It wasn't but the purpose of the test is only to show that deleting a bundle deletes the comment field configs too, so I guess it doesn't care.
2) I've never found an answer to $this->container vs \Drupal::service in tests. #2066993: Use magic methods to sync container property to \Drupal::getContainer in functional tests is one of my favorite issues, as the IS says one thing, the issue title says another and the comments come to no final conclusion. Personally I use \Drupal::service in Functional and Javascript tests and $this->container in kernel tests for absolutely no justifiable reason, and even with that I missed the one you linked because I should have used \Drupal to be consistent with myself.
3) No clue. The part I removed seemed to be testing that entity_delete_multiple didn't throw an error if you passed it an invalid entity id, so I just removed that part. I changed the remaining test comment, but I'm not convinced that it tests anything other than if the term is deleted, then the term is deleted..
4) Opened #3051455: Deprecate user_delete and user_delete_multiple as a followup. At fast glance, user_view and user_view_multiple should probably be deprecated as well, and maybe a few more procedural wrappers in that file.
Comment #7
alexpottThere is a reason this is a logical approach. $this->container is maintained in kernel tests to be in-sync with the real container - there is a listener that keeps it updated. In Functional tests \Drupal is updated more often than $this->container (both however are not great - but \Drupal looks worse and therefore is preferable because it reminds us we're doing something we shouldn't :) )
Comment #8
mikelutzPer conversation with Berdir I'm closing #3051455: Deprecate user_delete and user_delete_multiple and rolling those deprecations into this patch.
Comment #9
jibranJust one tit bit.
Variable name is not correct and it can be one line
if($lang= ConfigurableLanguage::load('en'));.Comment #10
mikelutzI'm really not a fan of assignments inside of conditionals, but here you go.
Comment #11
jibranThanks!
Comment #12
larowlanCommitted c210fad and pushed to 8.8.x. Thanks!
Comment #15
voleger