Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
views.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
1 Nov 2012 at 00:09 UTC
Updated:
29 Jul 2014 at 21:26 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettHere's an attempt at doing this. It might be useful to get this one in, since we'll need the base class for any other conversions.
If anyone has an idea on how to work around PHP not supporting multi-class inheritance, please chime in; a good deal of this is copy pasted from ViewTestBase.
Comment #3
tim.plunkettOkay, here's all of the field handler tests.
Comment #5
tim.plunkettHere's hoping this passes.
Comment #6
tim.plunkettHere's more tests.
Also, this attempts to disable all test views by default, I'm curious to see what that breaks.
Comment #8
dawehnerWhat a great change!
This change basically breaks some efforts of #1826602: Allow all configuration entities to be enabled/disabled so do we really have to include this in this patch, but i totally agree that this is a change, which could potentially improve the speed of the tests.
The patch includes a static class, which contains the views data, schema and actual test data,
so this code doesn't have to be duplicated.
Comment #9
berdirTraits! But we can't use them yet :) So copy it is, I guess. Or make them static methods if they're some sort of helpers, haven't actually looked at the patch.
This sounds great, there are probably many more tests that can be converted :)
Comment #10
tim.plunkettReroll without the massive changes to the test views, and with the interdiff from #8.
This will fail, I just want to see where.
Comment #11
berdirUh, wrong patch? :)
Comment #12
tim.plunkettAnd I even number my patches! Ugh.
Comment #14
dawehnerThis is a lot of great work!
If you just compare http://qa.drupal.org/pifr/test/391993 and http://qa.drupal.org/pifr/test/392093 we have maybe already a good performance win.
Some small things/nitpicks are below.
I try to figure out why we need that exactly, so probably because we use another view?
Do we have a common documentation for that ones? Maybe it should be even set in the ViewUnitTestBase, as it is used in the test_view?
It doesn't really make sense to override options for the default display :)
Aren't we throwing the usage away anyway?
Is this still needed?
We could update that to enforse a ViewExecutable but yeah this is just a move.
No need for the use here.
Comment #15
tim.plunkettThe getBasicPageView() is only used by one test, I removed it from the base class.
I'm not changing anything that's 100% copy/paste (like executeView()).
Apparently the unit test state() doesn't persist across requests, I'll open a follow-up for that. Using $GLOBALS for now.
Comment #16
tim.plunkettWhoops forgot one part.
Comment #17
tim.plunkettARGH
Comment #18
tim.plunkettAh, I needed to change the state() call in ViewTestBase as well.
Comment #20
tim.plunkettPlease let this one pass.
Comment #22
tim.plunkettThis should fix some of the fails, not sure about StyleTest though.
Comment #24
berdirRelated: #1839134: Convert database tests to (Drupal)UnitTestBase. Tested the BasicTest before and after the patch and got down from 50s to 20. So the difference isn't as huge as with the database tests but I'm also testing on a slower system this time and the views tests obviously need to enable way more modules.
Still, this is very nice :)
The use isn't necessary?
Had a quick look at the failing test but didn't see anything obvious other than that the row_test plugin is only used in one other test and that's a UI test, so that at least explains why this is the only one that is failing because of it :)
Comment #25
tim.plunkettI've removed the unnecessary use statements.
The StyleTest failure looks to be a separate issue, so I've moved that test back to a WebTest.
Comment #26
damiankloip commentedI would say this patch looks 'mint' now :)
For me this is about an initial conversion of what can be easily done now, so it happily ticks that box!
Comment #27
berdirLooks good to me as well. Did some profiling and noticed that we're importing *many* default config files for all these views and opened #1851234: Slow yaml parsing slows down tests which load/save many config files (e.g. views).
Comment #28
webchickThis isn't quite up to snuff docs-wise... a few minor bits, then hopefully we can get this lovely patch in.
Everywhere else we're replacing HandlerTestBase with ViewsUnitTestBase. Why not here too?
I love this. :D
That's a copy/pasta from ViewsTestBase. We should disambiguate these two classes, since they're for different things.
Missing PHPDoc.
Missing @param/@return.
Thought there was one other one but I forget now. :)
Comment #29
xjmI'll add some docs polish *yawn* tomorrow morning. :)
Comment #30
xjmFor the record, the docblock for
WebTestBaseis:So I think @tim.plunkett can be forgiven for copying the test base class docs as they were. ;)
We can file a followup to rename
ViewTestBasetoViewWebTestBasefor clarity. (And for theWebTestBasedocblock.)I'll focus on cleaning up the docs in
ViewTestBase,View[Web]TestBase, andViewTestData. There are a number of missing docblocks and other docs style errors in the test classes that we're moving toDrupalUnitTestBasehere, but changing that is likely out of scope here and can be done later in the release cycle as part of our general codebase cleanup.Edited to clarify what I meant.
Comment #31
tim.plunkettWith this patch, the two classes are ViewTestBase and ViewUnitTestBase (the opposite of what is mentioned above). Just FYI.EDIT: Apparently I responded to a typo that has since been fixed :)
Comment #32
xjmOh. I keep typing
ViewsTestBase, etc., when it isViewTestBase. Why is itViewTestBase?Comment #33
xjmHm. I notice in documenting this that there are a lot of methods on
ViewTestBaseandViewUnitTestBase(I keep having to delete the s) that are 100% identical, unless I've missed some difference. Could we move these intoViewTempTestBase extends TestBase, and doViewUnitTestBase extends DrupalUnitTestBase extends ViewTempTestBase? And then in a followup renameViewTempTestBasetoViewTestBaseandViewTestBasetoViewWebTestBase.Hm? You must have replied to my post while I was neurotically editing typos? :)
Comment #34
berdir@xjm: Only if you first implement multiple inheritance support for PHP :) In PHP 5.4, it would be possible to use a trait for this, but we can't do that yet. So we really only have two options: static methods or duplicating it.
Comment #35
tim.plunkettWe used static methods where possible, but the assertion methods use
$thisand cannot be static.Comment #36
xjmOh, like it says in #9. I read the issue, I swear. Yup.
Comment #37
xjmDocs docs docs.
Comment #38
xjmComment #39
xjmgitiocy again.
Comment #40
tim.plunkettThe interdiff is great, the patch in #39 is RTBC.
Let's let it come back green first though :)
Comment #41
xjmFor the record, #39 is a bit bigger because it has
FieldTesttoFieldWebTestas a full diff rather than a rename, but it's the same code. The interdiff in #38 shows the changes.Comment #42
xjmxpost
Comment #43
tim.plunkett#39: vdc-1828642-really-for-reals-39.patch queued for re-testing.
Comment #45
dawehner#39: vdc-1828642-really-for-reals-39.patch queued for re-testing.
Comment #47
xjmTestbot :(
Comment #48
xjmBot issues. #39 is green and RTBC.
Comment #49
webchickLet's hear it for more fasterererer tests! :D
Committed and pushed to 8.x. Thanks!