This commit is contained in:
Mike Macgirvin 2022-08-25 21:43:03 +10:00
parent dd0f43307c
commit 8803be2ca3
13 changed files with 224 additions and 516 deletions

View file

@ -48,7 +48,7 @@ class Url {
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_CAINFO, get_capath());
curl_setopt($ch, CURLOPT_CAINFO, self::get_capath());
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING, '');
@ -275,7 +275,7 @@ class Url {
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_CAINFO, get_capath());
curl_setopt($ch, CURLOPT_CAINFO, self::get_capath());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
@ -457,7 +457,15 @@ class Url {
return false;
}
/**
* @brief Returns path to CA file.
*
* @return string
*/
static public function get_capath()
{
return 'include/library/cacert.pem';
}
static public function format_error($ret, $verbose = false)
{

View file

@ -2,8 +2,6 @@
namespace Code\Lib;
use Code\Lib\Url;
/**
* @brief Fetch and return a webfinger for a resource
*
@ -12,7 +10,6 @@ use Code\Lib\Url;
*/
class Webfinger
{
private static $server = EMPTY_STR;
private static $resource = EMPTY_STR;
@ -99,7 +96,7 @@ class Webfinger
if (is_array($arr) && array_key_exists('links', $arr)) {
foreach ($arr['links'] as $link) {
if (array_key_exists('rel',$link) && in_array($link['rel'], [ PROTOCOL_NOMAD, PROTOCOL_ZOT6 ])) {
if (array_key_exists('href', $link) && $link['href'] !== EMPTY_STR) {
if (!empty($link['href'])) {
return $link['href'];
}
}

View file

@ -2398,15 +2398,6 @@ function construct_page() {
);
}
/**
* @brief Returns appplication root directory.
*
* @return string
*/
function appdirpath() {
return dirname(__FILE__);
}
/**
* @brief Set a pageicon.
*
@ -2421,7 +2412,7 @@ function head_set_icon($icon) {
/**
* @brief Get the pageicon.
*
* @return string absolut path to pageicon
* @return string absolute path to pageicon
*/
function head_get_icon() {

View file

@ -43,7 +43,7 @@
},
"require-dev" : {
"phpunit/phpunit" : "@stable",
"behat/behat" : "@stable",
"behat/behat" : "~3.11",
"behat/mink-extension": "@stable",
"behat/mink-goutte-driver": "@stable",
"php-mock/php-mock-phpunit": "@stable"

653
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,6 @@ use Code\Lib\Channel;
function get_help_fullpath($path, $suffix = null)
{
return find_docfile($path, App::$language);
}
@ -47,12 +46,6 @@ function find_docfile($name, $language)
*/
function get_help_content($tocpath = false)
{
$doctype = 'multicode';
$text = '';
$path = '';
if (argc() > 1) {
for ($x = 1; $x < argc(); $x++) {
@ -74,22 +67,6 @@ function get_help_content($tocpath = false)
return translate_projectname($content);
}
function preg_callback_help_include($matches)
{
if ($matches[1]) {
$include = str_replace($matches[0], load_doc_file($matches[1]), $matches[0]);
if (preg_match('/\.bb$/', $matches[1]) || preg_match('/\.txt$/', $matches[1])) {
require_once('include/bbcode.php');
$include = zidify_links(bbcode($include));
$include = str_replace(' target="_blank"', '', $include);
} elseif (preg_match('/\.md$/', $matches[1])) {
$include = MarkdownExtra::defaultTransform($include);
}
return $include;
}
}
/**
* @brief
*
@ -97,7 +74,6 @@ function preg_callback_help_include($matches)
*/
function determine_help_language()
{
require_once('library/text_languagedetect/Text/LanguageDetect.php');
$lang_detect = new Text_LanguageDetect();

View file

@ -49,7 +49,6 @@ function hubloc_store_lowlevel($arr)
function site_store_lowlevel($arr)
{
$store = [
'site_url' => ((array_key_exists('site_url', $arr)) ? $arr['site_url'] : ''),
'site_access' => ((array_key_exists('site_access', $arr)) ? $arr['site_access'] : 0),
@ -73,10 +72,6 @@ function site_store_lowlevel($arr)
return create_table_from_array('site', $store);
}
function prune_hub_reinstalls()
{
@ -303,13 +298,11 @@ function hubloc_delete($hubloc) {
function locations_by_netid($netid)
{
$locs = q(
"select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s' and hubloc_deleted = 0 and site_dead = 0",
dbesc($netid)
);
return array_elm_to_str($locs, 'location', ', ', 'trim_and_unpunify');
}
@ -333,7 +326,6 @@ function ping_site($url)
function get_hubloc_addrs_by_hash($hash)
{
return q(
"select hubloc_addr from hubloc where hubloc_hash = '%s' and hubloc_deleted = 0",
dbesc($hash)

View file

@ -23,15 +23,6 @@ use Code\Storage\Stdio;
* @brief Network related functions.
*/
/**
* @brief Returns path to CA file.
*
* @return string
*/
function get_capath()
{
return appdirpath() . '/library/cacert.pem';
}
function json_return_and_die($x, $content_type = 'application/json', $debug = false)

View file

@ -1,7 +1,7 @@
The folder tests/ contains resources for automated testing tools.
Here you will find PHPUnit, Behat, etc. files to test the functionaly
of Hubzilla. Right now it only contains some basic tests to see if feasable
of this software. Right now it only contains some basic tests to see if feasable
this can help improve the project.
# Contents

View file

@ -2,7 +2,7 @@ default:
suites:
default:
paths:
- %paths.base%/features
- '%paths.base%/features'
contexts:
- Behat\MinkExtension\Context\MinkContext
admin_features:
@ -11,7 +11,7 @@ default:
- AdminContext
api_features:
paths:
- %paths.base%/features/api
- '%paths.base%/features/api'
filters:
tags: "@api"
contexts:

View file

@ -15,4 +15,4 @@ Feature: Local login
When I fill in "id_username" with "behat"
And I fill in "id_password" with "behat"
And I press "submit"
Then I should be on "/apps"
Then I should be on "/stream"

View file

@ -7,7 +7,7 @@
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<testsuite name="Hubzilla default Test Suite">
<testsuite name="Default Test Suite">
<directory suffix="Test.php">./unit/</directory>
</testsuite>
<testsuite name="API Test Suite">

View file

@ -7,7 +7,7 @@
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<testsuite name="Hubzilla default Test Suite">
<testsuite name="Default Test Suite">
<directory suffix="Test.php">./unit/</directory>
</testsuite>
<testsuite name="API Test Suite">