Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
database system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Oct 2013 at 20:36 UTC
Updated:
29 Jul 2014 at 23:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mile23And the patch...
Comment #2
mile23Comment #3
dawehnerThe following methods could probably be tested as well, but I am fine with postpone that to another issue.
The work done here is already important.
Let's use "Contains \Drupal\Tests\Core..."
{@inheritdoc}
A little bit of documentation would be cool.
Comment #4
dawehnerJust some small points are needed.
Comment #5
mile23Thanks for the ping. :-)
Comment #6
mile23Comment #8
mile235: 2124365-5_db_connection_phpunit.patch queued for re-testing.
Comment #9
areke commentedThe patch no longer applies; it needs to be re-rolled.
Comment #10
mile23Applies for me, against be70033ea1e33da35d2fcc545714ef644df6f262
Comment #11
mile235: 2124365-5_db_connection_phpunit.patch queued for re-testing.
Comment #12
mile23Comment #13
dawehnerLet's get it in and maybe improve the test coverage even more later.
Comment #14
xjm5: 2124365-5_db_connection_phpunit.patch queued for re-testing.
Comment #15
catchOverall this looks great. I found some very minor nitpicks. Also are there any Simpletest tests we can get rid of now these are added, or is this all completely new?
Sorry this took a while to get to and it's a bit of a nothing review.
Comments should be on the line above, or is there a particular reason for this?
existent.
It's a bit weird for a class to be no-op, just no methods or something?
Should either use \PDO or PDO consistently in the comments.
Missing blank line under the summary here and a few other places.
Comment #16
mile23#15.1: Comments are inline to help keep track of the test data. The arrays are documented in @return, but it's sometimes hard to read data arrays. I'll just remove them and let @return do its job.
#15.3: We're testing that Connection can load a driver class, so we need a class to load. This seems to be the best way to mock that scenario, since Connection requires the file to exist and load successfully. See ConnectionTest::providerSchema(). The class is tucked away in a deeply recessed namespace, and it only gets auto-loaded during test time anyway. An improvement to Connection would include dependency injection for this kind of thing...
Formatting/typo stuff: done.
As far as the SimpleTest-based tests, there's Drupal\system\Tests\Database\ConnectionUnitTest, but it's really more of a minimal functional test, with a live database. It even skips itself if the database isn't MySQL. That's a valuable regression test, and not replaceable in PHPUnit.
Comment #17
ParisLiakos commentedthis still applies! back to catch
Comment #18
alexpottOn first review I was like why are we not using mockBuilder() to disable the constructor so I tried this. And got lots of errors about
PDOException: You cannot serialize or unserialize PDO instances. I think we should be mentioning this in the StubPDO class so no one else has to wonder the same thing.Comment #19
mile23Good point.
Added some explanation, and also some coding standards stuff for the test class.
Comment #20
ParisLiakos commentedComment #21
alexpottCommitted 6c410da and pushed to 8.x. Thanks!