aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/legacy/LegacyDummyUpdater.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-01-18 10:01:06 +0100
committerGitHub <noreply@github.com>2020-01-18 10:01:06 +0100
commit3fb29fdda04ca86e04422d49b86cf646d53c4f9d (patch)
treeadf8512f93f5559ba87d0c9931969ae4ebea7133 /tests/legacy/LegacyDummyUpdater.php
parent796c4c57d085ae4589b53dfe8369ae9ba30ffdaf (diff)
parente26e2060f5470ce8bf4c5973284bae07b8af170a (diff)
downloadShaarli-3fb29fdda04ca86e04422d49b86cf646d53c4f9d.tar.gz
Shaarli-3fb29fdda04ca86e04422d49b86cf646d53c4f9d.tar.zst
Shaarli-3fb29fdda04ca86e04422d49b86cf646d53c4f9d.zip
Store bookmarks as PHP objects and add a service layer to retriā€¦ (#1307)
Store bookmarks as PHP objects and add a service layer to retrieve them
Diffstat (limited to 'tests/legacy/LegacyDummyUpdater.php')
-rw-r--r--tests/legacy/LegacyDummyUpdater.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/legacy/LegacyDummyUpdater.php b/tests/legacy/LegacyDummyUpdater.php
new file mode 100644
index 00000000..10e0a5b7
--- /dev/null
+++ b/tests/legacy/LegacyDummyUpdater.php
@@ -0,0 +1,74 @@
1<?php
2namespace Shaarli\Updater;
3
4use Exception;
5use ReflectionClass;
6use ReflectionMethod;
7use Shaarli\Config\ConfigManager;
8use Shaarli\Legacy\LegacyLinkDB;
9use Shaarli\Legacy\LegacyUpdater;
10
11/**
12 * Class LegacyDummyUpdater.
13 * Extends updater to add update method designed for unit tests.
14 */
15class LegacyDummyUpdater extends LegacyUpdater
16{
17 /**
18 * Object constructor.
19 *
20 * @param array $doneUpdates Updates which are already done.
21 * @param LegacyLinkDB $linkDB LinkDB instance.
22 * @param ConfigManager $conf Configuration Manager instance.
23 * @param boolean $isLoggedIn True if the user is logged in.
24 */
25 public function __construct($doneUpdates, $linkDB, $conf, $isLoggedIn)
26 {
27 parent::__construct($doneUpdates, $linkDB, $conf, $isLoggedIn);
28
29 // Retrieve all update methods.
30 // For unit test, only retrieve final methods,
31 $class = new ReflectionClass($this);
32 $this->methods = $class->getMethods(ReflectionMethod::IS_FINAL);
33 }
34
35 /**
36 * Update method 1.
37 *
38 * @return bool true.
39 */
40 final private function updateMethodDummy1()
41 {
42 return true;
43 }
44
45 /**
46 * Update method 2.
47 *
48 * @return bool true.
49 */
50 final private function updateMethodDummy2()
51 {
52 return true;
53 }
54
55 /**
56 * Update method 3.
57 *
58 * @return bool true.
59 */
60 final private function updateMethodDummy3()
61 {
62 return true;
63 }
64
65 /**
66 * Update method 4, raise an exception.
67 *
68 * @throws Exception error.
69 */
70 final private function updateMethodException()
71 {
72 throw new Exception('whatever');
73 }
74}