summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-01-18 10:40:49 +0100
committerAndreas Gohr <andi@splitbrain.org>2013-01-18 10:40:49 +0100
commit6686e3d1ac97a3c4d256f4e9df7f772102baed96 (patch)
tree6671d6418beca4c0644713bb289ecfb4f42c086c /_test
parentb34cf753be6c2c3fc67eac58738acc74a1c1785a (diff)
downloadrpg-6686e3d1ac97a3c4d256f4e9df7f772102baed96.tar.gz
rpg-6686e3d1ac97a3c4d256f4e9df7f772102baed96.tar.bz2
fixed tests
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/subscription.test.php31
-rw-r--r--_test/tests/inc/subscription_set.test.php20
2 files changed, 24 insertions, 27 deletions
diff --git a/_test/tests/inc/subscription.test.php b/_test/tests/inc/subscription.test.php
index c6f33dec7..333400576 100644
--- a/_test/tests/inc/subscription.test.php
+++ b/_test/tests/inc/subscription.test.php
@@ -120,7 +120,7 @@ class subscription_test extends DokuWikiTest {
);
}
- function test_bulkdigest(){
+ function test_bulkdigest() {
$sub = new MockupSubscription();
// let's start with nothing
@@ -153,10 +153,10 @@ class subscription_test extends DokuWikiTest {
// we now should get mails for three changes
$this->assertEquals(3, $sub->send_bulk('sub1:test'));
- $this->assertEquals(array('arthur@example.com','arthur@example.com','arthur@example.com'), $sub->mails);
+ $this->assertEquals(array('arthur@example.com', 'arthur@example.com', 'arthur@example.com'), $sub->mails);
}
- function test_bulklist(){
+ function test_bulklist() {
$sub = new MockupSubscription();
// let's start with nothing
@@ -192,7 +192,24 @@ class subscription_test extends DokuWikiTest {
$this->assertEquals(array('arthur@example.com'), $sub->mails);
}
+ /**
+ * Tests, if overwriting subscriptions works even when subscriptions for the same
+ * user exist for two nested namespaces, this is a test for the bug described in FS#2580
+ */
+ function test_overwrite() {
+ $sub = new MockupSubscription();
+ $sub->add(':', 'admin', 'digest', '123456789');
+ $sub->add(':wiki:', 'admin', 'digest', '123456789');
+ $sub->add(':', 'admin', 'digest', '1234');
+ $sub->add(':wiki:', 'admin', 'digest', '1234');
+
+ $subscriptions = $sub->subscribers(':wiki:', 'admin');
+
+ $this->assertCount(1, $subscriptions[':'], 'More than one subscription saved for the root namespace even though the old one should have been overwritten.');
+ $this->assertCount(1, $subscriptions[':wiki:'], 'More than one subscription saved for the wiki namespace even though the old one should have been overwritten.');
+ $this->assertCount(2, $subscriptions, 'Didn\'t find the expected two subscriptions');
+ }
}
/**
@@ -201,18 +218,18 @@ class subscription_test extends DokuWikiTest {
class MockupSubscription extends Subscription {
public $mails; // we keep sent mails here
- public function __construct(){
+ public function __construct() {
$this->reset();
}
/**
* resets the mail array
*/
- public function reset(){
+ public function reset() {
$this->mails = array();
}
- public function isenabled(){
+ public function isenabled() {
return true;
}
@@ -220,7 +237,7 @@ class MockupSubscription extends Subscription {
return parent::buildregex($user, $style, $data);
}
- protected function send($subscriber_mail, $subject, $id, $template, $trep, $hrep){
+ protected function send($subscriber_mail, $subject, $id, $template, $trep, $hrep = null) {
$this->mails[] = $subscriber_mail;
return true;
}
diff --git a/_test/tests/inc/subscription_set.test.php b/_test/tests/inc/subscription_set.test.php
deleted file mode 100644
index 5c0a6c816..000000000
--- a/_test/tests/inc/subscription_set.test.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * Tests the subscription set function
- */
-class subscription_set_test extends DokuWikiTest {
- /**
- * Tests, if overwriting subscriptions works even when subscriptions for the same
- * user exist for two nested namespaces, this is a test for the bug described in FS#2580
- */
- function test_overwrite() {
- subscription_set('admin', ':', 'digest', '123456789');
- subscription_set('admin', ':wiki:', 'digest', '123456789');
- subscription_set('admin', ':', 'digest', '1234', true);
- subscription_set('admin', ':wiki:', 'digest', '1234', true);
- $subscriptions = subscription_find(':wiki:', array('user' => 'admin'));
- $this->assertCount(1, $subscriptions[':'], 'More than one subscription saved for the root namespace even though the old one should have been overwritten.');
- $this->assertCount(1, $subscriptions[':wiki:'], 'More than one subscription saved for the wiki namespace even though the old one should have been overwritten.');
- $this->assertCount(2, $subscriptions, 'Didn\'t find the expected two subscriptions');
- }
-}