Closed (fixed)
Project:
Simplenews Scheduler
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
29 Jan 2012 at 22:58 UTC
Updated:
29 Feb 2012 at 19:20 UTC
Jump to comment: Most recent file
Comments
Comment #1
miro_dietikerNow we have the right branch.
Comment #2
dgtlmoon commentedI think the best place to start for writing tests is to add some manual trigger that a test can push to generate a newsletter.
This is probably best in the form of a variable that is passed to represent what is "now" instead of current time()
from this point, newsletter generation should be testable
Comment #3
dgtlmoon commentedI've started adding some tests, didnt need to go as far as the above comment tho, just set the date to a day previous.
this patch does not yet smartly set the date, it just choose the start of the month (!)
the bug problem is i'm seeing this when i call simplenews_scheduler_cron();, ideas?
Undefined property: stdClass::$simplenews_scheduler Notice simplenews_scheduler.module line 534Comment #4
dgtlmoon commentedComment #5
berdirThanks for starting with this.
The coding style will need some work, there are lots of trailing spaces and comments that need to follow the standards.
I think it makes sense to put this into the existing Simplenews group... there are already way too many groups on that page.
You might want to use the defined constant here (should be in the .module file), that makes the code easier to understand.
Will also use a few more test assertions and we'll need to make a few combinations of different times to check that it's generating only when it's supposed to. For example, you might want to start with a time that shouldn't actually generate anything and only then have it generate one. Because right now, the tests would pass just fine if the module would generate a newsletter every time cron is called :)
Not sure about the notice, maybe that just needs a check if the property exists.
Comment #6
dgtlmoon commentedMy main concern is why i'm getting that notice, everything else I can manage, but i'm not so motivated to continue until i get that notice figured out, ideas?
Comment #7
berdirLooks like this line is wrong, maybe a left-over:
My guess is that needs to look like this instead:
If you want to discuss anything, please ping me in #drupal-contribute
Comment #8
joachim commentedThere's a couple of patches I was holding off on committing to not break the D7 patch, which refactor the code with a view to making it a lot easier to write tests for:
- #1403830: refactor hook_cron to aid testing
- #1399626: further refactoring in and around _simplenews_scheduler_new_edition()
Now that the D7 port patch is in, I can commit these.
Comment #9
dgtlmoon commentedOK cool, i have committed this one, thanks Berdir!
Comment #10
dgtlmoon commentedshall we backport to D6?