PHPIndex

This page lists files in the current directory. You can view content, get download/execute commands for Wget, Curl, or PowerShell, or filter the list using wildcards (e.g., `*.sh`).

app
cli
fixtures
lib
.gitignore
wget 'https://sme10.lists2.roe3.org/FreshRSS/tests/.gitignore'
View Content
phpunit.phar
README.md
wget 'https://sme10.lists2.roe3.org/FreshRSS/tests/README.md'
View Content
# FreshRSS tests

```sh
cd ./tests/
wget -O phpunit.phar https://phar.phpunit.de/phpunit-9.phar
php phpunit.phar --bootstrap bootstrap.php
```

The `shellchecks.sh` script is used to safeguard shell scripts from common
shell script bugs and to ensure a consistent style.
It requires [ShellCheck](https://www.shellcheck.net/) and [shfmt](https://github.com/mvdan/sh).
bootstrap.php
wget 'https://sme10.lists2.roe3.org/FreshRSS/tests/bootstrap.php'
View Content
<?php
declare(strict_types=1);
error_reporting(E_ALL);
ini_set('display_errors', '1');

const COPY_LOG_TO_SYSLOG = false;

require(__DIR__ . '/../constants.php');
require(LIB_PATH . '/lib_rss.php');	//Includes class autoloader
shellchecks.sh
wget 'https://sme10.lists2.roe3.org/FreshRSS/tests/shellchecks.sh'
View Content
#!/usr/bin/env bash
# Based on https://github.com/koreader/koreader/blob/master/.ci/helper_shellchecks.sh

ANSI_RED="\\033[31;1m"
ANSI_GREEN="\\033[32;1m"
ANSI_RESET="\\033[0m"

mapfile -t shellscript_locations < <({ git grep -lE '^#!(/usr)?/bin/(env )?(bash|sh)' && git ls-files ./*.sh; } | sort | uniq)

SHELLSCRIPT_ERROR=0

for shellscript in "${shellscript_locations[@]}"; do
	echo -e "${ANSI_GREEN}Running shellcheck on ${shellscript}"
	shellcheck "${shellscript}" || SHELLSCRIPT_ERROR=1
	echo -e "${ANSI_GREEN}Running shfmt on ${shellscript}"
	if ! shfmt "${shellscript}" >/dev/null 2>&1; then
		echo -e "${ANSI_RED}Warning: ${shellscript} contains the following problem:"
		shfmt "${shellscript}" || SHELLSCRIPT_ERROR=1
		continue
	fi
	if [ "$(cat "${shellscript}")" != "$(shfmt "${shellscript}")" ]; then
		echo -e "${ANSI_RED}Warning: ${shellscript} does not abide by coding style, diff for expected style:"
		shfmt "${shellscript}" | diff "${shellscript}" - || SHELLSCRIPT_ERROR=1
	fi
done

echo -ne "${ANSI_RESET}"

exit "${SHELLSCRIPT_ERROR}"