xref: /plugin/publish/_test/mail.unit.test.php (revision efec8cf115d4281f9529c15da5962329d0c1adb6)
1abc3ac64SMichael Große<?php
2abc3ac64SMichael Große/**
3abc3ac64SMichael Große * Unittests for the mail functionality of the publish plugin
4abc3ac64SMichael Große *
5abc3ac64SMichael Große * @group plugin_publish
6abc3ac64SMichael Große * @group plugin_publish_unittests
7abc3ac64SMichael Große * @group plugins
8abc3ac64SMichael Große * @group unittests
9abc3ac64SMichael Große * @author Michael Große <grosse@cosmocode.de>
10abc3ac64SMichael Große */
11abc3ac64SMichael Großeclass publish_mail_unit_test extends DokuWikiTest {
12abc3ac64SMichael Große
13abc3ac64SMichael Große    protected $pluginsEnabled = array('publish');
14abc3ac64SMichael Große
15abc3ac64SMichael Große    /**
16abc3ac64SMichael Große     * @covers action_plugin_publish_mail::difflink
17abc3ac64SMichael Große     */
18abc3ac64SMichael Große    function test_difflink () {
19abc3ac64SMichael Große        global $ID;
20abc3ac64SMichael Große        $ID = 'wiki:syntax';
211d7b4c34SMichael Große
221d7b4c34SMichael Große        /** @var helper_plugin_publish $helper*/
231d7b4c34SMichael Große        $helper = plugin_load('helper','publish');
241d7b4c34SMichael Große        $actual_difflink = $helper->getDifflink('wiki:syntax','1','2');
25*efec8cf1SMichael Große        $expected_difflink = 'http://wiki.example.com/./doku.php?id=wiki:syntax&do=diff&rev2[0]=1&rev2[1]=2&difftype=sidebyside';
26*efec8cf1SMichael Große        $this->assertSame($expected_difflink,$actual_difflink);
27abc3ac64SMichael Große    }
28abc3ac64SMichael Große
29abc3ac64SMichael Große    /**
301d7b4c34SMichael Große     * @covers action_plugin_publish_mail::apprejlink
31abc3ac64SMichael Große     */
32abc3ac64SMichael Große    function test_apprejlink () {
33abc3ac64SMichael Große        global $ID;
34abc3ac64SMichael Große        $ID = 'wiki:syntax';
35abc3ac64SMichael Große        $mail = new action_plugin_publish_mail;
36abc3ac64SMichael Große        $actual_apprejlink = $mail->apprejlink('wiki:syntax','1');
371d7b4c34SMichael Große        $expected_apprejlink = 'http://wiki.example.com/./doku.php?id=wiki:syntax&rev=1'; //this stray dot comes from an unclean test-setup
38abc3ac64SMichael Große        $this->assertSame($expected_apprejlink, $actual_apprejlink);
39abc3ac64SMichael Große    }
40abc3ac64SMichael Große}
41