From 50b0a4b1810b921cab5fbd514219f5d26e406c6e Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Mon, 20 Mar 2017 02:47:32 -0600 Subject: Improve the test case Signed-off-by: Morris Jobke --- tests/lib/App/ManagerTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tests/lib/App') diff --git a/tests/lib/App/ManagerTest.php b/tests/lib/App/ManagerTest.php index 79450737266..8b23168938c 100644 --- a/tests/lib/App/ManagerTest.php +++ b/tests/lib/App/ManagerTest.php @@ -130,11 +130,14 @@ class ManagerTest extends TestCase { $this->assertEquals('no', $this->appConfig->getValue('files_trashbin', 'enabled', 'no')); } - /** - * @expectedException \Exception - */ public function testNotEnableIfNotInstalled() { - $this->manager->enableApp('some_random_name_which_i_hope_is_not_an_app'); + try { + $this->manager->enableApp('some_random_name_which_i_hope_is_not_an_app'); + $this->assertFalse(true, 'If this line is reached the expected exception is not thrown.'); + } catch (\Exception $e) { + // excpetion is expected + $this->assertEquals("some_random_name_which_i_hope_is_not_an_app can't be enabled since it is not installed.", $e->getMessage()); + } $this->assertEquals('no', $this->appConfig->getValue( 'some_random_name_which_i_hope_is_not_an_app', 'enabled', 'no' )); -- cgit v1.2.3