diff options
Diffstat (limited to 'tests/legacy/LegacyUpdaterTest.php')
-rw-r--r-- | tests/legacy/LegacyUpdaterTest.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/legacy/LegacyUpdaterTest.php b/tests/legacy/LegacyUpdaterTest.php index 7c429811..acfac530 100644 --- a/tests/legacy/LegacyUpdaterTest.php +++ b/tests/legacy/LegacyUpdaterTest.php | |||
@@ -40,7 +40,7 @@ class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase | |||
40 | /** | 40 | /** |
41 | * Executed before each test. | 41 | * Executed before each test. |
42 | */ | 42 | */ |
43 | public function setUp() | 43 | protected function setUp(): void |
44 | { | 44 | { |
45 | copy('tests/utils/config/configJson.json.php', self::$configFile .'.json.php'); | 45 | copy('tests/utils/config/configJson.json.php', self::$configFile .'.json.php'); |
46 | $this->conf = new ConfigManager(self::$configFile); | 46 | $this->conf = new ConfigManager(self::$configFile); |
@@ -82,10 +82,11 @@ class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase | |||
82 | * Test errors in UpdaterUtils::write_updates_file(): empty updates file. | 82 | * Test errors in UpdaterUtils::write_updates_file(): empty updates file. |
83 | * | 83 | * |
84 | * @expectedException Exception | 84 | * @expectedException Exception |
85 | * @expectedExceptionMessageRegExp /Updates file path is not set(.*)/ | ||
86 | */ | 85 | */ |
87 | public function testWriteEmptyUpdatesFile() | 86 | public function testWriteEmptyUpdatesFile() |
88 | { | 87 | { |
88 | $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/'); | ||
89 | |||
89 | UpdaterUtils::write_updates_file('', array('test')); | 90 | UpdaterUtils::write_updates_file('', array('test')); |
90 | } | 91 | } |
91 | 92 | ||
@@ -93,10 +94,11 @@ class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase | |||
93 | * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. | 94 | * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. |
94 | * | 95 | * |
95 | * @expectedException Exception | 96 | * @expectedException Exception |
96 | * @expectedExceptionMessageRegExp /Unable to write(.*)/ | ||
97 | */ | 97 | */ |
98 | public function testWriteUpdatesFileNotWritable() | 98 | public function testWriteUpdatesFileNotWritable() |
99 | { | 99 | { |
100 | $this->expectExceptionMessageRegExp('/Unable to write(.*)/'); | ||
101 | |||
100 | $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; | 102 | $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; |
101 | touch($updatesFile); | 103 | touch($updatesFile); |
102 | chmod($updatesFile, 0444); | 104 | chmod($updatesFile, 0444); |
@@ -161,11 +163,11 @@ class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase | |||
161 | 163 | ||
162 | /** | 164 | /** |
163 | * Test Update failed. | 165 | * Test Update failed. |
164 | * | ||
165 | * @expectedException \Exception | ||
166 | */ | 166 | */ |
167 | public function testUpdateFailed() | 167 | public function testUpdateFailed() |
168 | { | 168 | { |
169 | $this->expectException(\Exception::class); | ||
170 | |||
169 | $updates = array( | 171 | $updates = array( |
170 | 'updateMethodDummy1', | 172 | 'updateMethodDummy1', |
171 | 'updateMethodDummy2', | 173 | 'updateMethodDummy2', |
@@ -754,7 +756,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; | |||
754 | if (isset($_SESSION['warnings'])) { | 756 | if (isset($_SESSION['warnings'])) { |
755 | unset($_SESSION['warnings']); | 757 | unset($_SESSION['warnings']); |
756 | } | 758 | } |
757 | 759 | ||
758 | $updater = new LegacyUpdater([], [], $this->conf, true, $_SESSION); | 760 | $updater = new LegacyUpdater([], [], $this->conf, true, $_SESSION); |
759 | $this->assertTrue($updater->updateMethodWebThumbnailer()); | 761 | $this->assertTrue($updater->updateMethodWebThumbnailer()); |
760 | $this->assertFalse($this->conf->exists('thumbnail')); | 762 | $this->assertFalse($this->conf->exists('thumbnail')); |