diff options
Diffstat (limited to 'tests/updater')
-rw-r--r-- | tests/updater/DummyUpdater.php | 8 | ||||
-rw-r--r-- | tests/updater/UpdaterTest.php | 20 |
2 files changed, 14 insertions, 14 deletions
diff --git a/tests/updater/DummyUpdater.php b/tests/updater/DummyUpdater.php index 07c7f5c4..3403233f 100644 --- a/tests/updater/DummyUpdater.php +++ b/tests/updater/DummyUpdater.php | |||
@@ -37,7 +37,7 @@ class DummyUpdater extends Updater | |||
37 | * | 37 | * |
38 | * @return bool true. | 38 | * @return bool true. |
39 | */ | 39 | */ |
40 | final private function updateMethodDummy1() | 40 | final protected function updateMethodDummy1() |
41 | { | 41 | { |
42 | return true; | 42 | return true; |
43 | } | 43 | } |
@@ -47,7 +47,7 @@ class DummyUpdater extends Updater | |||
47 | * | 47 | * |
48 | * @return bool true. | 48 | * @return bool true. |
49 | */ | 49 | */ |
50 | final private function updateMethodDummy2() | 50 | final protected function updateMethodDummy2() |
51 | { | 51 | { |
52 | return true; | 52 | return true; |
53 | } | 53 | } |
@@ -57,7 +57,7 @@ class DummyUpdater extends Updater | |||
57 | * | 57 | * |
58 | * @return bool true. | 58 | * @return bool true. |
59 | */ | 59 | */ |
60 | final private function updateMethodDummy3() | 60 | final protected function updateMethodDummy3() |
61 | { | 61 | { |
62 | return true; | 62 | return true; |
63 | } | 63 | } |
@@ -67,7 +67,7 @@ class DummyUpdater extends Updater | |||
67 | * | 67 | * |
68 | * @throws Exception error. | 68 | * @throws Exception error. |
69 | */ | 69 | */ |
70 | final private function updateMethodException() | 70 | final protected function updateMethodException() |
71 | { | 71 | { |
72 | throw new Exception('whatever'); | 72 | throw new Exception('whatever'); |
73 | } | 73 | } |
diff --git a/tests/updater/UpdaterTest.php b/tests/updater/UpdaterTest.php index a7dd70bf..a6280b8c 100644 --- a/tests/updater/UpdaterTest.php +++ b/tests/updater/UpdaterTest.php | |||
@@ -2,11 +2,11 @@ | |||
2 | namespace Shaarli\Updater; | 2 | namespace Shaarli\Updater; |
3 | 3 | ||
4 | use Exception; | 4 | use Exception; |
5 | use PHPUnit\Framework\TestCase; | ||
6 | use Shaarli\Bookmark\BookmarkFileService; | 5 | use Shaarli\Bookmark\BookmarkFileService; |
7 | use Shaarli\Bookmark\BookmarkServiceInterface; | 6 | use Shaarli\Bookmark\BookmarkServiceInterface; |
8 | use Shaarli\Config\ConfigManager; | 7 | use Shaarli\Config\ConfigManager; |
9 | use Shaarli\History; | 8 | use Shaarli\History; |
9 | use Shaarli\TestCase; | ||
10 | 10 | ||
11 | 11 | ||
12 | /** | 12 | /** |
@@ -42,7 +42,7 @@ class UpdaterTest extends TestCase | |||
42 | /** | 42 | /** |
43 | * Executed before each test. | 43 | * Executed before each test. |
44 | */ | 44 | */ |
45 | public function setUp() | 45 | protected function setUp(): void |
46 | { | 46 | { |
47 | $this->refDB = new \ReferenceLinkDB(); | 47 | $this->refDB = new \ReferenceLinkDB(); |
48 | $this->refDB->write(self::$testDatastore); | 48 | $this->refDB->write(self::$testDatastore); |
@@ -87,23 +87,23 @@ class UpdaterTest extends TestCase | |||
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Test errors in UpdaterUtils::write_updates_file(): empty updates file. | 89 | * Test errors in UpdaterUtils::write_updates_file(): empty updates file. |
90 | * | ||
91 | * @expectedException Exception | ||
92 | * @expectedExceptionMessageRegExp /Updates file path is not set(.*)/ | ||
93 | */ | 90 | */ |
94 | public function testWriteEmptyUpdatesFile() | 91 | public function testWriteEmptyUpdatesFile() |
95 | { | 92 | { |
93 | $this->expectException(\Exception::class); | ||
94 | $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/'); | ||
95 | |||
96 | UpdaterUtils::write_updates_file('', array('test')); | 96 | UpdaterUtils::write_updates_file('', array('test')); |
97 | } | 97 | } |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. | 100 | * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. |
101 | * | ||
102 | * @expectedException Exception | ||
103 | * @expectedExceptionMessageRegExp /Unable to write(.*)/ | ||
104 | */ | 101 | */ |
105 | public function testWriteUpdatesFileNotWritable() | 102 | public function testWriteUpdatesFileNotWritable() |
106 | { | 103 | { |
104 | $this->expectException(\Exception::class); | ||
105 | $this->expectExceptionMessageRegExp('/Unable to write(.*)/'); | ||
106 | |||
107 | $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; | 107 | $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; |
108 | touch($updatesFile); | 108 | touch($updatesFile); |
109 | chmod($updatesFile, 0444); | 109 | chmod($updatesFile, 0444); |
@@ -168,11 +168,11 @@ class UpdaterTest extends TestCase | |||
168 | 168 | ||
169 | /** | 169 | /** |
170 | * Test Update failed. | 170 | * Test Update failed. |
171 | * | ||
172 | * @expectedException \Exception | ||
173 | */ | 171 | */ |
174 | public function testUpdateFailed() | 172 | public function testUpdateFailed() |
175 | { | 173 | { |
174 | $this->expectException(\Exception::class); | ||
175 | |||
176 | $updates = array( | 176 | $updates = array( |
177 | 'updateMethodDummy1', | 177 | 'updateMethodDummy1', |
178 | 'updateMethodDummy2', | 178 | 'updateMethodDummy2', |