]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/Updater/DummyUpdater.php
Replace $GLOBALS configuration with the configuration manager in the whole code base
[github/shaarli/Shaarli.git] / tests / Updater / DummyUpdater.php
1 <?php
2
3 require_once 'application/Updater.php';
4
5 /**
6 * Class DummyUpdater.
7 * Extends Updater to add update method designed for unit tests.
8 */
9 class DummyUpdater extends Updater
10 {
11 /**
12 * Object constructor.
13 *
14 * @param array $doneUpdates Updates which are already done.
15 * @param LinkDB $linkDB LinkDB instance.
16 * @param boolean $isLoggedIn True if the user is logged in.
17 */
18 public function __construct($doneUpdates, $linkDB, $isLoggedIn)
19 {
20 parent::__construct($doneUpdates, $linkDB, $isLoggedIn);
21
22 // Retrieve all update methods.
23 // For unit test, only retrieve final methods,
24 $class = new ReflectionClass($this);
25 $this->methods = $class->getMethods(ReflectionMethod::IS_FINAL);
26 }
27
28 /**
29 * Update method 1.
30 *
31 * @return bool true.
32 */
33 private final function updateMethodDummy1()
34 {
35 return true;
36 }
37
38 /**
39 * Update method 2.
40 *
41 * @return bool true.
42 */
43 private final function updateMethodDummy2()
44 {
45 return true;
46 }
47
48 /**
49 * Update method 3.
50 *
51 * @return bool true.
52 */
53 private final function updateMethodDummy3()
54 {
55 return true;
56 }
57
58 /**
59 * Update method 4, raise an exception.
60 *
61 * @throws Exception error.
62 */
63 private final function updateMethodException()
64 {
65 throw new Exception('whatever');
66 }
67 }