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