Updated: Comment #N
Problem/Motivation
Drupal\Component\PhpStorage\PhpStorageFactory currently lives in the Component namespace, which is basically ridiculous. It's pretty Drupal specific - It requires DRUPAL_ROOT, PublicStream, Settings, and drupal_get_hash_salt(). All of which live (or soon will live) in core.
Proposed resolution
It has to move. So lets move it into Core.
Remaining tasks
Move class, untangle tests.
User interface changes
None
API changes
None. Unless you are extending the PhpStorageFactory, which is very unlikely indeed.
Comments
Comment #1
damiankloip commentedWorking on this.
Comment #2
damiankloip commentedI need to do a bit more work for the new PhpStorageFactory test, which I will do later on.
This is most of the patch though. I have refactored the tests that are in component to NOT use the factory class anymore. This didn't make too much sense for a unit test anyway. They should just be creating instances of the file classes directly and testing those. Which they now do. It looks much tidier tbh.
So basically:
- A new PhpStorageFactoryTest that extends DrupalUnitTestBase (IMO there is no point trying to hack and fight the dependencies on Drupal there).
- All existing file storage tests stay as PHPUnit tests.
Comment #3
damiankloip commentedComment #5
damiankloip commentedShould be an easy fix there.
Comment #7
damiankloip commented5: 2210631-5.patch queued for re-testing.
Hopefully that is the last time!! (#2174997: Random fail in ImageFieldDisplayTest)
Comment #8
damiankloip commentedHow about this? We can test it a bit better using a mock class for the php storage (in most cases). IMO this is better than trying to make a PHPUnit test containing lots of hacks for functions and constants etc..?
Comment #9
damiankloip commentedRerolled.
Comment #10
dawehnerAwesome, thank you for the reroll.
Comment #12
damiankloip commented9: 2210631-9.patch queued for re-testing.
Comment #13
dawehnerback.
Comment #15
damiankloip commented9: 2210631-9.patch queued for re-testing.
Comment #16
damiankloip commentedComment #17
catchNo longer applies.
Also I marked #2033193: Move PhpStorageFactory to Core as duplicate.
Comment #18
damiankloip commentedPure git reroll. Thanks for closing that other issue, sorry I didn't see it before.
Comment #19
damiankloip commentedComment #20
alexpott2210631-18.patch no longer applies.
Comment #21
damiankloip commentedRerolling...
Comment #22
damiankloip commentedComment #23
damiankloip commentedComment #24
damiankloip commented22: 2210631-22.patch queued for re-testing.
Comment #25
damiankloip commentedBack
Comment #26
alexpott2210631-22.patch no longer applies.
Comment #27
damiankloip commentedAnd once more. Just context resolution.
Comment #28
alexpottCommitted 2aefd89 and pushed to 8.x. Thanks!
Comment #30
alexpott2210631-27.patch no longer applies.
Comment #31
alexpottHuh... this is fixed
Comment #32
jhedstromThis patch missed one occurrence of
php/simpletest. Presumably this still passes on the bot since that directory exists. Locally it fails since that directory is never created (unless running simpletest).Comment #33
MixologicPhpunit was failing on HEAD on my local machine without this patch. Patch applies, and all tests now pass.
Comment #34
damiankloip commentedGood catch! +1
Comment #35
alexpottCommitted 2cc71a6 and pushed to 8.x. Thanks!