]>
Commit | Line | Data |
---|---|---|
510377d2 A |
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. | |
510377d2 A |
15 | * @param LinkDB $linkDB LinkDB instance. |
16 | * @param boolean $isLoggedIn True if the user is logged in. | |
17 | */ | |
684e662a | 18 | public function __construct($doneUpdates, $linkDB, $isLoggedIn) |
510377d2 | 19 | { |
684e662a | 20 | parent::__construct($doneUpdates, $linkDB, $isLoggedIn); |
510377d2 A |
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 | } |