diff options
Diffstat (limited to 'tests/PHPUnit/Integration/UpdaterTest.php')
-rw-r--r-- | tests/PHPUnit/Integration/UpdaterTest.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/UpdaterTest.php b/tests/PHPUnit/Integration/UpdaterTest.php index aeee654848..a4bec9f93c 100644 --- a/tests/PHPUnit/Integration/UpdaterTest.php +++ b/tests/PHPUnit/Integration/UpdaterTest.php @@ -18,6 +18,21 @@ use Piwik\Tests\Framework\Fixture; */ class UpdaterTest extends IntegrationTestCase { + public function test_doUpdate_reportsAnError_whenMissingFilePermissionException() + { + $updater = new Updater($pathToCoreUpdates = null, PIWIK_INCLUDE_PATH . '/tests/resources/Updater/%s/'); + $updater->markComponentSuccessfullyUpdated('testpluginUpdates', '0.4'); + $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile(array('testpluginUpdates' => '0.5')); + + $this->assertEquals(1, count($componentsWithUpdateFile)); + + $result = $updater->updateComponents($componentsWithUpdateFile); + + $this->assertTrue( count ($result['errors']) > 0, 'when an update fails because config file is not writable, we expect the updater to report a critical error'); + $this->assertEquals( 'make sure this exception is thrown', $result['errors'][0]); + } + + public function testUpdaterChecksCoreVersionAndDetectsUpdateFile() { $updater = new Updater(PIWIK_INCLUDE_PATH . '/tests/resources/Updater/core/'); |