From e67e2a85de7676857afa2a67d0a45e7743ff8014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Kolly?= Date: Sun, 28 Jul 2019 20:05:55 +0200 Subject: [PATCH] Implement test for Domain Zone CAA record --- install/froxlor.sql | 4 ++-- tests/DomainZones/DomainZonesTest.php | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/install/froxlor.sql b/install/froxlor.sql index f3cf318c..51ffe079 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -375,7 +375,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('admin', 'show_news_feed', '0'), ('admin', 'show_version_login', '0'), ('admin', 'show_version_footer', '0'), - ('caa', 'caa_entry', ''), + ('caa', 'caa_entry', ''), ('spf', 'use_spf', '0'), ('spf', 'spf_entry', '"v=spf1 a mx -all"'), ('dkim', 'dkim_algorithm', 'all'), @@ -562,7 +562,7 @@ opcache.interned_strings_buffer'), ('system', 'mod_fcgid_defaultini', '1'), ('system', 'ftpserver', 'proftpd'), ('system', 'dns_createmailentry', '0'), - ('system', 'dns_createcaaentry', '1'), + ('system', 'dns_createcaaentry', '1'), ('system', 'froxlordirectlyviahostname', '0'), ('system', 'report_enable', '1'), ('system', 'report_webmax', '90'), diff --git a/tests/DomainZones/DomainZonesTest.php b/tests/DomainZones/DomainZonesTest.php index fef9ba2f..03fe78d0 100644 --- a/tests/DomainZones/DomainZonesTest.php +++ b/tests/DomainZones/DomainZonesTest.php @@ -277,6 +277,30 @@ class DomainZonesTest extends TestCase DomainZones::getLocal($admin_userdata, $data)->add(); } + public function testAdminDomainZonesAddCAA() + { + global $admin_userdata; + + $data = [ + 'domainname' => 'test2.local', + 'record' => '@', + 'type' => 'CAA', + 'content' => '0 issue "letsencrypt.org"' + ]; + $json_result = DomainZones::getLocal($admin_userdata, $data)->add(); + $result = json_decode($json_result, true)['data']; + $this->assertTrue(count($result) > 1); + $found = false; + foreach ($result as $entry) { + if (substr($entry, strlen('0 issue "letsencrypt.org"') * - 1) == '0 issue "letsencrypt.org"') { + $found = true; + break; + } + } + $this->assertTrue($found); + $this->assertEquals('@ 18000 IN CAA 0 issue "letsencrypt.org"', $entry); + } + public function testAdminDomainZonesAddCname() { global $admin_userdata;