Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-03-15 21:40:36 +0300
committerdiosmosis <benaka@piwik.pro>2015-03-15 21:40:36 +0300
commit45947362cc645947206035ef832534f8d57f2057 (patch)
tree57b7aca0ef2437de50a23ebf08fcf20a2f2177e8 /plugins
parent3eb8b437be9fa64849677e08ee7a0844acd076ed (diff)
Add test for when core:update fails.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CoreUpdater/tests/Integration/Commands/UpdateTest.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/CoreUpdater/tests/Integration/Commands/UpdateTest.php b/plugins/CoreUpdater/tests/Integration/Commands/UpdateTest.php
index 59888564dc..fd9a817aa4 100644
--- a/plugins/CoreUpdater/tests/Integration/Commands/UpdateTest.php
+++ b/plugins/CoreUpdater/tests/Integration/Commands/UpdateTest.php
@@ -7,7 +7,10 @@
*/
namespace Piwik\Plugins\CoreUpdater\tests\Integration\Commands;
+use Piwik\Common;
use Piwik\Config;
+use Piwik\DataAccess\ArchiveTableCreator;
+use Piwik\Date;
use Piwik\Db;
use Piwik\Option;
use Piwik\Tests\Framework\TestCase\ConsoleCommandTestCase;
@@ -92,6 +95,21 @@ class UpdateTest extends ConsoleCommandTestCase
$this->assertEquals(Version::VERSION, Option::get('version_core'));
}
+ public function test_UpdateCommand_ReturnsCorrectExitCode_WhenErrorOccurs()
+ {
+ // create a blob table, then drop it manually so update 2.10.0-b10 will fail
+ $tableName = ArchiveTableCreator::getBlobTable(Date::factory('2015-01-01'));
+ Db::exec("DROP TABLE $tableName");
+
+ $result = $this->applicationTester->run(array(
+ 'command' => 'core:update',
+ '--yes' => true
+ ));
+
+ $this->assertEquals(1, $result);
+ $this->assertContains("Piwik could not be updated! See above for more information.", $this->applicationTester->getDisplay());
+ }
+
private function assertDryRunExecuted($output)
{
$this->assertContains("Note: this is a Dry Run", $output);