summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-08-12 16:50:37 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-08-12 16:50:37 +0200
commit8c7bcacde38ed7306d14a7e5769d6d1f2f8b9a21 (patch)
treea7caaec021daddae114cc5f70a140002065e7482 /_test
parentadec979fd5453cf213b776d7dceaaaac4eb05713 (diff)
downloadrpg-8c7bcacde38ed7306d14a7e5769d6d1f2f8b9a21.tar.gz
rpg-8c7bcacde38ed7306d14a7e5769d6d1f2f8b9a21.tar.bz2
added list test
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/subscription.test.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/_test/tests/inc/subscription.test.php b/_test/tests/inc/subscription.test.php
index b3d49a533..be2e68b74 100644
--- a/_test/tests/inc/subscription.test.php
+++ b/_test/tests/inc/subscription.test.php
@@ -156,6 +156,43 @@ class subscription_test extends DokuWikiTest {
$this->assertEquals(array('arthur@example.com','arthur@example.com','arthur@example.com'), $sub->mails);
}
+ function test_bulklist(){
+ $sub = new MockupSubscription();
+
+ // let's start with nothing
+ $this->assertEquals(0, $sub->send_bulk('sub1:test'));
+
+ // create a subscription
+ $sub->add('sub1:', 'testuser', 'list', '978328800'); // last mod 2001-01-01
+
+ // now create change
+ $_SERVER['REMOTE_USER'] = 'someguy';
+ saveWikiText('sub1:test', 'foo bar', 'a subscription change', false);
+
+ // should trigger a mail
+ $this->assertEquals(1, $sub->send_bulk('sub1:test'));
+ $this->assertEquals(array('arthur@example.com'), $sub->mails);
+
+ $sub->reset();
+
+ // now create more changes
+ $_SERVER['REMOTE_USER'] = 'someguy';
+ saveWikiText('sub1:sub2:test', 'foo bar', 'a subscription change', false);
+ saveWikiText('sub1:another_test', 'foo bar', 'a subscription change', false);
+
+ // should not trigger a mail, because the subscription time has not been reached, yet
+ $this->assertEquals(0, $sub->send_bulk('sub1:test'));
+ $this->assertEquals(array(), $sub->mails);
+
+ // reset the subscription time
+ $sub->add('sub1:', 'testuser', 'list', '978328800'); // last mod 2001-01-01
+
+ // we now should get a single mail for all three changes
+ $this->assertEquals(1, $sub->send_bulk('sub1:test'));
+ $this->assertEquals(array('arthur@example.com'), $sub->mails);
+ }
+
+
}
/**