Closed (fixed)
Project:
IMP
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Oct 2013 at 02:44 UTC
Updated:
8 Nov 2013 at 18:10 UTC
Jump to comment: Most recent, Most recent file
Write PHPUnit tests for Comment source plugin
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 0001-Starting-d6-comment-source-plugin-and-its-test.patch | 4.27 KB | marvil07 |
Comments
Comment #1
eliza411 commentedComment #2
marvil07 commentedI'm a little confused about how to write a d6 comment source plugin test, since in order to really test it we will need a database to query to see if query goes ok(assuming the new definition of source).
A mock of this piece will end up in a test which does not really test anything.
So, if we include a d6 dump, then we could see if the expected values are returned since we have a value to compare with on the dump, is that the original plan?
Comment #3
chx commentedI was planning to mock DBTNG. Why that wouldn't test anything?
Comment #4
marvil07 commentedmakes sense, will try to star on this.
Comment #5
marvil07 commentedA poor initial patch.
It seems not that straightforward to mock dbtng. In the other side IIRC phpunit tests could not access database, which sounds fine since we are using the configured database directly, but I am not sure if I am assuming correctly.
Some questions:
Comment #6
alexweber commentedHave you had a chance to follow up on this? I have similar questions :)
EDIT: So I managed to get a CacheBackendInterface object by doing the following:
I found this in Drupal\locale\Tests\LocaleTranslationTest.php :)
Comment #7
marvil07 commentedI see in the repository that this test is running, chx++
Comment #8
eliza411 commentedIf people are using this as an example, you can view the tests at:
http://drupalcode.org/sandbox/chx/2105305.git/blob/HEAD:/tests/Drupal/mi...
And the plugin at:
http://drupalcode.org/sandbox/chx/2105305.git/blob/HEAD:/lib/Drupal/migr...