diff options
Diffstat (limited to 'tests/lib/UtilTest.php')
-rw-r--r-- | tests/lib/UtilTest.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 4c346b072f1..82897cbca29 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -90,9 +90,25 @@ class UtilTest extends \Test\TestCase { $this->assertEquals($expected, \OC_Util::fileInfoLoaded()); } + /** + * Host is "localhost" this is a valid for emails, + * but not for default strict email verification that requires a top level domain. + * So we check that with strict email verification we fallback to the default + */ + public function testGetDefaultEmailAddressStrict() { + $email = \OCP\Util::getDefaultEmailAddress("no-reply"); + $this->assertEquals('no-reply@localhost.localdomain', $email); + } + + /** + * If no strict email check is enabled "localhost" should validate as a valid email domain + */ public function testGetDefaultEmailAddress() { + $config = \OC::$server->getConfig(); + $config->setAppValue('core', 'enforce_strict_email_check', 'no'); $email = \OCP\Util::getDefaultEmailAddress("no-reply"); $this->assertEquals('no-reply@localhost', $email); + $config->deleteAppValue('core', 'enforce_strict_email_check'); } public function testGetDefaultEmailAddressFromConfig() { |