From: Jon goldberg Date: Tue, 28 Apr 2015 02:46:55 +0000 (-0600) Subject: CRM-13283 - Initial SystemCheckTest.php X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8ca6be76f12082e82ff44b1a9b6ac45edd327411;p=civicrm-core.git CRM-13283 - Initial SystemCheckTest.php --- diff --git a/tests/phpunit/api/v3/SystemCheckTest.php b/tests/phpunit/api/v3/SystemCheckTest.php new file mode 100644 index 0000000000..2dea601132 --- /dev/null +++ b/tests/phpunit/api/v3/SystemCheckTest.php @@ -0,0 +1,87 @@ +_apiversion = 3; + parent::setUp(); + $this->useTransaction(TRUE); + } + + /** + * Ensure that without any SystemPreference set, checkDefaultMailbox shows + * up. + */ + public function testSystemCheckBasic() { + $result = $this->callAPISuccess('System', 'check', array()); + foreach ($result['values'] as $check) { + if ($check['name'] == 'checkDefaultMailbox') { + $testedCheck = $check; + break; + } + } + $this->assertEquals($testedCheck['severity'], 'warning', ' in line ' . __LINE__); + } + + public function testSystemCheckHushForever() { + $this->_params = array( + 'name' => 'checkDefaultMailbox', + 'minimum_report_severity' => 4, + ); + $statusPreference = $this->callAPISuccess('StatusPreference', 'create', $this->_params); + $result = $this->callAPISuccess('System', 'check', array()); + foreach ($result['values'] as $check) { + if ($check['name'] == 'checkDefaultMailbox') { + $testedCheck = $check; + break; + } + } + fwrite(STDERR, print_r($result, TRUE)); + fwrite(STDERR, print_r($testedCheck, TRUE)); + $this->assertArrayNotHasKey('name', $testedCheck, 'warning', ' in line ' . __LINE__); + } + +}