Closed (fixed)
Project:
Drupal core
Version:
8.2.x-dev
Component:
simpletest.module
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Mar 2016 at 18:30 UTC
Updated:
10 Jun 2016 at 00:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
berdirNote, I'd recommend to consider moving any where we do not actually test system *module* stuff but components to move out of the module and into core/tests/....
I've done the same with the config component tests that are currently in the config module.
Comment #3
jhedstromI'd already done what's here by the time I saw Berdir's comment, so next patch will move these out of the system module.
I started at the end of the list working backward. I had to skip
Theme/StableLibraryOverrideTestbecause it callsenableModules()fromsetUp, which is deprecated, and I need to figure out the right way to do this w/o hard-coding the entire module list of core into the$modulesvariable.Comment #4
jhedstromWanted to get more time, but only managed to move some of the already-converted tests to the
core/testsdirectory/namespace. Will try to get more done tomorrow. There is somewhat of a gray area on what should go in system module. I chose as a general rule to leave anything that enables the system module itself in the test.Comment #5
jhedstromA few more moved/converted.
Comment #6
jhedstromA few more.
Comment #8
jhedstromA few more. Odd failure above as that test wasn't touched by the patch...
Comment #9
jhedstromAh, the fail was related since it was looking for one of the files that moved.
Comment #12
jhedstromThis should fix the fail.
Comment #13
jhedstromThis has one failure I can't quite figure out in the
ExternalFormUrlTest.Comment #15
dawehnerYeah that one is super weird.
Comment #16
jhedstromThis does all the file tests.
There are 4 or so failures. The mkdir permission failure is due to this in
DirectoryTest:The
drupal_realpath()is failing for vfs (it returns something like/RANDOM/RANDOM.The other failure from
StreamWrapperTestI am not sure what to do about:Comment #18
berdirMaybe we can make public:// work, see #31 in #2684141: Convert migrate kernel tests to KernelTestBaseTNG, not sure if the same applies here, though.
I think most of those tests are about testing FileSystem, which is in the core namespace or functions in include files.
IMHO, those would be OK to move as well. entity tests for example also rely on system (and test modules in system.module).
the new assertTrue() only has two arguments, the group concept is gone. Not sure if we want to address that here since it doesn't really hurt and I fear that there are a lot of calls like that. Back then, we used that group thing quite a lot.
In fact, we even still have asserts with t() calls in here.
Hm, we might have done that deliberately before setUp(), not sure.
Why only move some of those classes?
Note that this one overrides containerBuild(), which is now called just register(). Not sure why it's not failing, maybe it's not required and we can drop it? Or we might not actually be testing what we think we are, since it defaults to memory?
lets drop that bogus todo while we touch that line.
looks like the typical automatic phpstorm changes, which seem unrelated and just make the patch bigger.
Comment #19
jhedstromMy reasoning was previously that if the test failed w/o the system module being enabled, I left it in the system module's namespace. If it's okay to lightly rely on some of the basics of the system module and still be moved to the core namespace, then more of these can be moved over.
Comment #20
dawehnerLet's see whether this fixes all of the failures ...
In general I think the tests which should be kept in system should be just the ones which test functionality shipped by system module directly, like a custom controller or service. All the other ones belong totally
Comment #22
dawehnerComment #24
dawehnerThere we go.
Comment #25
dawehnerComment #26
klausiunrelated change? all changes in this file are not needed? coding standards: catch must be oin a new line.
Otherwise looks good.
Comment #27
dawehnerThanks for the review klausi!
Comment #29
dawehnerNo comment
Comment #30
dawehnerHere are two files I forgot to move.
Comment #31
klausi#2665992: @file is not required for classes, interfaces and traits was committed and breaks this like hell.
Comment #32
berdirIt does. But git is awesome, try "git merge -X theirs 8.1.x". Worked fine for me in #2456477: Convert deprecated \Drupal\simpletest\KernelTestBase tests to KernelTestBaseNG.
Can do it, but not sure how much @dawehner already did on this since the last patch.
Comment #33
berdirThat was a bit too optimistic, you still have to fix the namespace declarations then.
Comment #34
dawehnerThis was not at all a painful.
You actually run git merge -X ours and then run the fixer again.
Comment #36
berdirFound one remaining one: \Drupal\system\Tests\Cache\CacheContextOptimizationTest.
\Drupal\system\Tests\Cache\GenericCacheBackendUnitTestBase should get a @deprecated note.
I also found a left-over in views and some that weren't properly updated, will take care of that in #2456477: Convert deprecated \Drupal\simpletest\KernelTestBase tests to KernelTestBaseNG.
Comment #37
dawehnerThank you berdir!
Comment #39
dawehnerFound an issue: #2712419: ModuleInstaller::install() doesn't order the installed modules ... here are some additional bugfixes
Comment #41
dawehnerComment #43
dawehnerTalked with alex, and we discussed to split off the problematic patches.
Comment #44
klausiComment does not match the new function name register().
Otherwise looks good to me.
Comment #45
dawehnerThank you klausi!
Comment #46
jibranLet's get this in.
Comment #47
catchWhy is the cast necessary when it's not for the strpos/strrpos calls above? If it really is necessary needs a comment.
Comment #48
catchComment #49
dawehnerWell, I understand it kinda, but not completely.
\Drupal\Component\Utility\Unicode::substrbreaks completely without mb disabled when you pass in aMarkupobject, see$c = ord($text[$bytes]);Comment #51
dawehnerJust a random test failure ...
Comment #52
alexpottHaven't reviewed yet but just so it is not forgotten there is one thing to fix on commit...
Comment #53
jibranFixed #52.
Comment #55
dawehnerThank you jibran!
Comment #56
catch#49 OK but why not cast before the strpos() calls. The added comment helps but it doesn't explain why it's necessary here and not later.
This is what I meant.
Comment #57
dawehnerTotally works for me. Thank you!
Comment #58
dawehnerAdded a couple of followups: #2731253: Call \Drupal\Component\Utility\Unicode::check in kernel tests #2731253: Call \Drupal\Component\Utility\Unicode::check in kernel tests
Comment #59
catchMy change was tiny so I don't think it disqualifies me from committing this to 8.2.x - done that now.
Comment #61
jibranIs it time to remove
\Drupal\simpletest\KernelTestBasenow?Comment #62
klausiNo, there are still other base classes using it, that we need to convert, for example PluginBaseTest in Views.
Comment #63
berdirAll of those are unused base classes that we kept on purpose until we remove Drupal\simpletest\KernelTestBase. And the old KernelTestBase test class. So yes, we can open an issue to remove it now.
Comment #64
klausiAh cool, PluginBaseTest in Views is not deprecated, that's why I thought it is still used. Let's also @deprecate all of those unused base classes then.
Comment #65
klausioh, PluginBaseTest is not even a test base class, it is still just an old kernel test. So no, we cannot remove Drupal\simpletest\KernelTestBase because not all kernel tests have been converted.
Comment #66
berdirAh, looks like we missed that one, I think we can convert that in the same issue ,should be simple enough?
Comment #67
klausiOk, opened #2734663: Update deprecation message for old KernelTestBase in simpletest.