Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
file.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Dec 2018 at 04:19 UTC
Updated:
28 Feb 2019 at 12:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kim.pepperDeprecates methods and add a change notice.
Comment #3
kim.pepperAvoid using the deprecated entity_delete_multiple() function.
Comment #4
berdir> Avoid using the deprecated entity_delete_multiple() function.
I don't think it's necessary to not skip deprecated calls in function that are themself deprecated, but this is also fine.
Looks good.
Comment #5
andypostProbably it needs
FileLegacyTestto test that deprecated functions still works and trigger expected deprecation messagesComment #6
kim.pepperFileLegacyTest extends \Drupal\Tests\field\Kernel\FieldKernelTestBase so it seems a bit weird to be putting this stuff there.
If #2244513: Move the unmanaged file APIs to the file_system service (file.inc) gets in before this, we can use Drupal\Tests\Core\File\FileSystemDeprecationTest or we can move all deprecation tests in that issue to \Drupal\Tests\file\Kernel\FileLegacyTest?
Comment #7
andypostI think
Drupal\Tests\Core\File\FileSystemDeprecationTestis good one, so it could be introduced here and extended in subissues of main conversionComment #8
kim.pepperAdded FileSystemDeprecationTest as per #7
Comment #9
berdir> FileLegacyTest extends \Drupal\Tests\field\Kernel\FieldKernelTestBase so it seems a bit weird to be putting this stuff there.
I don't think there is a reason for that.
It's a very new test that I copied from \Drupal\Tests\file\Kernel\FileItemTest and didn't update the parent. You can likely just change that, or we can change that elsewhere.
It IMHO makes much more sense there because that's about file entity legacy things. those file functions should never have been in file.inc anyway, they have nothing to do with the FileSystem service.
Comment #10
mile23Drupal\Tests\Core\File\FileSystemDeprecationTestalready exists as of #3021458: Properly deprecate drupal_move_uploaded_file() but it's in the wrong place since it's a kernel test.Please move it to a kernel-flavored namespace and update it there...
Comment #11
mile23Re-rolled and moved the test.
Comment #13
berdirFileSystemDeprecationTest is Drupal\Tests\Core, the functions we are deprecating are in file.module, I still think FileLegacyTest is the best place for this, we just have to fix the parent.
Comment #14
mile23Re: #13: Yes indeedy the deprecation favors the file module, and uses its file entity storage to perform deletions. So these tests are moved there.
That leaves the misplaced
Drupal\Tests\Core\File\FileSystemDeprecationTestwhich is still annoying but can't be piggy-backed onto this issue. Sigh. :-)This patch reverts
FileSystemDeprecationTestand moves the tests from #8 toDrupal\Tests\file\Kernel\FileLegacyTest. Also a minor doc fix.And the follow-up: #3030359: FileSystemDeprecationTest in the wrong place since it's a kernel test
Comment #15
berdirLooks good, #3028657: Properly deprecate entity_load_multiple() kind of set a standard to deprecate all *_x_multiple() functions at once, not sure if we should do that here as well. many don't exist anymore already, user_delete() (+ multiple) still exists, and quite a few calls to entity_delete_multiple(), so maybe better to them separately.
Setting to RTBC to get feedback on that.
Also removing a bunch of tags as this is not actually about include files.
Comment #16
berdirOh, but they they actually are in there, just realized again why I specifically suggested to create this issue. That's messed up :)
Comment #18
mile23Rerolled after #3028657: Properly deprecate entity_load_multiple() and #3030359: FileSystemDeprecationTest in the wrong place since it's a kernel test
Re: #15: If you test all of the deprecated functions at once, then you have to expect multiple deprecations at the same time. It's almost a style thing in these cases, but it's better to have the deprecations isolated per test method.
Comment #19
berdirMisunderstanding I think, what I meant is that the other issue deprecated entity_load_multiple(), user_load_multiple(), node_load_multiple() in a single issue, each with its own dedicated legacy/deprecation test. That's what I was wondering, if we should expand this for the other delete functions too.
That said, we we should probably do something similar to \Drupal\Tests\file\Kernel\FileLegacyTest::testEntityLegacyCode() and create an actual file entity that we then delete, e.g. your test would pass if it would not actually pass the correct arguments to $storage->delete()?
Comment #20
mile23I see what you mean... There doesn't seem to be any other test of whether these functions actually do the work they say they'll do.
Comment #21
berdirYeah, also #2723593: Properly deprecate entity_load() and friends extends the existing test methods for many entity types, so wondering if this should follow that pattern, then you already have the test entity that you then can delete again.
Comment #22
berdirThat issue is in, which likely means this conflicts again on changes there, so I'd suggest to add these two function tests also in there.
Comment #23
mile23Reroll.
Comment #24
kim.pepperWhy not call this variable 'storage'? Makes it clearer to me.
Comment #25
berdiryes, that's definitely wrong, it was also not merged into the existing entity legacy test method, which I think would make sense with the generic name. it has multiple @expectedDeprecation now already.
Comment #26
mile23Addresses #21 and #24.
Comment #27
berdirWorks for me :)
Comment #28
catchCommitted 8d0bc44 and pushed to 8.7.x. Thanks!