getMessage()."\n"; $c = []; } unlink($f); check('dhcp-option keeps every comma separated value', ($c['dhcp-option']['option:dns-server'] ?? null) === '1.1.1.1,8.8.8.8'); check('dhcp-option without a comma does not warn', array_key_exists('3', $c['dhcp-option'] ?? [])); check('value-less option is an empty string', ($c['no-resolv'] ?? null) === ''); check('value is trimmed', ($c['domain'] ?? null) === 'lan'); check('long line is not split', strlen($c['dhcp-option']['option:domain-search'] ?? '') === 304); check('undefined ZM_PATH_DNSMASQ_CONF is not concatenated bare', strpos($view, '" . ZM_PATH_DNSMASQ_CONF') === false && !preg_match('/Debug\(.*["\x27]\s*\.\s*ZM_PATH_DNSMASQ_CONF/', $view)); check('dhcp-range is padded to three parts', strpos($view, 'array_pad(explode(\',\', $value), 3') !== false); check('ffmpeg monitors without a host are skipped', strpos($view, "isset(\$url_parts['host'])") !== false); check('lease expiry 0 is not formatted as a date', strpos($view, "\$lease['expiry'] == 0") !== false); check('generic option inputs are posted as config[]', strpos($view, 'name="dnsmasq_config[') === false); check('value-less options are saved without "="', strpos($save, "\$value === ''") !== false); echo "\n$tests tests, $failures failures\n"; exit($failures ? 1 : 0); }