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