aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/plugins/PluginIssoTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/plugins/PluginIssoTest.php')
-rw-r--r--tests/plugins/PluginIssoTest.php23
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php
index 0ae73183..bdfab439 100644
--- a/tests/plugins/PluginIssoTest.php
+++ b/tests/plugins/PluginIssoTest.php
@@ -1,5 +1,10 @@
1<?php 1<?php
2namespace Shaarli\Plugin\Isso;
3
4use DateTime;
5use Shaarli\Bookmark\LinkDB;
2use Shaarli\Config\ConfigManager; 6use Shaarli\Config\ConfigManager;
7use Shaarli\Plugin\PluginManager;
3 8
4require_once 'plugins/isso/isso.php'; 9require_once 'plugins/isso/isso.php';
5 10
@@ -8,7 +13,7 @@ require_once 'plugins/isso/isso.php';
8 * 13 *
9 * Test the Isso plugin (comment system). 14 * Test the Isso plugin (comment system).
10 */ 15 */
11class PluginIssoTest extends PHPUnit_Framework_TestCase 16class PluginIssoTest extends \PHPUnit\Framework\TestCase
12{ 17{
13 /** 18 /**
14 * Reset plugin path 19 * Reset plugin path
@@ -21,7 +26,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
21 /** 26 /**
22 * Test Isso init without errors. 27 * Test Isso init without errors.
23 */ 28 */
24 public function testWallabagInitNoError() 29 public function testIssoInitNoError()
25 { 30 {
26 $conf = new ConfigManager(''); 31 $conf = new ConfigManager('');
27 $conf->set('plugins.ISSO_SERVER', 'value'); 32 $conf->set('plugins.ISSO_SERVER', 'value');
@@ -32,7 +37,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
32 /** 37 /**
33 * Test Isso init with errors. 38 * Test Isso init with errors.
34 */ 39 */
35 public function testWallabagInitError() 40 public function testIssoInitError()
36 { 41 {
37 $conf = new ConfigManager(''); 42 $conf = new ConfigManager('');
38 $errors = isso_init($conf); 43 $errors = isso_init($conf);
@@ -96,19 +101,22 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
96 array( 101 array(
97 'id' => 12, 102 'id' => 12,
98 'url' => $str, 103 'url' => $str,
104 'shorturl' => $short1 = 'abcd',
99 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date1), 105 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date1),
100 ), 106 ),
101 array( 107 array(
102 'id' => 13, 108 'id' => 13,
103 'url' => $str . '2', 109 'url' => $str . '2',
110 'shorturl' => $short2 = 'efgh',
104 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date2), 111 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date2),
105 ), 112 ),
106 ) 113 )
107 ); 114 );
108 115
109 $processed = hook_isso_render_linklist($data, $conf); 116 $processed = hook_isso_render_linklist($data, $conf);
110 // data shouldn't be altered 117 // link_plugin should be added for the icon
111 $this->assertEquals($data, $processed); 118 $this->assertContains('<a href="?'. $short1 .'#isso-thread">', $processed['links'][0]['link_plugin'][0]);
119 $this->assertContains('<a href="?'. $short2 .'#isso-thread">', $processed['links'][1]['link_plugin'][0]);
112 } 120 }
113 121
114 /** 122 /**
@@ -127,6 +135,7 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
127 array( 135 array(
128 'id' => 12, 136 'id' => 12,
129 'url' => $str, 137 'url' => $str,
138 'shorturl' => $short1 = 'abcd',
130 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date), 139 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date),
131 ) 140 )
132 ), 141 ),
@@ -135,8 +144,8 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
135 144
136 $processed = hook_isso_render_linklist($data, $conf); 145 $processed = hook_isso_render_linklist($data, $conf);
137 146
138 // data shouldn't be altered 147 // link_plugin should be added for the icon
139 $this->assertEquals($data, $processed); 148 $this->assertContains('<a href="?'. $short1 .'#isso-thread">', $processed['links'][0]['link_plugin'][0]);
140 } 149 }
141 150
142 /** 151 /**