#1754216: Meta: Add one test that tests each plugin type intensive
Most of the logic in PagerPluginBase is already covered in PagerTest.php: function testPagerApi(). But the tests are written against the Full pager. So, the task here is to:
- write a minimum test pager type that extends PagerPluginBase,
inviews/tests/modules/views_test_data/lib/Drupal/views_test_data/Plugin/views - add a new view based on this pager type,
inviews/tests/modules/views_test_config/test_views - convert
testPagerApito use this new view, instead of 'test_pager_full' - add test to cover
function hasMoreRecords()in PagerPluginBase.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | vdc-1754254-8.patch | 8.06 KB | dawehner |
| #6 | vdc-1754254-6.patch | 8.49 KB | dawehner |
| #6 | interdiff.txt | 7.12 KB | dawehner |
| #4 | 1754254.patch | 4.15 KB | damiankloip |
Comments
Comment #1
xjmComment #2
xjmComment #3
herom commentedissue summary updated.
Comment #4
damiankloip commentedWe should actually be able to test this OK with PHPUnit. Using the mocking, we can get a mock for the abstract PagerPluginBase class and test all the methods.
Then we have a proper test for just testing this base functionality :) what do you think?
I have not got time to finish this right now, so if anyones else so desires, be my guest... I've left a todo in the test class.
Comment #5
herom commented@damiankloip I wrote the current summary based on the other issues in the Meta issue.
The PHPUnit looks fine too, I guess. but in that case, the testPagerApi function in PagerTest should be removed, because this is just duplicating that test.
Comment #6
dawehnerGreat test coverage so far!
Wow, mocking the dbtng objects isn't straighforward.
@herom
I don't see where PagerTest::testPagerApi directly tests these functions (note: the call through the executable is a worthwile test).
Comment #7
damiankloip commentedGood docs , but this seems a bit overkill to me. We have an @see on the class to the PagerPluginBase class, then the 'Tests the .... method' part, then an @see too!
Did that change get reverted already?
Otherwise, nice additions!
Comment #8
dawehnerThe reason why I do like this is because I can just directly jump to the code.
Removed the phpunit "hack".
Comment #9
damiankloip commentedThis coverage looks great now.
Comment #10
catchCommitted/pushed to 8.x, thanks!
Comment #11.0
(not verified) commentedupdate issue summary