Merge branch 'master' of github.com:Shaarli/Shaarli into upstream
This commit is contained in:
commit
6ca8ab31b2
131 changed files with 4833 additions and 2527 deletions
|
@ -4,7 +4,6 @@
|
|||
.github
|
||||
.gitattributes
|
||||
.gitignore
|
||||
.travis.yml
|
||||
tests
|
||||
|
||||
# Docker related resources are not needed inside the container
|
||||
|
|
99
.github/workflows/ci.yml
vendored
Normal file
99
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
name: Shaarli CI
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
php:
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
matrix:
|
||||
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
|
||||
name: PHP ${{ matrix.php-versions }}
|
||||
steps:
|
||||
- name: Set locales
|
||||
run: |
|
||||
sudo locale-gen de_DE.utf8 && \
|
||||
sudo locale-gen en_US.utf8 && \
|
||||
sudo locale-gen fr_FR.utf8 && \
|
||||
sudo dpkg-reconfigure --frontend=noninteractive locales
|
||||
|
||||
- name: Install Gettext
|
||||
run: sudo apt-get install gettext
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: gd, xml, curl, mbstring, intl, gettext
|
||||
tools: composer:v2
|
||||
|
||||
- name: Check PHP version
|
||||
run: php -v
|
||||
|
||||
- name: Setup Composer from PHP version + update
|
||||
run: composer config --unset platform && composer config platform.php ${{ matrix.php-versions }}
|
||||
|
||||
- name: Update dependencies for PHP 8.x
|
||||
if: ${{ matrix.php-versions == '8.0' || matrix.php-versions == '8.1' }}
|
||||
run: |
|
||||
composer update --ignore-platform-req=php && \
|
||||
composer remove --dev --ignore-platform-req=php phpunit/phpunit && \
|
||||
composer require --dev --ignore-platform-req=php phpunit/php-text-template ^2.0 && \
|
||||
composer require --dev --ignore-platform-req=php phpunit/phpunit ^9.0
|
||||
|
||||
- name: Update dependencies for PHP 7.x
|
||||
if: ${{ matrix.php-versions != '8.0' && matrix.php-versions != '8.1' }}
|
||||
run: composer update
|
||||
|
||||
- name: Clean up
|
||||
run: make clean
|
||||
|
||||
- name: Check permissions
|
||||
run: make check_permissions
|
||||
|
||||
- name: Run PHPCS
|
||||
run: make code_sniffer
|
||||
|
||||
- name: Run tests
|
||||
run: make all_tests
|
||||
|
||||
node:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '14.x'
|
||||
|
||||
- name: Yarn install
|
||||
run: yarn install
|
||||
|
||||
- name: Verify successful frontend builds
|
||||
run: yarn run build
|
||||
|
||||
- name: JS static analysis
|
||||
run: make eslint
|
||||
|
||||
- name: Linter for SASS syntax
|
||||
run: make sasslint
|
||||
|
||||
python:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
node-version: 3.8
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install mkdocs
|
||||
|
||||
- name: Build documentation
|
||||
run: mkdocs build --clean
|
25
.github/workflows/docker-latest.yml
vendored
Normal file
25
.github/workflows/docker-latest.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
name: Build/push Docker image (master/latest)
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
jobs:
|
||||
docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
tags: shaarli/shaarli:latest
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
31
.github/workflows/docker-tags.yml
vendored
Normal file
31
.github/workflows/docker-tags.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
name: Build/push Docker image (tags/releases)
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
branches:
|
||||
- "v*.*"
|
||||
- release
|
||||
jobs:
|
||||
docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get the tag name
|
||||
run: echo "REF=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
tags: shaarli/shaarli:${{ env.REF }}
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
68
.travis.yml
68
.travis.yml
|
@ -1,68 +0,0 @@
|
|||
dist: bionic
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# jobs for each supported php version
|
||||
- language: php
|
||||
php: nightly # PHP 8.0
|
||||
install:
|
||||
- composer self-update --2
|
||||
- composer update --ignore-platform-req=php
|
||||
- composer remove --dev --ignore-platform-req=php phpunit/phpunit
|
||||
- composer require --dev --ignore-platform-req=php phpunit/php-text-template ^2.0
|
||||
- composer require --dev --ignore-platform-req=php phpunit/phpunit ^9.0
|
||||
- language: php
|
||||
php: 7.4
|
||||
- language: php
|
||||
php: 7.3
|
||||
- language: php
|
||||
php: 7.2
|
||||
- language: php
|
||||
php: 7.1
|
||||
# jobs for frontend builds
|
||||
- language: node_js
|
||||
node_js: 10
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- $HOME/.cache/yarn
|
||||
install:
|
||||
- yarn install
|
||||
before_script:
|
||||
- PATH=${PATH//:\.\/node_modules\/\.bin/}
|
||||
script:
|
||||
- yarn run build # verify successful frontend builds
|
||||
- make eslint # javascript static analysis
|
||||
- make sasslint # linter for SASS syntax
|
||||
# jobs for documentation builds
|
||||
- language: python
|
||||
python: 3.6
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/pip
|
||||
install:
|
||||
- pip install mkdocs
|
||||
script:
|
||||
- mkdocs build --clean
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
before_install:
|
||||
# Disable xdebug: it significantly speed up tests and linter, and we don't use coverage yet
|
||||
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
|
||||
|
||||
install:
|
||||
# install/update composer and php dependencies
|
||||
- composer config --unset platform && composer config platform.php $TRAVIS_PHP_VERSION
|
||||
- composer update
|
||||
|
||||
before_script:
|
||||
- PATH=${PATH//:\.\/node_modules\/\.bin/}
|
||||
|
||||
script:
|
||||
- make clean
|
||||
- make check_permissions
|
||||
- make code_sniffer
|
||||
- make all_tests
|
|
@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
## [v0.12.2]() - UNRELEASED
|
||||
|
||||
> The `:master` Docker image is deprecated, please use `:latest` instead.
|
||||
> The `:stable` Docker image is deprecated, please use `:release` instead.
|
||||
|
||||
## [v0.12.1](https://github.com/shaarli/Shaarli/releases/tag/v0.12.0) - 2020-11-12
|
||||
|
||||
> nginx ([#1628](https://github.com/shaarli/Shaarli/pull/1628)) and Apache ([#1630](https://github.com/shaarli/Shaarli/pull/1630)) configurations have been reviewed. It is recommended that you
|
||||
|
|
|
@ -13,7 +13,7 @@ _It is designed to be personal (single-user), fast and handy._
|
|||
[![](https://img.shields.io/travis/shaarli/Shaarli/latest.svg?label=latest)](https://travis-ci.org/shaarli/Shaarli)
|
||||
•
|
||||
[![](https://img.shields.io/badge/master-v0.12.x-blue.svg)](https://github.com/shaarli/Shaarli)
|
||||
[![](https://img.shields.io/travis/shaarli/Shaarli.svg?label=master)](https://travis-ci.org/shaarli/Shaarli)
|
||||
[![](https://github.com/shaarli/Shaarli/actions/workflows/ci.yml/badge.svg)](https://github.com/shaarli/Shaarli/actions)
|
||||
|
||||
[![Join the chat at https://gitter.im/shaarli/Shaarli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shaarli/Shaarli)
|
||||
[![Bountysource](https://www.bountysource.com/badge/team?team_id=19583&style=bounties_received)](https://www.bountysource.com/teams/shaarli/issues)
|
||||
|
|
|
@ -187,6 +187,7 @@ class Languages
|
|||
'fr' => t('French'),
|
||||
'jp' => t('Japanese'),
|
||||
'ru' => t('Russian'),
|
||||
'zh_CN' => t('Chinese (Simplified)'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ class BookmarkFileService implements BookmarkServiceInterface
|
|||
$this->isLoggedIn = $isLoggedIn;
|
||||
|
||||
if (!$this->isLoggedIn && $this->conf->get('privacy.hide_public_links', false)) {
|
||||
$this->bookmarks = [];
|
||||
$this->bookmarks = new BookmarkArray();
|
||||
} else {
|
||||
try {
|
||||
$this->bookmarks = $this->bookmarksIO->read();
|
||||
|
|
|
@ -12,8 +12,8 @@ namespace Shaarli\Formatter;
|
|||
*/
|
||||
class BookmarkDefaultFormatter extends BookmarkFormatter
|
||||
{
|
||||
public const SEARCH_HIGHLIGHT_OPEN = '||O_HIGHLIGHT';
|
||||
public const SEARCH_HIGHLIGHT_CLOSE = '||C_HIGHLIGHT';
|
||||
public const SEARCH_HIGHLIGHT_OPEN = 'SHAARLI_O_HIGHLIGHT';
|
||||
public const SEARCH_HIGHLIGHT_CLOSE = 'SHAARLI_C_HIGHLIGHT';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
|
|
@ -71,5 +71,11 @@
|
|||
"Shaarli\\Updater\\": "application/updater",
|
||||
"Shaarli\\Updater\\Exception\\": "application/updater/exception"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Shaarli\\Tests\\": "tests",
|
||||
"Shaarli\\Tests\\Utils\\": "tests/utils"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
518
composer.lock
generated
518
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -2,7 +2,7 @@
|
|||
|
||||
{#
|
||||
The entry point for the ReadTheDocs Theme.
|
||||
|
||||
|
||||
Any theme customisations should override this file to redefine blocks defined in
|
||||
the various templates. The custom theme should only need to define a main.html
|
||||
which `{% extends "base.html" %}` and defines various blocks which will replace
|
||||
|
@ -14,7 +14,7 @@ the blocks defined in base.html and its included child templates.
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
{%- if 'media.readthedocs.org' not in config.extra_css[0] %}
|
||||
{%- if config.extra_css|length and 'media.readthedocs.org' not in config.extra_css[0] %}
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
{%- endif %}
|
||||
|
||||
|
|
|
@ -41,9 +41,10 @@ docker run hello-world
|
|||
|
||||
Shaarli images are available on [DockerHub](https://hub.docker.com/r/shaarli/shaarli/) `shaarli/shaarli`:
|
||||
|
||||
- `latest`: latest branch (last release)
|
||||
- `stable`: stable branch (last release in previous major version)
|
||||
- `master`: master branch (development branch)
|
||||
- `latest`: master (development) branch
|
||||
- `vX.Y.Z`: shaarli [releases](https://github.com/shaarli/Shaarli/releases)
|
||||
- `release`: always points to the last release
|
||||
- `stable` and `master`: **deprecated**. These tags are no longer maintained and may be removed without notice
|
||||
|
||||
These images are built automatically on DockerHub and rely on:
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ Usage of each plugin is documented in it's README file:
|
|||
* `archiveorg`: For each Shaare, add a link to the archived page on Archive.org
|
||||
* `default_colors`: Override default theme colors.
|
||||
* `isso`: Let visitor comment your shaares on permalinks with Isso.
|
||||
* [`markdown`](https://github.com/shaarli/Shaarli/blob/master/plugins/markdown/README.md): Render shaare description with Markdown syntax.
|
||||
* `piwik`: A plugin that adds Piwik tracking code to Shaarli pages.
|
||||
* [`playvideos`](https://github.com/shaarli/Shaarli/blob/master/plugins/playvideos/README.md): Add a button in the toolbar allowing to watch all videos.
|
||||
* `pubsubhubbub`: Enable PubSubHubbub feed publishing
|
||||
|
@ -59,4 +58,4 @@ Usage of each plugin is documented in it's README file:
|
|||
|
||||
### Third party plugins
|
||||
|
||||
See [Community & related software](https://shaarli.readthedocs.io/en/master/Community-and-Related-software/)
|
||||
See [Community & related software](https://shaarli.readthedocs.io/en/master/Community-and-related-software/)
|
||||
|
|
|
@ -118,6 +118,7 @@ http {
|
|||
ssl_certificate /path/to/certificate
|
||||
ssl_certificate_key /path/to/private/key
|
||||
|
||||
# if shaarli is installed in a subdirectory of the main domain, edit the location accordingly
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
|
|
@ -59,10 +59,15 @@ Extension | Required? | Usage
|
|||
[`php-json`](http://php.net/manual/en/book.json.php) | required | configuration parsing
|
||||
[`php-simplexml`](https://www.php.net/manual/en/book.simplexml.php) | required | REST API (Slim framework)
|
||||
[`php-mbstring`](http://php.net/manual/en/book.mbstring.php) | CentOS, Fedora, RHEL, Windows, some hosting providers | multibyte (Unicode) string support
|
||||
[`php-ctype`](https://www.php.net/manual/en/book.ctype.php) | required (bundled with most PHP installation) | Type checking
|
||||
[`php-iconv`](https://www.php.net/manual/en/book.iconv.php) | required (bundled with most PHP installation) | Character encoding used in translations
|
||||
[`php-session`](https://www.php.net/manual/en/book.session.php) | required (bundled with most PHP installation) | User session
|
||||
[`php-zlib`](https://www.php.net/manual/en/book.zlib.php) | required (bundled with most PHP installation) | Datastore I/O compression
|
||||
[`php-gd`](http://php.net/manual/en/book.image.php) | optional | required to use thumbnails
|
||||
[`php-intl`](http://php.net/manual/en/book.intl.php) | optional | localized text sorting (e.g. `e->è->f`)
|
||||
[`php-curl`](http://php.net/manual/en/book.curl.php) | optional | using cURL for fetching webpages and thumbnails in a more robust way
|
||||
[`php-gettext`](http://php.net/manual/en/book.gettext.php) | optional | Use the translation system in gettext mode (faster)
|
||||
[`php-ldap`](https://www.php.net/manual/en/book.ldap.php) | optional | LDAP login support
|
||||
|
||||
Some [plugins](Plugins.md) may require additional configuration.
|
||||
|
||||
|
@ -300,6 +305,7 @@ server {
|
|||
client_max_body_size 100m;
|
||||
|
||||
# relative path to shaarli from the root of the webserver
|
||||
# if shaarli is installed in a subdirectory of the main domain, edit the location accordingly
|
||||
location / {
|
||||
# default index file when no file URI is requested
|
||||
index index.php;
|
||||
|
|
|
@ -96,6 +96,14 @@ If you hosting provider only provides apache 2.2 and no support for `mod_version
|
|||
|
||||
Follow the instructions in the error message. Make sure you are accessing shaarli via a direct IP address or a proper hostname. If you have **no dots** in the hostname (e.g. `localhost` or `http://my-webserver/shaarli/`), some browsers will not store cookies at all (this respects the [HTTP cookie specification](http://curl.haxx.se/rfc/cookie_spec.html)).
|
||||
|
||||
|
||||
### Error 406 "Not acceptable"
|
||||
|
||||
If attempting to save a link results in a `Not acceptable` error (HTTP status code of `406`), it is likely due to strict settings for `mod_security` (a module used with Apache). This cannot be mitigated by reconfiguring Shaarli itself, and must be dealt with at the level of the underlying web server instead.
|
||||
|
||||
On some shared hosting services (such as **Bluehost**), `mod_security` is enabled by default, so the recommended course of action is to get in touch with the helpdesk and ask them to disable `mod_security` for your domain, sub-domain, or the subdirectory where Shaarli is installed. Ideally, you want to narrow it down to a very specific location, so as to continue reaping the benefits of `mod_security` elsewhere on your domain. If asked for specific, you can refer support staff to this [issue](https://github.com/shaarli/Shaarli/issues/1736), where more technical details are available.
|
||||
|
||||
|
||||
----------------------------------------------------------
|
||||
|
||||
## Upgrades
|
||||
|
@ -164,7 +172,7 @@ You can use the third-party tool [Derefind](https://github.com/ShawnPConroy/Dere
|
|||
|
||||
### The bookmarklet doesn't work
|
||||
|
||||
Websites which enforce Content Security Policy (CSP), such as github.com, disallow usage of bookmarklets. Unfortunately, there is nothing Shaarli can do about it ([1](https://github.com/shaarli/Shaarli/issues/196), [2](https://bugzilla.mozilla.org/show_bug.cgi?id=866522), [3](https://code.google.com/p/chromium/issues/detail?id=233903).
|
||||
Some websites may disallow usage of bookmarklets through [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP). Unfortunately, there is nothing Shaarli can do about it ([1](https://github.com/shaarli/Shaarli/issues/196), [2](https://bugzilla.mozilla.org/show_bug.cgi?id=866522), [3](https://code.google.com/p/chromium/issues/detail?id=233903).
|
||||
|
||||
Under Opera, you can't drag'n drop the button: You have to right-click on it and add a bookmark to your personal toolbar.
|
||||
|
||||
|
|
|
@ -143,17 +143,19 @@ A [`Makefile`](https://github.com/shaarli/Shaarli/blob/master/Makefile) is avail
|
|||
|
||||
### Continuous Integration
|
||||
|
||||
[Travis CI](http://docs.travis-ci.com/) is a Continuous Integration build server, that runs a build:
|
||||
[Github Actions](https://github.com/shaarli/Shaarli/actions) is a Continuous Integration build server, that runs a build:
|
||||
|
||||
- each time a commit is merged to the mainline (`master` branch)
|
||||
- each time a commit is pushed to any branch
|
||||
- each time a Pull Request is submitted or updated
|
||||
|
||||
After all jobs have finished, Travis returns the results to GitHub:
|
||||
After all jobs have finished, Github Actions returns the results to GitHub:
|
||||
|
||||
- a status icon represents the result for the `master` branch: [![](https://api.travis-ci.org/shaarli/Shaarli.svg)](https://travis-ci.org/shaarli/Shaarli)
|
||||
- Pull Requests are updated with the Travis build result.
|
||||
- a status icon represents the result for the `master` branch: [![Build Status](https://github.com/shaarli/Shaarli/actions/workflows/ci.yml/badge.svg)](https://github.com/shaarli/Shaarli/actions)
|
||||
- Pull Requests are updated with the Github Actions build result.
|
||||
|
||||
See [`.travis.yml`](https://github.com/shaarli/Shaarli/blob/master/.travis.yml).
|
||||
Github Actions is also used to build and push [Docker](../Docker.md) images to <https://hub.docker.com/r/shaarli/shaarli> for the `master` branch and on every git `tag`/[release](https://github.com/shaarli/Shaarli/releases).
|
||||
|
||||
See [`.github/workflows/`](https://github.com/shaarli/Shaarli/tree/master/.github/workflows).
|
||||
|
||||
|
||||
### Documentation
|
||||
|
@ -169,13 +171,11 @@ Patches should try to stick to the [PHP Standard Recommendations](http://www.php
|
|||
- [PSR-2](http://www.php-fig.org/psr/psr-2/) - Coding Style Guide
|
||||
- [PSR-12](http://www.php-fig.org/psr/psr-12/) - Extended Coding Style Guide
|
||||
|
||||
These are enforced on pull requests using our Continuous Integration tools.
|
||||
These are enforced on pull requests using our Continuous Integration tools with [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer).
|
||||
|
||||
**Work in progress:** Static analysis is currently being discussed here: in [#95 - Fix coding style (static analysis)](https://github.com/shaarli/Shaarli/issues/95), [#130 - Continuous Integration tools & features](https://github.com/shaarli/Shaarli/issues/130)
|
||||
|
||||
Static analysis tools can be installed with Composer, and used through Shaarli's [Makefile](https://github.com/shaarli/Shaarli/blob/master/Makefile).
|
||||
Static analysis tools are installed with Composer dependencies, and used through Shaarli's [Makefile](https://github.com/shaarli/Shaarli/blob/master/Makefile) with `make code_sniffer`.
|
||||
|
||||
For an overview of the available features, see:
|
||||
|
||||
- [Code quality: Makefile to run static code checkers](https://github.com/shaarli/Shaarli/pull/124) (#124)
|
||||
- [Run PHPCS against different coding standards](https://github.com/shaarli/Shaarli/pull/276) (#276)
|
||||
- [Apply PHP Code Sniffer to Shaarli code base](https://github.com/shaarli/Shaarli/pull/1635) (#1635)
|
||||
|
|
|
@ -60,6 +60,7 @@ Shaarli can be used:
|
|||
- Easily extensible by any client using the [REST API](REST-API.md) exposed by Shaarli
|
||||
- Bookmarklet and [other tools](Community-and-related-software.md) to share links in one click
|
||||
- Responsive/support for mobile browsers, degrades gracefully with Javascript disabled
|
||||
- LDAP (single-user) login support
|
||||
|
||||
|
||||
### Easy setup
|
||||
|
|
|
@ -624,7 +624,7 @@ msgstr "Bildwand ist nicht verfügbar (Miniaturansichten sind deaktiviert)."
|
|||
|
||||
#: application/front/exceptions/WrongTokenException.php:16
|
||||
msgid "Wrong token."
|
||||
msgstr "Falsches Zeichen."
|
||||
msgstr "Falsches Token."
|
||||
|
||||
#: application/helper/ApplicationUtils.php:165
|
||||
#, php-format
|
||||
|
|
|
@ -2,8 +2,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: Shaarli\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-10-19 10:19+0900\n"
|
||||
"PO-Revision-Date: 2021-01-04 18:54+0900\n"
|
||||
"POT-Creation-Date: 2021-04-04 11:29+0900\n"
|
||||
"PO-Revision-Date: 2021-04-04 13:20+0900\n"
|
||||
"Last-Translator: yude <yudesleepy@gmail.com>\n"
|
||||
"Language-Team: Shaarli\n"
|
||||
"Language: ja\n"
|
||||
|
@ -19,61 +19,38 @@ msgstr ""
|
|||
"X-Poedit-SearchPathExcluded-0: node_modules\n"
|
||||
"X-Poedit-SearchPathExcluded-1: vendor\n"
|
||||
|
||||
#: application/ApplicationUtils.php:161
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Your PHP version is obsolete! Shaarli requires at least PHP %s, and thus "
|
||||
"cannot run. Your PHP version has known security vulnerabilities and should "
|
||||
"be updated as soon as possible."
|
||||
msgstr ""
|
||||
"使用している PHP のバージョンが古すぎます! Shaarli の実行には最低でも PHP %s "
|
||||
"が必要です。 現在使用している PHP のバージョンには脆弱性があり、できるだけ速"
|
||||
"やかにアップデートするべきです。"
|
||||
|
||||
#: application/ApplicationUtils.php:192 application/ApplicationUtils.php:204
|
||||
msgid "directory is not readable"
|
||||
msgstr "ディレクトリを読み込めません"
|
||||
|
||||
#: application/ApplicationUtils.php:207
|
||||
msgid "directory is not writable"
|
||||
msgstr "ディレクトリに書き込めません"
|
||||
|
||||
#: application/ApplicationUtils.php:225
|
||||
msgid "file is not readable"
|
||||
msgstr "ファイルを読み取る権限がありません"
|
||||
|
||||
#: application/ApplicationUtils.php:228
|
||||
msgid "file is not writable"
|
||||
msgstr "ファイルを書き込む権限がありません"
|
||||
|
||||
#: application/History.php:179
|
||||
#: application/History.php:181
|
||||
msgid "History file isn't readable or writable"
|
||||
msgstr "履歴ファイルを読み込む、または書き込むための権限がありません"
|
||||
|
||||
#: application/History.php:190
|
||||
#: application/History.php:192
|
||||
msgid "Could not parse history file"
|
||||
msgstr "履歴ファイルを正常に復元できませんでした"
|
||||
|
||||
#: application/Languages.php:181
|
||||
#: application/Languages.php:184
|
||||
msgid "Automatic"
|
||||
msgstr "自動"
|
||||
|
||||
#: application/Languages.php:182
|
||||
#: application/Languages.php:185
|
||||
msgid "German"
|
||||
msgstr "ドイツ語"
|
||||
|
||||
#: application/Languages.php:183
|
||||
#: application/Languages.php:186
|
||||
msgid "English"
|
||||
msgstr "英語"
|
||||
|
||||
#: application/Languages.php:184
|
||||
#: application/Languages.php:187
|
||||
msgid "French"
|
||||
msgstr "フランス語"
|
||||
|
||||
#: application/Languages.php:185
|
||||
#: application/Languages.php:188
|
||||
msgid "Japanese"
|
||||
msgstr "日本語"
|
||||
|
||||
#: application/Languages.php:189
|
||||
msgid "Russian"
|
||||
msgstr "ロシア語"
|
||||
|
||||
#: application/Thumbnailer.php:62
|
||||
msgid ""
|
||||
"php-gd extension must be loaded to use thumbnails. Thumbnails are now "
|
||||
|
@ -82,49 +59,49 @@ msgstr ""
|
|||
"サムネイルを使用するには、php-gd 拡張機能が読み込まれている必要があります。サ"
|
||||
"ムネイルは無効化されました。ページを再読込してください。"
|
||||
|
||||
#: application/Utils.php:383 tests/UtilsTest.php:343
|
||||
#: application/Utils.php:406 tests/UtilsTest.php:327
|
||||
msgid "Setting not set"
|
||||
msgstr "未設定"
|
||||
|
||||
#: application/Utils.php:390 tests/UtilsTest.php:341 tests/UtilsTest.php:342
|
||||
#: application/Utils.php:413 tests/UtilsTest.php:325 tests/UtilsTest.php:326
|
||||
msgid "Unlimited"
|
||||
msgstr "無制限"
|
||||
|
||||
#: application/Utils.php:393 tests/UtilsTest.php:338 tests/UtilsTest.php:339
|
||||
#: tests/UtilsTest.php:353
|
||||
#: application/Utils.php:416 tests/UtilsTest.php:322 tests/UtilsTest.php:323
|
||||
#: tests/UtilsTest.php:337
|
||||
msgid "B"
|
||||
msgstr "B"
|
||||
|
||||
#: application/Utils.php:393 tests/UtilsTest.php:332 tests/UtilsTest.php:333
|
||||
#: tests/UtilsTest.php:340
|
||||
#: application/Utils.php:416 tests/UtilsTest.php:316 tests/UtilsTest.php:317
|
||||
#: tests/UtilsTest.php:324
|
||||
msgid "kiB"
|
||||
msgstr "kiB"
|
||||
|
||||
#: application/Utils.php:393 tests/UtilsTest.php:334 tests/UtilsTest.php:335
|
||||
#: tests/UtilsTest.php:351 tests/UtilsTest.php:352
|
||||
#: application/Utils.php:416 tests/UtilsTest.php:318 tests/UtilsTest.php:319
|
||||
#: tests/UtilsTest.php:335 tests/UtilsTest.php:336
|
||||
msgid "MiB"
|
||||
msgstr "MiB"
|
||||
|
||||
#: application/Utils.php:393 tests/UtilsTest.php:336 tests/UtilsTest.php:337
|
||||
#: application/Utils.php:416 tests/UtilsTest.php:320 tests/UtilsTest.php:321
|
||||
msgid "GiB"
|
||||
msgstr "GiB"
|
||||
|
||||
#: application/bookmark/BookmarkFileService.php:180
|
||||
#: application/bookmark/BookmarkFileService.php:202
|
||||
#: application/bookmark/BookmarkFileService.php:224
|
||||
#: application/bookmark/BookmarkFileService.php:238
|
||||
#: application/bookmark/BookmarkFileService.php:203
|
||||
#: application/bookmark/BookmarkFileService.php:225
|
||||
#: application/bookmark/BookmarkFileService.php:247
|
||||
#: application/bookmark/BookmarkFileService.php:261
|
||||
msgid "You're not authorized to alter the datastore"
|
||||
msgstr "設定を変更する権限がありません"
|
||||
|
||||
#: application/bookmark/BookmarkFileService.php:205
|
||||
#: application/bookmark/BookmarkFileService.php:228
|
||||
msgid "This bookmarks already exists"
|
||||
msgstr "このブックマークは既に存在します"
|
||||
|
||||
#: application/bookmark/BookmarkInitializer.php:39
|
||||
#: application/bookmark/BookmarkInitializer.php:42
|
||||
msgid "(private bookmark with thumbnail demo)"
|
||||
msgstr "(サムネイルデモが付属しているプライベートブックマーク)"
|
||||
|
||||
#: application/bookmark/BookmarkInitializer.php:42
|
||||
#: application/bookmark/BookmarkInitializer.php:45
|
||||
msgid ""
|
||||
"Shaarli will automatically pick up the thumbnail for links to a variety of "
|
||||
"websites.\n"
|
||||
|
@ -146,11 +123,11 @@ msgstr ""
|
|||
"\n"
|
||||
"今から、既定の shaares を編集したり、削除したりすることができます。\n"
|
||||
|
||||
#: application/bookmark/BookmarkInitializer.php:55
|
||||
#: application/bookmark/BookmarkInitializer.php:58
|
||||
msgid "Note: Shaare descriptions"
|
||||
msgstr "説明: Shaare の概要"
|
||||
|
||||
#: application/bookmark/BookmarkInitializer.php:57
|
||||
#: application/bookmark/BookmarkInitializer.php:60
|
||||
msgid ""
|
||||
"Adding a shaare without entering a URL creates a text-only \"note\" post "
|
||||
"such as this one.\n"
|
||||
|
@ -214,14 +191,14 @@ msgstr ""
|
|||
"| レモン | 果物 | 黄 | 30 |\n"
|
||||
"| 人参 | 野菜 | 赤 | 14 |\n"
|
||||
|
||||
#: application/bookmark/BookmarkInitializer.php:91
|
||||
#: application/bookmark/BookmarkInitializer.php:94
|
||||
#: application/legacy/LegacyLinkDB.php:246
|
||||
msgid ""
|
||||
"The personal, minimalist, super-fast, database free, bookmarking service"
|
||||
msgstr ""
|
||||
"個人向けの、ミニマムで高速でかつデータベースのいらないブックマークサービス"
|
||||
|
||||
#: application/bookmark/BookmarkInitializer.php:94
|
||||
#: application/bookmark/BookmarkInitializer.php:97
|
||||
msgid ""
|
||||
"Welcome to Shaarli!\n"
|
||||
"\n"
|
||||
|
@ -269,11 +246,11 @@ msgstr ""
|
|||
"何か問題に遭遇したり、提案があれば、気軽に [Issue](https://github.com/"
|
||||
"shaarli/Shaarli/issues) を開いてください。\n"
|
||||
|
||||
#: application/bookmark/exception/BookmarkNotFoundException.php:13
|
||||
#: application/bookmark/exception/BookmarkNotFoundException.php:14
|
||||
msgid "The link you are trying to reach does not exist or has been deleted."
|
||||
msgstr "開こうとしたリンクは存在しないか、削除されています。"
|
||||
|
||||
#: application/config/ConfigJson.php:52 application/config/ConfigPhp.php:129
|
||||
#: application/config/ConfigJson.php:52 application/config/ConfigPhp.php:131
|
||||
msgid ""
|
||||
"Shaarli could not create the config file. Please make sure Shaarli has the "
|
||||
"right to write in the folder is it installed in."
|
||||
|
@ -282,13 +259,13 @@ msgstr ""
|
|||
"ていて、インストールされているディレクトリに書き込みできることを確認してくだ"
|
||||
"さい。"
|
||||
|
||||
#: application/config/ConfigManager.php:136
|
||||
#: application/config/ConfigManager.php:163
|
||||
#: application/config/ConfigManager.php:137
|
||||
#: application/config/ConfigManager.php:164
|
||||
msgid "Invalid setting key parameter. String expected, got: "
|
||||
msgstr ""
|
||||
"不正なキーの値です。文字列が想定されていますが、次のように入力されました: "
|
||||
|
||||
#: application/config/exception/MissingFieldConfigException.php:21
|
||||
#: application/config/exception/MissingFieldConfigException.php:20
|
||||
#, php-format
|
||||
msgid "Configuration value is required for %s"
|
||||
msgstr "%s には設定が必要です"
|
||||
|
@ -297,42 +274,43 @@ msgstr "%s には設定が必要です"
|
|||
msgid "An error occurred while trying to save plugins loading order."
|
||||
msgstr "プラグインの読込順を変更する際にエラーが発生しました。"
|
||||
|
||||
#: application/config/exception/UnauthorizedConfigException.php:16
|
||||
#: application/config/exception/UnauthorizedConfigException.php:15
|
||||
msgid "You are not authorized to alter config."
|
||||
msgstr "設定を変更する権限がありません。"
|
||||
|
||||
#: application/exceptions/IOException.php:22
|
||||
#: application/exceptions/IOException.php:23
|
||||
msgid "Error accessing"
|
||||
msgstr "読込中にエラーが発生しました"
|
||||
|
||||
#: application/feed/FeedBuilder.php:179
|
||||
#: application/feed/FeedBuilder.php:174
|
||||
msgid "Direct link"
|
||||
msgstr "ダイレクトリンク"
|
||||
|
||||
#: application/feed/FeedBuilder.php:181
|
||||
#: application/feed/FeedBuilder.php:176
|
||||
msgid "Permalink"
|
||||
msgstr "パーマリンク"
|
||||
|
||||
#: application/front/controller/admin/ConfigureController.php:54
|
||||
#: application/front/controller/admin/ConfigureController.php:56
|
||||
msgid "Configure"
|
||||
msgstr "設定"
|
||||
|
||||
#: application/front/controller/admin/ConfigureController.php:102
|
||||
#: application/legacy/LegacyUpdater.php:537
|
||||
#: application/front/controller/admin/ConfigureController.php:106
|
||||
#: application/legacy/LegacyUpdater.php:539
|
||||
msgid "You have enabled or changed thumbnails mode."
|
||||
msgstr "サムネイルのモードを有効化、または変更しました。"
|
||||
|
||||
#: application/front/controller/admin/ConfigureController.php:103
|
||||
#: application/legacy/LegacyUpdater.php:538
|
||||
#: application/front/controller/admin/ConfigureController.php:108
|
||||
#: application/front/controller/admin/ServerController.php:81
|
||||
#: application/legacy/LegacyUpdater.php:540
|
||||
msgid "Please synchronize them."
|
||||
msgstr "それらを同期してください。"
|
||||
|
||||
#: application/front/controller/admin/ConfigureController.php:113
|
||||
#: application/front/controller/visitor/InstallController.php:136
|
||||
#: application/front/controller/admin/ConfigureController.php:119
|
||||
#: application/front/controller/visitor/InstallController.php:154
|
||||
msgid "Error while writing config file after configuration update."
|
||||
msgstr "設定ファイルを更新した後の書き込みに失敗しました。"
|
||||
|
||||
#: application/front/controller/admin/ConfigureController.php:122
|
||||
#: application/front/controller/admin/ConfigureController.php:128
|
||||
msgid "Configuration was saved."
|
||||
msgstr "設定は保存されました。"
|
||||
|
||||
|
@ -362,61 +340,42 @@ msgstr ""
|
|||
"ルサイズ (%s) よりも大きいです。もう少し小さいものをアップロードしてくださ"
|
||||
"い。"
|
||||
|
||||
#: application/front/controller/admin/ManageShaareController.php:29
|
||||
msgid "Shaare a new link"
|
||||
msgstr "新しいリンクを追加"
|
||||
#: application/front/controller/admin/ManageTagController.php:30
|
||||
msgid "whitespace"
|
||||
msgstr "空白"
|
||||
|
||||
#: application/front/controller/admin/ManageShaareController.php:78
|
||||
msgid "Note: "
|
||||
msgstr "注: "
|
||||
|
||||
#: application/front/controller/admin/ManageShaareController.php:109
|
||||
#: application/front/controller/admin/ManageShaareController.php:206
|
||||
#: application/front/controller/admin/ManageShaareController.php:275
|
||||
#: application/front/controller/admin/ManageShaareController.php:315
|
||||
#, php-format
|
||||
msgid "Bookmark with identifier %s could not be found."
|
||||
msgstr "%s という識別子を持ったブックマークは見つかりませんでした。"
|
||||
|
||||
#: application/front/controller/admin/ManageShaareController.php:194
|
||||
#: application/front/controller/admin/ManageShaareController.php:252
|
||||
msgid "Invalid bookmark ID provided."
|
||||
msgstr "不正なブックマーク ID が入力されました。"
|
||||
|
||||
#: application/front/controller/admin/ManageShaareController.php:260
|
||||
msgid "Invalid visibility provided."
|
||||
msgstr "不正な公開設定が入力されました。"
|
||||
|
||||
#: application/front/controller/admin/ManageShaareController.php:363
|
||||
msgid "Edit"
|
||||
msgstr "共有"
|
||||
|
||||
#: application/front/controller/admin/ManageShaareController.php:366
|
||||
msgid "Shaare"
|
||||
msgstr "Shaare"
|
||||
|
||||
#: application/front/controller/admin/ManageTagController.php:29
|
||||
#: application/front/controller/admin/ManageTagController.php:35
|
||||
msgid "Manage tags"
|
||||
msgstr "タグを設定"
|
||||
|
||||
#: application/front/controller/admin/ManageTagController.php:48
|
||||
#: application/front/controller/admin/ManageTagController.php:54
|
||||
msgid "Invalid tags provided."
|
||||
msgstr "不正なタグが入力されました。"
|
||||
|
||||
#: application/front/controller/admin/ManageTagController.php:72
|
||||
#: application/front/controller/admin/ManageTagController.php:81
|
||||
#, php-format
|
||||
msgid "The tag was removed from %d bookmark."
|
||||
msgid_plural "The tag was removed from %d bookmarks."
|
||||
msgstr[0] "%d 件のリンクからタグが削除されました。"
|
||||
msgstr[1] "%d 件のリンクからタグが削除されました。"
|
||||
|
||||
#: application/front/controller/admin/ManageTagController.php:77
|
||||
#: application/front/controller/admin/ManageTagController.php:86
|
||||
#, php-format
|
||||
msgid "The tag was renamed in %d bookmark."
|
||||
msgid_plural "The tag was renamed in %d bookmarks."
|
||||
msgstr[0] "このタグを持つ %d 件のリンクにおいて、名前が変更されました。"
|
||||
msgstr[1] "このタグを持つ %d 件のリンクにおいて、名前が変更されました。"
|
||||
|
||||
#: application/front/controller/admin/ManageTagController.php:108
|
||||
msgid "Tags separator must be a single character."
|
||||
msgstr "タグを分離する文字は1つでなければいけません。"
|
||||
|
||||
#: application/front/controller/admin/ManageTagController.php:114
|
||||
msgid "These characters are reserved and can't be used as tags separator: "
|
||||
msgstr ""
|
||||
"それらの文字は予約文字であり、タグを分離するための文字として使うことはできま"
|
||||
"せん: "
|
||||
|
||||
#: application/front/controller/admin/PasswordController.php:28
|
||||
msgid "Change password"
|
||||
msgstr "パスワードを変更"
|
||||
|
@ -447,6 +406,55 @@ msgstr "設定が正常に保存されました。"
|
|||
msgid "Error while saving plugin configuration: "
|
||||
msgstr "プラグインの設定ファイルを保存するときにエラーが発生しました: "
|
||||
|
||||
#: application/front/controller/admin/ServerController.php:35
|
||||
msgid "Check disabled"
|
||||
msgstr "無効になっている項目をチェック"
|
||||
|
||||
#: application/front/controller/admin/ServerController.php:62
|
||||
msgid "Server administration"
|
||||
msgstr "サーバー管理"
|
||||
|
||||
#: application/front/controller/admin/ServerController.php:79
|
||||
msgid "Thumbnails cache has been cleared."
|
||||
msgstr "サムネイルのキャッシュがクリアされました。"
|
||||
|
||||
#: application/front/controller/admin/ServerController.php:90
|
||||
msgid "Shaarli's cache folder has been cleared!"
|
||||
msgstr "Shaarli のキャッシュのフォルダーがクリアされました!"
|
||||
|
||||
#: application/front/controller/admin/ShaareAddController.php:26
|
||||
msgid "Shaare a new link"
|
||||
msgstr "新しいリンクを追加"
|
||||
|
||||
#: application/front/controller/admin/ShaareManageController.php:35
|
||||
#: application/front/controller/admin/ShaareManageController.php:97
|
||||
msgid "Invalid bookmark ID provided."
|
||||
msgstr "不正なブックマーク ID が入力されました。"
|
||||
|
||||
#: application/front/controller/admin/ShaareManageController.php:47
|
||||
#: application/front/controller/admin/ShaareManageController.php:120
|
||||
#: application/front/controller/admin/ShaareManageController.php:160
|
||||
#: application/front/controller/admin/ShaarePublishController.php:82
|
||||
#, php-format
|
||||
msgid "Bookmark with identifier %s could not be found."
|
||||
msgstr "%s という識別子を持ったブックマークは見つかりませんでした。"
|
||||
|
||||
#: application/front/controller/admin/ShaareManageController.php:105
|
||||
msgid "Invalid visibility provided."
|
||||
msgstr "不正な公開設定が入力されました。"
|
||||
|
||||
#: application/front/controller/admin/ShaarePublishController.php:173
|
||||
msgid "Edit"
|
||||
msgstr "共有"
|
||||
|
||||
#: application/front/controller/admin/ShaarePublishController.php:176
|
||||
msgid "Shaare"
|
||||
msgstr "Shaare"
|
||||
|
||||
#: application/front/controller/admin/ShaarePublishController.php:208
|
||||
msgid "Note: "
|
||||
msgstr "注: "
|
||||
|
||||
#: application/front/controller/admin/ThumbnailsController.php:37
|
||||
msgid "Thumbnails update"
|
||||
msgstr "サムネイルの更新"
|
||||
|
@ -455,23 +463,44 @@ msgstr "サムネイルの更新"
|
|||
msgid "Tools"
|
||||
msgstr "ツール"
|
||||
|
||||
#: application/front/controller/visitor/BookmarkListController.php:116
|
||||
#: application/front/controller/visitor/BookmarkListController.php:103
|
||||
msgid "Search: "
|
||||
msgstr "検索: "
|
||||
|
||||
#: application/front/controller/visitor/DailyController.php:45
|
||||
msgid "Today"
|
||||
msgstr "今日"
|
||||
#: application/front/controller/visitor/DailyController.php:201
|
||||
msgid "day"
|
||||
msgstr "日"
|
||||
|
||||
#: application/front/controller/visitor/DailyController.php:47
|
||||
msgid "Yesterday"
|
||||
msgstr "昨日"
|
||||
|
||||
#: application/front/controller/visitor/DailyController.php:85
|
||||
#: application/front/controller/visitor/DailyController.php:201
|
||||
#: application/front/controller/visitor/DailyController.php:204
|
||||
msgid "Daily"
|
||||
msgstr "デイリー"
|
||||
|
||||
#: application/front/controller/visitor/ErrorController.php:36
|
||||
#: application/front/controller/visitor/DailyController.php:202
|
||||
msgid "week"
|
||||
msgstr "週"
|
||||
|
||||
#: application/front/controller/visitor/DailyController.php:202
|
||||
msgid "Weekly"
|
||||
msgstr "週間"
|
||||
|
||||
#: application/front/controller/visitor/DailyController.php:203
|
||||
msgid "month"
|
||||
msgstr "月"
|
||||
|
||||
#: application/front/controller/visitor/DailyController.php:203
|
||||
msgid "Monthly"
|
||||
msgstr "月間"
|
||||
|
||||
#: application/front/controller/visitor/ErrorController.php:30
|
||||
msgid "Error: "
|
||||
msgstr "エラー: "
|
||||
|
||||
#: application/front/controller/visitor/ErrorController.php:34
|
||||
msgid "Please report it on Github."
|
||||
msgstr "GitHub で報告してください。"
|
||||
|
||||
#: application/front/controller/visitor/ErrorController.php:39
|
||||
msgid "An unexpected error occurred."
|
||||
msgstr "予期しないエラーが発生しました。"
|
||||
|
||||
|
@ -479,7 +508,11 @@ msgstr "予期しないエラーが発生しました。"
|
|||
msgid "Requested page could not be found."
|
||||
msgstr "リクエストされたページは存在しません。"
|
||||
|
||||
#: application/front/controller/visitor/InstallController.php:73
|
||||
#: application/front/controller/visitor/InstallController.php:70
|
||||
msgid "Install Shaarli"
|
||||
msgstr "Shaarli をインストール"
|
||||
|
||||
#: application/front/controller/visitor/InstallController.php:90
|
||||
#, php-format
|
||||
msgid ""
|
||||
"<pre>Sessions do not seem to work correctly on your server.<br>Make sure the "
|
||||
|
@ -497,14 +530,14 @@ msgstr ""
|
|||
"ります。IP アドレスや完全なドメイン名でサーバーにアクセスすることをおすすめし"
|
||||
"ます。<br>"
|
||||
|
||||
#: application/front/controller/visitor/InstallController.php:144
|
||||
#: application/front/controller/visitor/InstallController.php:162
|
||||
msgid ""
|
||||
"Shaarli is now configured. Please login and start shaaring your bookmarks!"
|
||||
msgstr ""
|
||||
"Shaarli の設定が完了しました。ログインして、あなたのブックマークを登録しま"
|
||||
"しょう!"
|
||||
|
||||
#: application/front/controller/visitor/InstallController.php:158
|
||||
#: application/front/controller/visitor/InstallController.php:176
|
||||
msgid "Insufficient permissions:"
|
||||
msgstr "権限がありません:"
|
||||
|
||||
|
@ -520,7 +553,7 @@ msgstr "不正なユーザー名、またはパスワードです。"
|
|||
msgid "Picture wall"
|
||||
msgstr "ピクチャウォール"
|
||||
|
||||
#: application/front/controller/visitor/TagCloudController.php:88
|
||||
#: application/front/controller/visitor/TagCloudController.php:90
|
||||
msgid "Tag "
|
||||
msgstr "タグ "
|
||||
|
||||
|
@ -547,6 +580,94 @@ msgstr "ピクチャ ウォールは利用できません (サムネイルが無
|
|||
msgid "Wrong token."
|
||||
msgstr "不正なトークンです。"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:165
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Your PHP version is obsolete! Shaarli requires at least PHP %s, and thus "
|
||||
"cannot run. Your PHP version has known security vulnerabilities and should "
|
||||
"be updated as soon as possible."
|
||||
msgstr ""
|
||||
"使用している PHP のバージョンが古すぎます! Shaarli の実行には最低でも PHP %s "
|
||||
"が必要です。 現在使用している PHP のバージョンには脆弱性があり、できるだけ速"
|
||||
"やかにアップデートするべきです。"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:200
|
||||
#: application/helper/ApplicationUtils.php:220
|
||||
msgid "directory is not readable"
|
||||
msgstr "ディレクトリを読み込めません"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:223
|
||||
msgid "directory is not writable"
|
||||
msgstr "ディレクトリに書き込めません"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:247
|
||||
msgid "file is not readable"
|
||||
msgstr "ファイルを読み取る権限がありません"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:250
|
||||
msgid "file is not writable"
|
||||
msgstr "ファイルを書き込む権限がありません"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:265
|
||||
msgid ""
|
||||
"Lock can not be acquired on the datastore. You might encounter concurrent "
|
||||
"access issues."
|
||||
msgstr ""
|
||||
"ロックはデータストアでは取得できません。同時にアクセスしたことによってエラー"
|
||||
"が発生した可能性があります。"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:298
|
||||
msgid "Configuration parsing"
|
||||
msgstr "設定ファイルのパース"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:299
|
||||
msgid "Slim Framework (routing, etc.)"
|
||||
msgstr "軽量なフレームワーク (ルーティングなど)"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:300
|
||||
msgid "Multibyte (Unicode) string support"
|
||||
msgstr "マルチバイト (Unicode) の文字のサポート"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:301
|
||||
msgid "Required to use thumbnails"
|
||||
msgstr "サムネイルを使うことは必須です"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:302
|
||||
msgid "Localized text sorting (e.g. e->è->f)"
|
||||
msgstr "ローカライズされた文字のソート (例: e->è->f)"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:303
|
||||
msgid "Better retrieval of bookmark metadata and thumbnail"
|
||||
msgstr "ブックマークのメタデータとサムネイルの改善された検索"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:304
|
||||
msgid "Use the translation system in gettext mode"
|
||||
msgstr "gettext モードで翻訳システムを使用"
|
||||
|
||||
#: application/helper/ApplicationUtils.php:305
|
||||
msgid "Login using LDAP server"
|
||||
msgstr "LDAP サーバーを使用してログイン"
|
||||
|
||||
#: application/helper/DailyPageHelper.php:179
|
||||
msgid "Week"
|
||||
msgstr "週"
|
||||
|
||||
#: application/helper/DailyPageHelper.php:183
|
||||
msgid "Today"
|
||||
msgstr "今日"
|
||||
|
||||
#: application/helper/DailyPageHelper.php:185
|
||||
msgid "Yesterday"
|
||||
msgstr "昨日"
|
||||
|
||||
#: application/helper/FileUtils.php:100
|
||||
msgid "Provided path is not a directory."
|
||||
msgstr "入力されたパスはディレクトリではありません。"
|
||||
|
||||
#: application/helper/FileUtils.php:104
|
||||
msgid "Trying to delete a folder outside of Shaarli path."
|
||||
msgstr "Shaarli のパスの外にあるフォルダを削除しようとしています。"
|
||||
|
||||
#: application/legacy/LegacyLinkDB.php:131
|
||||
msgid "You are not authorized to add a link."
|
||||
msgstr "リンクを追加するには、ログインする必要があります。"
|
||||
|
@ -597,7 +718,7 @@ msgstr ""
|
|||
msgid "Couldn't retrieve updater class methods."
|
||||
msgstr "アップデーターのクラスメゾットを受信できませんでした。"
|
||||
|
||||
#: application/legacy/LegacyUpdater.php:538
|
||||
#: application/legacy/LegacyUpdater.php:540
|
||||
msgid "<a href=\"./admin/thumbnails\">"
|
||||
msgstr "<a href=\"./admin/thumbnails\">"
|
||||
|
||||
|
@ -623,16 +744,17 @@ msgstr ""
|
|||
"が %d 秒で処理され、%d 件のリンクがインポートされ、%d 件のリンクが上書きさ"
|
||||
"れ、%d 件のリンクがスキップされました。"
|
||||
|
||||
#: application/plugin/PluginManager.php:124
|
||||
#: application/plugin/PluginManager.php:103
|
||||
#: application/plugin/PluginManager.php:141
|
||||
msgid " [plugin incompatibility]: "
|
||||
msgstr " [非対応のプラグイン]: "
|
||||
|
||||
#: application/plugin/exception/PluginFileNotFoundException.php:21
|
||||
#: application/plugin/exception/PluginFileNotFoundException.php:22
|
||||
#, php-format
|
||||
msgid "Plugin \"%s\" files not found."
|
||||
msgstr "プラグイン「%s」のファイルが存在しません。"
|
||||
|
||||
#: application/render/PageCacheManager.php:32
|
||||
#: application/render/PageCacheManager.php:33
|
||||
#, php-format
|
||||
msgid "Cannot purge %s: no directory"
|
||||
msgstr "%s を削除できません: ディレクトリが存在しません"
|
||||
|
@ -641,7 +763,7 @@ msgstr "%s を削除できません: ディレクトリが存在しません"
|
|||
msgid "An error occurred while running the update "
|
||||
msgstr "更新中に問題が発生しました "
|
||||
|
||||
#: index.php:65
|
||||
#: index.php:82
|
||||
msgid "Shared bookmarks on "
|
||||
msgstr "次において共有されたリンク "
|
||||
|
||||
|
@ -657,11 +779,11 @@ msgstr "リンクを追加"
|
|||
msgid "Adds the addlink input on the linklist page."
|
||||
msgstr "リンク一覧のページに、リンクを追加するためのフォームを表示する。"
|
||||
|
||||
#: plugins/archiveorg/archiveorg.php:28
|
||||
#: plugins/archiveorg/archiveorg.php:29
|
||||
msgid "View on archive.org"
|
||||
msgstr "archive.org 上で表示する"
|
||||
|
||||
#: plugins/archiveorg/archiveorg.php:41
|
||||
#: plugins/archiveorg/archiveorg.php:42
|
||||
msgid "For each link, add an Archive.org icon."
|
||||
msgstr "それぞれのリンクに、Archive.org のアイコンを追加する。"
|
||||
|
||||
|
@ -673,24 +795,24 @@ msgstr ""
|
|||
"既定の色のプラグインにおけるエラー: このプラグインは有効なので、カスタム カ"
|
||||
"ラーは適用されません。"
|
||||
|
||||
#: plugins/default_colors/default_colors.php:113
|
||||
#: plugins/default_colors/default_colors.php:127
|
||||
msgid "Override default theme colors. Use any CSS valid color."
|
||||
msgstr ""
|
||||
"既定のテーマの色を上書きします。どのような CSS カラーコードでも使えます。"
|
||||
|
||||
#: plugins/default_colors/default_colors.php:114
|
||||
#: plugins/default_colors/default_colors.php:128
|
||||
msgid "Main color (navbar green)"
|
||||
msgstr "メイン カラー (ナビバーの緑)"
|
||||
|
||||
#: plugins/default_colors/default_colors.php:115
|
||||
#: plugins/default_colors/default_colors.php:129
|
||||
msgid "Background color (light grey)"
|
||||
msgstr "背景色 (灰色)"
|
||||
|
||||
#: plugins/default_colors/default_colors.php:116
|
||||
#: plugins/default_colors/default_colors.php:130
|
||||
msgid "Dark main color (e.g. visited links)"
|
||||
msgstr "暗い方の メイン カラー (例: 閲覧済みリンク)"
|
||||
|
||||
#: plugins/demo_plugin/demo_plugin.php:477
|
||||
#: plugins/demo_plugin/demo_plugin.php:528
|
||||
msgid ""
|
||||
"A demo plugin covering all use cases for template designers and plugin "
|
||||
"developers."
|
||||
|
@ -698,11 +820,11 @@ msgstr ""
|
|||
"テンプレートのデザイナーや、プラグインの開発者のためのすべての状況に対応でき"
|
||||
"るデモプラグインです。"
|
||||
|
||||
#: plugins/demo_plugin/demo_plugin.php:478
|
||||
#: plugins/demo_plugin/demo_plugin.php:529
|
||||
msgid "This is a parameter dedicated to the demo plugin. It'll be suffixed."
|
||||
msgstr "これはデモプラグイン専用のパラメーターです。末尾に追加されます。"
|
||||
|
||||
#: plugins/demo_plugin/demo_plugin.php:479
|
||||
#: plugins/demo_plugin/demo_plugin.php:530
|
||||
msgid "Other demo parameter"
|
||||
msgstr "他のデモ パラメーター"
|
||||
|
||||
|
@ -724,7 +846,7 @@ msgstr ""
|
|||
msgid "Isso server URL (without 'http://')"
|
||||
msgstr "Isso server URL ('http://' 抜き)"
|
||||
|
||||
#: plugins/piwik/piwik.php:23
|
||||
#: plugins/piwik/piwik.php:24
|
||||
msgid ""
|
||||
"Piwik plugin error: Please define PIWIK_URL and PIWIK_SITEID in the plugin "
|
||||
"administration page."
|
||||
|
@ -732,27 +854,27 @@ msgstr ""
|
|||
"Piwik プラグインエラー: PIWIK_URL と PIWIK_SITEID の値をプラグイン管理ページ"
|
||||
"で指定してください。"
|
||||
|
||||
#: plugins/piwik/piwik.php:72
|
||||
#: plugins/piwik/piwik.php:73
|
||||
msgid "A plugin that adds Piwik tracking code to Shaarli pages."
|
||||
msgstr "Piwik のトラッキングコードをShaarliに追加するプラグインです。"
|
||||
|
||||
#: plugins/piwik/piwik.php:73
|
||||
#: plugins/piwik/piwik.php:74
|
||||
msgid "Piwik URL"
|
||||
msgstr "Piwik URL"
|
||||
|
||||
#: plugins/piwik/piwik.php:74
|
||||
#: plugins/piwik/piwik.php:75
|
||||
msgid "Piwik site ID"
|
||||
msgstr "Piwik サイトID"
|
||||
|
||||
#: plugins/playvideos/playvideos.php:25
|
||||
#: plugins/playvideos/playvideos.php:26
|
||||
msgid "Video player"
|
||||
msgstr "動画プレイヤー"
|
||||
|
||||
#: plugins/playvideos/playvideos.php:28
|
||||
#: plugins/playvideos/playvideos.php:29
|
||||
msgid "Play Videos"
|
||||
msgstr "動画を再生"
|
||||
|
||||
#: plugins/playvideos/playvideos.php:59
|
||||
#: plugins/playvideos/playvideos.php:60
|
||||
msgid "Add a button in the toolbar allowing to watch all videos."
|
||||
msgstr "すべての動画を閲覧するボタンをツールバーに追加します。"
|
||||
|
||||
|
@ -779,11 +901,11 @@ msgstr "ハブ %s からの不正なレスポンス"
|
|||
msgid "Enable PubSubHubbub feed publishing."
|
||||
msgstr "PubSubHubbub へのフィードを公開する。"
|
||||
|
||||
#: plugins/qrcode/qrcode.php:73 plugins/wallabag/wallabag.php:70
|
||||
#: plugins/qrcode/qrcode.php:74 plugins/wallabag/wallabag.php:72
|
||||
msgid "For each link, add a QRCode icon."
|
||||
msgstr "それぞれのリンクについて、QRコードのアイコンを追加する。"
|
||||
|
||||
#: plugins/wallabag/wallabag.php:21
|
||||
#: plugins/wallabag/wallabag.php:22
|
||||
msgid ""
|
||||
"Wallabag plugin error: Please define the \"WALLABAG_URL\" setting in the "
|
||||
"plugin administration page."
|
||||
|
@ -791,15 +913,15 @@ msgstr ""
|
|||
"Wallabag プラグインエラー: \"WALLABAG_URL\" の値をプラグイン管理ページにおい"
|
||||
"て指定してください。"
|
||||
|
||||
#: plugins/wallabag/wallabag.php:47
|
||||
#: plugins/wallabag/wallabag.php:49
|
||||
msgid "Save to wallabag"
|
||||
msgstr "Wallabag に保存"
|
||||
|
||||
#: plugins/wallabag/wallabag.php:71
|
||||
#: plugins/wallabag/wallabag.php:73
|
||||
msgid "Wallabag API URL"
|
||||
msgstr "Wallabag のAPIのURL"
|
||||
|
||||
#: plugins/wallabag/wallabag.php:72
|
||||
#: plugins/wallabag/wallabag.php:74
|
||||
msgid "Wallabag API version (1 or 2)"
|
||||
msgstr "Wallabag のAPIのバージョン (1 または 2)"
|
||||
|
||||
|
@ -944,9 +1066,6 @@ msgstr[1] "検索"
|
|||
#~ msgid "Do not show any links if the user is not logged in"
|
||||
#~ msgstr "ログインしていないユーザーには何のリンクも表示しない"
|
||||
|
||||
#~ msgid "Check updates"
|
||||
#~ msgstr "更新を確認"
|
||||
|
||||
#~ msgid "Notify me when a new release is ready"
|
||||
#~ msgstr "新しいバージョンがリリースされたときに通知"
|
||||
|
||||
|
@ -1043,9 +1162,6 @@ msgstr[1] "検索"
|
|||
#~ msgid "Add default tags"
|
||||
#~ msgstr "既定のタグを追加"
|
||||
|
||||
#~ msgid "Install Shaarli"
|
||||
#~ msgstr "Shaarli をインストール"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "It looks like it's the first time you run Shaarli. Please configure it."
|
||||
#~ msgstr "どうやら Shaarli を初めて起動しているようです。設定してください。"
|
||||
|
@ -1161,9 +1277,6 @@ msgstr[1] "検索"
|
|||
#~ msgid "is available"
|
||||
#~ msgstr "が利用可能"
|
||||
|
||||
#~ msgid "Error"
|
||||
#~ msgstr "エラー"
|
||||
|
||||
#~ msgid "Picture Wall"
|
||||
#~ msgstr "ピクチャーウォール"
|
||||
|
||||
|
|
1807
inc/languages/zh_CN/LC_MESSAGES/shaarli.po
Normal file
1807
inc/languages/zh_CN/LC_MESSAGES/shaarli.po
Normal file
File diff suppressed because it is too large
Load diff
|
@ -12,7 +12,7 @@ site_dir: doc/html
|
|||
# - https://github.com/rtfd/readthedocs.org/issues/4314
|
||||
# strict: true
|
||||
|
||||
pages:
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Setup:
|
||||
- Server configuration: Server-configuration.md
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<file>index.php</file>
|
||||
<file>application</file>
|
||||
<file>plugins</file>
|
||||
<!-- <file>tests</file>-->
|
||||
<file>tests</file>
|
||||
|
||||
<exclude-pattern>*/*.css</exclude-pattern>
|
||||
<exclude-pattern>*/*.js</exclude-pattern>
|
||||
|
@ -19,5 +19,11 @@
|
|||
<!-- index.php bootstraps everything, so yes mixed symbols with side effects -->
|
||||
<exclude-pattern>index.php</exclude-pattern>
|
||||
<exclude-pattern>plugins/*</exclude-pattern>
|
||||
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
|
||||
<exclude-pattern>tests/utils/RainTPL.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
|
||||
<exclude-pattern>tests/utils/RainTPL.php</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
|
|
@ -39,7 +39,7 @@ class PluginManagerTest extends \Shaarli\TestCase
|
|||
public function testPlugin(): void
|
||||
{
|
||||
PluginManager::$PLUGINS_PATH = self::$pluginPath;
|
||||
$this->pluginManager->load(array(self::$pluginName));
|
||||
$this->pluginManager->load([self::$pluginName]);
|
||||
|
||||
$this->assertTrue(function_exists('hook_test_random'));
|
||||
|
||||
|
@ -50,19 +50,19 @@ class PluginManagerTest extends \Shaarli\TestCase
|
|||
static::assertSame('woot', $data[1]);
|
||||
|
||||
$data = [0 => 'woot'];
|
||||
$this->pluginManager->executeHooks('random', $data, array('target' => 'test'));
|
||||
$this->pluginManager->executeHooks('random', $data, ['target' => 'test']);
|
||||
|
||||
static::assertCount(2, $data);
|
||||
static::assertSame('page test', $data[1]);
|
||||
|
||||
$data = [0 => 'woot'];
|
||||
$this->pluginManager->executeHooks('random', $data, array('loggedin' => true));
|
||||
$this->pluginManager->executeHooks('random', $data, ['loggedin' => true]);
|
||||
|
||||
static::assertCount(2, $data);
|
||||
static::assertEquals('loggedin', $data[1]);
|
||||
|
||||
$data = [0 => 'woot'];
|
||||
$this->pluginManager->executeHooks('random', $data, array('loggedin' => null));
|
||||
$this->pluginManager->executeHooks('random', $data, ['loggedin' => null]);
|
||||
|
||||
static::assertCount(3, $data);
|
||||
static::assertEquals('loggedin', $data[1]);
|
||||
|
@ -76,7 +76,7 @@ class PluginManagerTest extends \Shaarli\TestCase
|
|||
public function testPluginWithPhpError(): void
|
||||
{
|
||||
PluginManager::$PLUGINS_PATH = self::$pluginPath;
|
||||
$this->pluginManager->load(array(self::$pluginName));
|
||||
$this->pluginManager->load([self::$pluginName]);
|
||||
|
||||
$this->assertTrue(function_exists('hook_test_error'));
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ use WebThumbnailer\Application\ConfigManager as WTConfigManager;
|
|||
*/
|
||||
class ThumbnailerTest extends TestCase
|
||||
{
|
||||
const WIDTH = 190;
|
||||
protected const WIDTH = 190;
|
||||
|
||||
const HEIGHT = 210;
|
||||
protected const HEIGHT = 210;
|
||||
|
||||
/**
|
||||
* @var Thumbnailer;
|
||||
|
@ -103,10 +103,10 @@ class ThumbnailerTest extends TestCase
|
|||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
if ($object != "." && $object != "..") {
|
||||
if (is_dir($dir."/".$object)) {
|
||||
$this->rrmdirContent($dir."/".$object);
|
||||
if (is_dir($dir . "/" . $object)) {
|
||||
$this->rrmdirContent($dir . "/" . $object);
|
||||
} else {
|
||||
unlink($dir."/".$object);
|
||||
unlink($dir . "/" . $object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* TimeZone's tests
|
||||
*/
|
||||
|
||||
require_once 'application/TimeZone.php';
|
||||
namespace Shaarli\Tests;
|
||||
|
||||
use Shaarli\TestCase;
|
||||
|
||||
/**
|
||||
* Unitary tests for timezone utilities
|
||||
*/
|
||||
class TimeZoneTest extends \Shaarli\TestCase
|
||||
class TimeZoneTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var array of timezones
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Utilities' tests
|
||||
*/
|
||||
|
||||
require_once 'application/Utils.php';
|
||||
require_once 'application/Languages.php';
|
||||
namespace Shaarli\Tests;
|
||||
|
||||
use DateTime;
|
||||
use Shaarli\TestCase;
|
||||
|
||||
/**
|
||||
* Unitary tests for Shaarli utilities
|
||||
*/
|
||||
class UtilsTest extends \Shaarli\TestCase
|
||||
class UtilsTest extends TestCase
|
||||
{
|
||||
// Log file
|
||||
protected static $testLogFile = 'tests.log';
|
||||
|
@ -54,7 +56,7 @@ class UtilsTest extends \Shaarli\TestCase
|
|||
/**
|
||||
* Returns a list of the elements from the last logged entry
|
||||
*
|
||||
* @return list (date, ip address, message)
|
||||
* @return array (date, ip address, message)
|
||||
*/
|
||||
protected function getLastLogEntry()
|
||||
{
|
||||
|
@ -187,7 +189,7 @@ class UtilsTest extends \Shaarli\TestCase
|
|||
public function testGenerateLocationLoop()
|
||||
{
|
||||
$ref = 'http://localhost/?test';
|
||||
$this->assertEquals('./?', generateLocation($ref, 'localhost', array('test')));
|
||||
$this->assertEquals('./?', generateLocation($ref, 'localhost', ['test']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -313,15 +315,15 @@ class UtilsTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testHumanBytes()
|
||||
{
|
||||
$this->assertEquals('2'. t('kiB'), human_bytes(2 * 1024));
|
||||
$this->assertEquals('2'. t('kiB'), human_bytes(strval(2 * 1024)));
|
||||
$this->assertEquals('2'. t('MiB'), human_bytes(2 * (pow(1024, 2))));
|
||||
$this->assertEquals('2'. t('MiB'), human_bytes(strval(2 * (pow(1024, 2)))));
|
||||
$this->assertEquals('2'. t('GiB'), human_bytes(2 * (pow(1024, 3))));
|
||||
$this->assertEquals('2'. t('GiB'), human_bytes(strval(2 * (pow(1024, 3)))));
|
||||
$this->assertEquals('374'. t('B'), human_bytes(374));
|
||||
$this->assertEquals('374'. t('B'), human_bytes('374'));
|
||||
$this->assertEquals('232'. t('kiB'), human_bytes(237481));
|
||||
$this->assertEquals('2' . t('kiB'), human_bytes(2 * 1024));
|
||||
$this->assertEquals('2' . t('kiB'), human_bytes(strval(2 * 1024)));
|
||||
$this->assertEquals('2' . t('MiB'), human_bytes(2 * (pow(1024, 2))));
|
||||
$this->assertEquals('2' . t('MiB'), human_bytes(strval(2 * (pow(1024, 2)))));
|
||||
$this->assertEquals('2' . t('GiB'), human_bytes(2 * (pow(1024, 3))));
|
||||
$this->assertEquals('2' . t('GiB'), human_bytes(strval(2 * (pow(1024, 3)))));
|
||||
$this->assertEquals('374' . t('B'), human_bytes(374));
|
||||
$this->assertEquals('374' . t('B'), human_bytes('374'));
|
||||
$this->assertEquals('232' . t('kiB'), human_bytes(237481));
|
||||
$this->assertEquals(t('Unlimited'), human_bytes('0'));
|
||||
$this->assertEquals(t('Unlimited'), human_bytes(0));
|
||||
$this->assertEquals(t('Setting not set'), human_bytes(''));
|
||||
|
@ -332,9 +334,9 @@ class UtilsTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testGetMaxUploadSize()
|
||||
{
|
||||
$this->assertEquals('1'. t('MiB'), get_max_upload_size(2097152, '1024k'));
|
||||
$this->assertEquals('1'. t('MiB'), get_max_upload_size('1m', '2m'));
|
||||
$this->assertEquals('100'. t('B'), get_max_upload_size(100, 100));
|
||||
$this->assertEquals('1' . t('MiB'), get_max_upload_size(2097152, '1024k'));
|
||||
$this->assertEquals('1' . t('MiB'), get_max_upload_size('1m', '2m'));
|
||||
$this->assertEquals('100' . t('B'), get_max_upload_size(100, 100));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Api;
|
||||
|
||||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -32,7 +34,7 @@ class ApiMiddlewareTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -49,7 +51,7 @@ class ApiMiddlewareTest extends \Shaarli\TestCase
|
|||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('api.secret', 'NapoleonWasALizard');
|
||||
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
|
||||
$history = new History('sandbox/history.php');
|
||||
|
@ -80,7 +82,7 @@ class ApiMiddlewareTest extends \Shaarli\TestCase
|
|||
$env = Environment::mock([
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
'REQUEST_URI' => '/echo',
|
||||
'HTTP_AUTHORIZATION'=> 'Bearer ' . ApiUtilsTest::generateValidJwtToken('NapoleonWasALizard'),
|
||||
'HTTP_AUTHORIZATION' => 'Bearer ' . ApiUtilsTest::generateValidJwtToken('NapoleonWasALizard'),
|
||||
]);
|
||||
$request = Request::createFromEnvironment($env);
|
||||
$response = new Response();
|
||||
|
@ -196,7 +198,7 @@ class ApiMiddlewareTest extends \Shaarli\TestCase
|
|||
$env = Environment::mock([
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
'REQUEST_URI' => '/echo',
|
||||
'HTTP_AUTHORIZATION'=> 'Bearer jwt',
|
||||
'HTTP_AUTHORIZATION' => 'Bearer jwt',
|
||||
]);
|
||||
$request = Request::createFromEnvironment($env);
|
||||
$response = new Response();
|
||||
|
@ -219,7 +221,7 @@ class ApiMiddlewareTest extends \Shaarli\TestCase
|
|||
$env = Environment::mock([
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
'REQUEST_URI' => '/echo',
|
||||
'HTTP_AUTHORIZATION'=> 'PolarBearer jwt',
|
||||
'HTTP_AUTHORIZATION' => 'PolarBearer jwt',
|
||||
]);
|
||||
$request = Request::createFromEnvironment($env);
|
||||
$response = new Response();
|
||||
|
@ -245,7 +247,7 @@ class ApiMiddlewareTest extends \Shaarli\TestCase
|
|||
$env = Environment::mock([
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
'REQUEST_URI' => '/echo',
|
||||
'HTTP_AUTHORIZATION'=> 'Bearer jwt',
|
||||
'HTTP_AUTHORIZATION' => 'Bearer jwt',
|
||||
]);
|
||||
$request = Request::createFromEnvironment($env);
|
||||
$response = new Response();
|
||||
|
|
|
@ -32,10 +32,10 @@ class ApiUtilsTest extends \Shaarli\TestCase
|
|||
"alg": "HS512"
|
||||
}');
|
||||
$payload = Base64Url::encode('{
|
||||
"iat": '. time() .'
|
||||
"iat": ' . time() . '
|
||||
}');
|
||||
$signature = Base64Url::encode(hash_hmac('sha512', $header .'.'. $payload, $secret, true));
|
||||
return $header .'.'. $payload .'.'. $signature;
|
||||
$signature = Base64Url::encode(hash_hmac('sha512', $header . '.' . $payload, $secret, true));
|
||||
return $header . '.' . $payload . '.' . $signature;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,14 +4,14 @@ namespace Shaarli\Api\Controllers;
|
|||
|
||||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\TestCase;
|
||||
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
||||
require_once 'tests/utils/ReferenceHistory.php';
|
||||
|
||||
class HistoryTest extends \Shaarli\TestCase
|
||||
class HistoryTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var string datastore to test write operations
|
||||
|
@ -24,7 +24,7 @@ class HistoryTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceHistory instance.
|
||||
* @var ReferenceHistory instance.
|
||||
*/
|
||||
protected $refHistory = null;
|
||||
|
||||
|
@ -44,7 +44,7 @@ class HistoryTest extends \Shaarli\TestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->refHistory = new \ReferenceHistory();
|
||||
$this->refHistory = new ReferenceHistory();
|
||||
$this->refHistory->write(self::$testHistory);
|
||||
$this->container = new Container();
|
||||
$this->container['conf'] = $this->conf;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
use malkusch\lock\mutex\NoMutex;
|
||||
|
@ -7,6 +8,7 @@ use Shaarli\Config\ConfigManager;
|
|||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\TestCase;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -32,7 +34,7 @@ class InfoTest extends TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -54,7 +56,7 @@ class InfoTest extends TestCase
|
|||
$mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$this->pluginManager = new PluginManager($this->conf);
|
||||
$history = new History('sandbox/history.php');
|
||||
|
@ -95,7 +97,7 @@ class InfoTest extends TestCase
|
|||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$data = json_decode((string) $response->getBody(), true);
|
||||
|
||||
$this->assertEquals(\ReferenceLinkDB::$NB_LINKS_TOTAL, $data['global_counter']);
|
||||
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, $data['global_counter']);
|
||||
$this->assertEquals(2, $data['private_counter']);
|
||||
$this->assertEquals('Shaarli', $data['settings']['title']);
|
||||
$this->assertEquals('?', $data['settings']['header_link']);
|
||||
|
@ -106,7 +108,7 @@ class InfoTest extends TestCase
|
|||
$title = 'My bookmarks';
|
||||
$headerLink = 'http://shaarli.tld';
|
||||
$timezone = 'Europe/Paris';
|
||||
$enabledPlugins = array('foo', 'bar');
|
||||
$enabledPlugins = ['foo', 'bar'];
|
||||
$defaultPrivateLinks = true;
|
||||
$this->conf->set('general.title', $title);
|
||||
$this->conf->set('general.header_link', $headerLink);
|
||||
|
@ -118,7 +120,7 @@ class InfoTest extends TestCase
|
|||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$data = json_decode((string) $response->getBody(), true);
|
||||
|
||||
$this->assertEquals(\ReferenceLinkDB::$NB_LINKS_TOTAL, $data['global_counter']);
|
||||
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, $data['global_counter']);
|
||||
$this->assertEquals(2, $data['private_counter']);
|
||||
$this->assertEquals($title, $data['settings']['title']);
|
||||
$this->assertEquals($headerLink, $data['settings']['header_link']);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
use malkusch\lock\mutex\NoMutex;
|
||||
|
@ -8,6 +7,8 @@ use Shaarli\Bookmark\BookmarkFileService;
|
|||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -31,7 +32,7 @@ class DeleteLinkTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -69,9 +70,9 @@ class DeleteLinkTest extends \Shaarli\TestCase
|
|||
$this->mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$refHistory = new \ReferenceHistory();
|
||||
$refHistory = new ReferenceHistory();
|
||||
$refHistory->write(self::$testHistory);
|
||||
$this->history = new History(self::$testHistory);
|
||||
$this->pluginManager = new PluginManager($this->conf);
|
||||
|
|
|
@ -8,6 +8,7 @@ use Shaarli\Bookmark\BookmarkFileService;
|
|||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -35,7 +36,7 @@ class GetLinkIdTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class GetLinkIdTest extends \Shaarli\TestCase
|
|||
/**
|
||||
* Number of JSON fields per link.
|
||||
*/
|
||||
const NB_FIELDS_LINK = 9;
|
||||
protected const NB_FIELDS_LINK = 9;
|
||||
|
||||
/**
|
||||
* Before each test, instantiate a new Api with its config, plugins and bookmarks.
|
||||
|
@ -62,7 +63,7 @@ class GetLinkIdTest extends \Shaarli\TestCase
|
|||
$mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$history = new History('sandbox/history.php');
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
use malkusch\lock\mutex\NoMutex;
|
||||
|
@ -8,6 +9,7 @@ use Shaarli\Bookmark\LinkDB;
|
|||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -35,7 +37,7 @@ class GetLinksTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -52,7 +54,7 @@ class GetLinksTest extends \Shaarli\TestCase
|
|||
/**
|
||||
* Number of JSON field per link.
|
||||
*/
|
||||
const NB_FIELDS_LINK = 9;
|
||||
protected const NB_FIELDS_LINK = 9;
|
||||
|
||||
/**
|
||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||
|
@ -62,7 +64,7 @@ class GetLinksTest extends \Shaarli\TestCase
|
|||
$mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$history = new History('sandbox/history.php');
|
||||
|
||||
|
@ -329,7 +331,7 @@ class GetLinksTest extends \Shaarli\TestCase
|
|||
// URL encoding
|
||||
$env = Environment::mock([
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
'QUERY_STRING' => 'searchterm='. urlencode('@web')
|
||||
'QUERY_STRING' => 'searchterm=' . urlencode('@web')
|
||||
]);
|
||||
$request = Request::createFromEnvironment($env);
|
||||
$response = $this->controller->getLinks($request, new Response());
|
||||
|
@ -430,7 +432,7 @@ class GetLinksTest extends \Shaarli\TestCase
|
|||
$response = $this->controller->getLinks($request, new Response());
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$data = json_decode((string) $response->getBody(), true);
|
||||
$this->assertEquals(\ReferenceLinkDB::$NB_LINKS_TOTAL, count($data));
|
||||
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data));
|
||||
$this->assertEquals(10, $data[0]['id']);
|
||||
$this->assertEquals(41, $data[2]['id']);
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ use Shaarli\Config\ConfigManager;
|
|||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\TestCase;
|
||||
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -40,7 +42,7 @@ class PostLinkTest extends TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -67,7 +69,7 @@ class PostLinkTest extends TestCase
|
|||
/**
|
||||
* Number of JSON field per link.
|
||||
*/
|
||||
const NB_FIELDS_LINK = 9;
|
||||
protected const NB_FIELDS_LINK = 9;
|
||||
|
||||
/**
|
||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||
|
@ -77,9 +79,9 @@ class PostLinkTest extends TestCase
|
|||
$mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$refHistory = new \ReferenceHistory();
|
||||
$refHistory = new ReferenceHistory();
|
||||
$refHistory->write(self::$testHistory);
|
||||
$this->history = new History(self::$testHistory);
|
||||
$pluginManager = new PluginManager($this->conf);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
use malkusch\lock\mutex\NoMutex;
|
||||
|
@ -9,6 +8,8 @@ use Shaarli\Bookmark\BookmarkFileService;
|
|||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -32,7 +33,7 @@ class PutLinkTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -59,7 +60,7 @@ class PutLinkTest extends \Shaarli\TestCase
|
|||
/**
|
||||
* Number of JSON field per link.
|
||||
*/
|
||||
const NB_FIELDS_LINK = 9;
|
||||
protected const NB_FIELDS_LINK = 9;
|
||||
|
||||
/**
|
||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||
|
@ -69,9 +70,9 @@ class PutLinkTest extends \Shaarli\TestCase
|
|||
$mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$refHistory = new \ReferenceHistory();
|
||||
$refHistory = new ReferenceHistory();
|
||||
$refHistory->write(self::$testHistory);
|
||||
$this->history = new History(self::$testHistory);
|
||||
$pluginManager = new PluginManager($this->conf);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
use malkusch\lock\mutex\NoMutex;
|
||||
|
@ -9,6 +8,8 @@ use Shaarli\Bookmark\LinkDB;
|
|||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -32,7 +33,7 @@ class DeleteTagTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -70,9 +71,9 @@ class DeleteTagTest extends \Shaarli\TestCase
|
|||
$this->mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$refHistory = new \ReferenceHistory();
|
||||
$refHistory = new ReferenceHistory();
|
||||
$refHistory->write(self::$testHistory);
|
||||
$this->history = new History(self::$testHistory);
|
||||
$this->pluginManager = new PluginManager($this->conf);
|
||||
|
|
|
@ -8,6 +8,7 @@ use Shaarli\Bookmark\LinkDB;
|
|||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -33,7 +34,7 @@ class GetTagNameTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -53,7 +54,7 @@ class GetTagNameTest extends \Shaarli\TestCase
|
|||
/**
|
||||
* Number of JSON fields per link.
|
||||
*/
|
||||
const NB_FIELDS_TAG = 2;
|
||||
protected const NB_FIELDS_TAG = 2;
|
||||
|
||||
/**
|
||||
* Before each test, instantiate a new Api with its config, plugins and bookmarks.
|
||||
|
@ -63,7 +64,7 @@ class GetTagNameTest extends \Shaarli\TestCase
|
|||
$mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$history = new History('sandbox/history.php');
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Api\Controllers;
|
||||
|
||||
use malkusch\lock\mutex\NoMutex;
|
||||
|
@ -7,6 +8,7 @@ use Shaarli\Bookmark\LinkDB;
|
|||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -32,7 +34,7 @@ class GetTagsTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -57,7 +59,7 @@ class GetTagsTest extends \Shaarli\TestCase
|
|||
/**
|
||||
* Number of JSON field per link.
|
||||
*/
|
||||
const NB_FIELDS_TAG = 2;
|
||||
protected const NB_FIELDS_TAG = 2;
|
||||
|
||||
/**
|
||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||
|
@ -67,7 +69,7 @@ class GetTagsTest extends \Shaarli\TestCase
|
|||
$mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$history = new History('sandbox/history.php');
|
||||
$this->pluginManager = new PluginManager($this->conf);
|
||||
|
|
|
@ -9,6 +9,8 @@ use Shaarli\Bookmark\LinkDB;
|
|||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -32,7 +34,7 @@ class PutTagTest extends \Shaarli\TestCase
|
|||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var \ReferenceLinkDB instance.
|
||||
* @var ReferenceLinkDB instance.
|
||||
*/
|
||||
protected $refDB = null;
|
||||
|
||||
|
@ -62,7 +64,7 @@ class PutTagTest extends \Shaarli\TestCase
|
|||
/**
|
||||
* Number of JSON field per link.
|
||||
*/
|
||||
const NB_FIELDS_TAG = 2;
|
||||
protected const NB_FIELDS_TAG = 2;
|
||||
|
||||
/**
|
||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||
|
@ -72,9 +74,9 @@ class PutTagTest extends \Shaarli\TestCase
|
|||
$mutex = new NoMutex();
|
||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$refHistory = new \ReferenceHistory();
|
||||
$refHistory = new ReferenceHistory();
|
||||
$refHistory->write(self::$testHistory);
|
||||
$this->history = new History(self::$testHistory);
|
||||
$this->pluginManager = new PluginManager($this->conf);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Shaarli\Bookmark;
|
||||
|
||||
use Shaarli\TestCase;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
|
||||
/**
|
||||
* Class BookmarkArrayTest
|
||||
|
@ -185,7 +186,7 @@ class BookmarkArrayTest extends TestCase
|
|||
$this->assertCount(3, $array);
|
||||
|
||||
foreach ($array as $id => $bookmark) {
|
||||
$this->assertEquals(${'bookmark'. $id}, $bookmark);
|
||||
$this->assertEquals(${'bookmark' . $id}, $bookmark);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +195,7 @@ class BookmarkArrayTest extends TestCase
|
|||
*/
|
||||
public function testReorder()
|
||||
{
|
||||
$refDB = new \ReferenceLinkDB();
|
||||
$refDB = new ReferenceLinkDB();
|
||||
$refDB->write('sandbox/datastore.php');
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Link datastore tests
|
||||
*/
|
||||
|
@ -7,7 +8,6 @@ namespace Shaarli\Bookmark;
|
|||
|
||||
use DateTime;
|
||||
use malkusch\lock\mutex\NoMutex;
|
||||
use ReferenceLinkDB;
|
||||
use ReflectionClass;
|
||||
use Shaarli;
|
||||
use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
|
||||
|
@ -16,6 +16,8 @@ use Shaarli\Formatter\BookmarkMarkdownFormatter;
|
|||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\TestCase;
|
||||
use Shaarli\Tests\Utils\FakeBookmarkService;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
|
||||
/**
|
||||
* Unitary tests for LegacyLinkDBTest
|
||||
|
@ -82,19 +84,19 @@ class BookmarkFileServiceTest extends TestCase
|
|||
unlink(self::$testDatastore);
|
||||
}
|
||||
|
||||
if (file_exists(self::$testConf .'.json.php')) {
|
||||
unlink(self::$testConf .'.json.php');
|
||||
if (file_exists(self::$testConf . '.json.php')) {
|
||||
unlink(self::$testConf . '.json.php');
|
||||
}
|
||||
|
||||
if (file_exists(self::$testUpdates)) {
|
||||
unlink(self::$testUpdates);
|
||||
}
|
||||
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf . '.json.php');
|
||||
$this->conf = new ConfigManager(self::$testConf);
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->conf->set('resource.updates', self::$testUpdates);
|
||||
$this->refDB = new \ReferenceLinkDB();
|
||||
$this->refDB = new ReferenceLinkDB();
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$this->history = new History('sandbox/history.php');
|
||||
$this->pluginManager = new PluginManager($this->conf);
|
||||
|
@ -123,12 +125,12 @@ class BookmarkFileServiceTest extends TestCase
|
|||
define('SHAARLI_VERSION', 'dev');
|
||||
}
|
||||
|
||||
$this->refDB = new \ReferenceLinkDB(true);
|
||||
$this->refDB = new ReferenceLinkDB(true);
|
||||
$this->refDB->write(self::$testDatastore);
|
||||
$db = self::getMethod('migrate');
|
||||
$db->invokeArgs($this->privateLinkDB, []);
|
||||
|
||||
$db = new \FakeBookmarkService(
|
||||
$db = new FakeBookmarkService(
|
||||
$this->conf,
|
||||
$this->pluginManager,
|
||||
$this->history,
|
||||
|
@ -203,7 +205,7 @@ class BookmarkFileServiceTest extends TestCase
|
|||
$this->assertEquals($updated, $bookmark->getUpdated());
|
||||
|
||||
// reload from file
|
||||
$this->privateLinkDB = new \FakeBookmarkService(
|
||||
$this->privateLinkDB = new FakeBookmarkService(
|
||||
$this->conf,
|
||||
$this->pluginManager,
|
||||
$this->history,
|
||||
|
@ -714,7 +716,7 @@ class BookmarkFileServiceTest extends TestCase
|
|||
{
|
||||
unlink(self::$testDatastore);
|
||||
$this->assertFileNotExists(self::$testDatastore);
|
||||
$db = new \FakeBookmarkService($this->conf, $this->pluginManager, $this->history, $this->mutex, false);
|
||||
$db = new FakeBookmarkService($this->conf, $this->pluginManager, $this->history, $this->mutex, false);
|
||||
$this->assertFileNotExists(self::$testDatastore);
|
||||
$this->assertInstanceOf(BookmarkArray::class, $db->getBookmarks());
|
||||
$this->assertCount(0, $db->getBookmarks());
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
namespace Shaarli\Bookmark;
|
||||
|
||||
use malkusch\lock\mutex\NoMutex;
|
||||
use ReferenceLinkDB;
|
||||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\TestCase;
|
||||
use Shaarli\Tests\Utils\FakeBookmarkService;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
|
||||
/**
|
||||
* Class BookmarkFilterTest.
|
||||
|
@ -46,10 +47,10 @@ class BookmarkFilterTest extends TestCase
|
|||
$conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$conf->set('resource.datastore', self::$testDatastore);
|
||||
static::$pluginManager = new PluginManager($conf);
|
||||
self::$refDB = new \ReferenceLinkDB();
|
||||
self::$refDB = new ReferenceLinkDB();
|
||||
self::$refDB->write(self::$testDatastore);
|
||||
$history = new History('sandbox/history.php');
|
||||
self::$bookmarkService = new \FakeBookmarkService($conf, static::$pluginManager, $history, $mutex, true);
|
||||
self::$bookmarkService = new FakeBookmarkService($conf, static::$pluginManager, $history, $mutex, true);
|
||||
self::$linkFilter = new BookmarkFilter(self::$bookmarkService->getBookmarks(), $conf, static::$pluginManager);
|
||||
}
|
||||
|
||||
|
@ -417,28 +418,28 @@ class BookmarkFilterTest extends TestCase
|
|||
1,
|
||||
count(self::$linkFilter->filter(
|
||||
BookmarkFilter::$FILTER_TAG | BookmarkFilter::$FILTER_TEXT,
|
||||
array($tags, $terms)
|
||||
[$tags, $terms]
|
||||
))
|
||||
);
|
||||
$this->assertEquals(
|
||||
2,
|
||||
count(self::$linkFilter->filter(
|
||||
BookmarkFilter::$FILTER_TAG | BookmarkFilter::$FILTER_TEXT,
|
||||
array('', $terms)
|
||||
['', $terms]
|
||||
))
|
||||
);
|
||||
$this->assertEquals(
|
||||
1,
|
||||
count(self::$linkFilter->filter(
|
||||
BookmarkFilter::$FILTER_TAG | BookmarkFilter::$FILTER_TEXT,
|
||||
array(false, 'PSR-2')
|
||||
[false, 'PSR-2']
|
||||
))
|
||||
);
|
||||
$this->assertEquals(
|
||||
1,
|
||||
count(self::$linkFilter->filter(
|
||||
BookmarkFilter::$FILTER_TAG | BookmarkFilter::$FILTER_TEXT,
|
||||
array($tags, '')
|
||||
[$tags, '']
|
||||
))
|
||||
);
|
||||
$this->assertEquals(
|
||||
|
|
|
@ -7,6 +7,7 @@ use Shaarli\Config\ConfigManager;
|
|||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\TestCase;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
|
||||
/**
|
||||
* Class BookmarkInitializerTest
|
||||
|
@ -52,7 +53,7 @@ class BookmarkInitializerTest extends TestCase
|
|||
unlink(self::$testDatastore);
|
||||
}
|
||||
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf . '.json.php');
|
||||
$this->conf = new ConfigManager(self::$testConf);
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
$this->pluginManager = new PluginManager($this->conf);
|
||||
|
@ -73,7 +74,7 @@ class BookmarkInitializerTest extends TestCase
|
|||
*/
|
||||
public function testInitializeNotEmptyDataStore(): void
|
||||
{
|
||||
$refDB = new \ReferenceLinkDB();
|
||||
$refDB = new ReferenceLinkDB();
|
||||
$refDB->write(self::$testDatastore);
|
||||
$this->bookmarkService = new BookmarkFileService(
|
||||
$this->conf,
|
||||
|
|
|
@ -167,7 +167,7 @@ class BookmarkTest extends TestCase
|
|||
$exception = $e;
|
||||
}
|
||||
$this->assertNotNull($exception);
|
||||
$this->assertContainsPolyfill('- ID: '. PHP_EOL, $exception->getMessage());
|
||||
$this->assertContainsPolyfill('- ID: ' . PHP_EOL, $exception->getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +186,7 @@ class BookmarkTest extends TestCase
|
|||
$exception = $e;
|
||||
}
|
||||
$this->assertNotNull($exception);
|
||||
$this->assertContainsPolyfill('- ShortUrl: '. PHP_EOL, $exception->getMessage());
|
||||
$this->assertContainsPolyfill('- ShortUrl: ' . PHP_EOL, $exception->getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,7 +205,7 @@ class BookmarkTest extends TestCase
|
|||
$exception = $e;
|
||||
}
|
||||
$this->assertNotNull($exception);
|
||||
$this->assertContainsPolyfill('- Created: '. PHP_EOL, $exception->getMessage());
|
||||
$this->assertContainsPolyfill('- Created: ' . PHP_EOL, $exception->getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,8 +4,6 @@ namespace Shaarli\Bookmark;
|
|||
|
||||
use Shaarli\TestCase;
|
||||
|
||||
require_once 'tests/utils/CurlUtils.php';
|
||||
|
||||
/**
|
||||
* Class LinkUtilsTest.
|
||||
*/
|
||||
|
@ -142,7 +140,7 @@ class LinkUtilsTest extends TestCase
|
|||
$this->assertEquals($description, html_extract_tag('description', $html));
|
||||
|
||||
// OpenGraph multiple properties both end with noise
|
||||
$html = '<meta tag1="content1" property="og:unrelated1 og:description og:unrelated2" '.
|
||||
$html = '<meta tag1="content1" property="og:unrelated1 og:description og:unrelated2" ' .
|
||||
'tag2="content2" content="' . $description . '" tag3="content3">';
|
||||
$this->assertEquals($description, html_extract_tag('description', $html));
|
||||
|
||||
|
@ -159,7 +157,7 @@ class LinkUtilsTest extends TestCase
|
|||
$this->assertEquals($description, html_extract_tag('description', $html));
|
||||
|
||||
// OpenGraph reversed multiple properties both end with noise
|
||||
$html = '<meta tag1="content1" content="' . $description . '" tag2="content2" '.
|
||||
$html = '<meta tag1="content1" content="' . $description . '" tag2="content2" ' .
|
||||
'property="og:unrelated1 og:description og:unrelated2" tag3="content3">';
|
||||
$this->assertEquals($description, html_extract_tag('description', $html));
|
||||
|
||||
|
@ -178,7 +176,7 @@ class LinkUtilsTest extends TestCase
|
|||
$html = '<meta property="og:description" content="' . $description . '">';
|
||||
$this->assertEquals($description, html_extract_tag('description', $html));
|
||||
|
||||
$html = '<meta tag1="content1" property="og:unrelated1 og:description og:unrelated2" '.
|
||||
$html = '<meta tag1="content1" property="og:unrelated1 og:description og:unrelated2" ' .
|
||||
'tag2="content2" content="' . $description . '" tag3="content3">';
|
||||
$this->assertEquals($description, html_extract_tag('description', $html));
|
||||
|
||||
|
@ -190,7 +188,7 @@ class LinkUtilsTest extends TestCase
|
|||
$html = '<meta property="og:description" content=\'' . $description . '\'>';
|
||||
$this->assertEquals($description, html_extract_tag('description', $html));
|
||||
|
||||
$html = '<meta tag1="content1" property="og:unrelated1 og:description og:unrelated2" '.
|
||||
$html = '<meta tag1="content1" property="og:unrelated1 og:description og:unrelated2" ' .
|
||||
'tag2="content2" content=\'' . $description . '\' tag3="content3">';
|
||||
$this->assertEquals($description, html_extract_tag('description', $html));
|
||||
|
||||
|
@ -247,9 +245,9 @@ class LinkUtilsTest extends TestCase
|
|||
|
||||
public function testHtmlExtractDescriptionFromGoogleRealCase(): void
|
||||
{
|
||||
$html = 'id="gsr"><meta content="Fêtes de fin d\'année" property="twitter:title"><meta '.
|
||||
'content="Bonnes fêtes de fin d\'année ! #GoogleDoodle" property="twitter:description">'.
|
||||
'<meta content="Bonnes fêtes de fin d\'année ! #GoogleDoodle" property="og:description">'.
|
||||
$html = 'id="gsr"><meta content="Fêtes de fin d\'année" property="twitter:title"><meta ' .
|
||||
'content="Bonnes fêtes de fin d\'année ! #GoogleDoodle" property="twitter:description">' .
|
||||
'<meta content="Bonnes fêtes de fin d\'année ! #GoogleDoodle" property="og:description">' .
|
||||
'<meta content="summary_large_image" property="twitter:card"><meta co'
|
||||
;
|
||||
$this->assertSame('Bonnes fêtes de fin d\'année ! #GoogleDoodle', html_extract_tag('description', $html));
|
||||
|
@ -701,7 +699,10 @@ class LinkUtilsTest extends TestCase
|
|||
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter(['tag1', 'tag2', 'tag3'], $separator));
|
||||
static::assertSame(['tag1,', 'tag2@', 'tag3'], tags_filter(['tag1,', 'tag2@', 'tag3'], $separator));
|
||||
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter([' tag1 ', 'tag2', 'tag3 '], $separator));
|
||||
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter([' tag1 ', ' ', 'tag2', ' ', 'tag3 '], $separator));
|
||||
static::assertSame(
|
||||
['tag1', 'tag2', 'tag3'],
|
||||
tags_filter([' tag1 ', ' ', 'tag2', ' ', 'tag3 '], $separator)
|
||||
);
|
||||
static::assertSame(['tag1'], tags_filter([' tag1 '], $separator));
|
||||
static::assertSame([], tags_filter([' '], $separator));
|
||||
static::assertSame([], tags_filter([], $separator));
|
||||
|
@ -721,7 +722,10 @@ class LinkUtilsTest extends TestCase
|
|||
['tag1', 'tag2, and other', 'tag3'],
|
||||
tags_filter(['@@@@ tag1@@@', ' @tag2, and other @', 'tag3@@@@'], $separator)
|
||||
);
|
||||
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter(['@@@tag1@@@', '@', 'tag2', '@@@', 'tag3@@@'], $separator));
|
||||
static::assertSame(
|
||||
['tag1', 'tag2', 'tag3'],
|
||||
tags_filter(['@@@tag1@@@', '@', 'tag2', '@@@', 'tag3@@@'], $separator)
|
||||
);
|
||||
static::assertSame(['tag1'], tags_filter(['@@@@tag1@@@@'], $separator));
|
||||
static::assertSame([], tags_filter(['@@@'], $separator));
|
||||
static::assertSame([], tags_filter([], $separator));
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
use Shaarli\Tests\Utils\ReferenceSessionIdHashes;
|
||||
|
||||
$conf = new \Shaarli\Config\ConfigManager('tests/utils/config/configJson');
|
||||
new \Shaarli\Languages('en', $conf);
|
||||
|
||||
|
@ -13,23 +15,26 @@ if (!function_exists('is_iterable')) {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: remove this after fixing UT
|
||||
// raw functions
|
||||
require_once 'application/config/ConfigPlugin.php';
|
||||
require_once 'application/bookmark/LinkUtils.php';
|
||||
require_once 'application/Utils.php';
|
||||
require_once 'application/http/UrlUtils.php';
|
||||
require_once 'application/http/HttpUtils.php';
|
||||
require_once 'application/Utils.php';
|
||||
require_once 'application/TimeZone.php';
|
||||
require_once 'tests/utils/CurlUtils.php';
|
||||
require_once 'tests/utils/RainTPL.php';
|
||||
|
||||
// TODO: remove this after fixing UT
|
||||
require_once 'tests/TestCase.php';
|
||||
require_once 'tests/container/ShaarliTestContainer.php';
|
||||
require_once 'tests/front/controller/visitor/FrontControllerMockHelper.php';
|
||||
require_once 'tests/front/controller/admin/FrontAdminControllerMockHelper.php';
|
||||
require_once 'tests/updater/DummyUpdater.php';
|
||||
require_once 'tests/utils/FakeBookmarkService.php';
|
||||
require_once 'tests/utils/FakeConfigManager.php';
|
||||
require_once 'tests/utils/ReferenceHistory.php';
|
||||
require_once 'tests/utils/ReferenceLinkDB.php';
|
||||
require_once 'tests/utils/ReferenceSessionIdHashes.php';
|
||||
|
||||
\ReferenceSessionIdHashes::genAllHashes();
|
||||
ReferenceSessionIdHashes::genAllHashes();
|
||||
|
||||
if (!defined('SHAARLI_MUTEX_FILE')) {
|
||||
define('SHAARLI_MUTEX_FILE', __FILE__);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Config;
|
||||
|
||||
/**
|
||||
|
@ -29,13 +30,13 @@ class ConfigManagerTest extends \Shaarli\TestCase
|
|||
$this->conf->set('paramInt', 42);
|
||||
$this->conf->set('paramString', 'value1');
|
||||
$this->conf->set('paramBool', false);
|
||||
$this->conf->set('paramArray', array('foo' => 'bar'));
|
||||
$this->conf->set('paramArray', ['foo' => 'bar']);
|
||||
$this->conf->set('paramNull', null);
|
||||
|
||||
$this->assertEquals(42, $this->conf->get('paramInt'));
|
||||
$this->assertEquals('value1', $this->conf->get('paramString'));
|
||||
$this->assertFalse($this->conf->get('paramBool'));
|
||||
$this->assertEquals(array('foo' => 'bar'), $this->conf->get('paramArray'));
|
||||
$this->assertEquals(['foo' => 'bar'], $this->conf->get('paramArray'));
|
||||
$this->assertEquals(null, $this->conf->get('paramNull'));
|
||||
}
|
||||
|
||||
|
@ -51,7 +52,7 @@ class ConfigManagerTest extends \Shaarli\TestCase
|
|||
$this->conf->set('paramInt', 42);
|
||||
$this->conf->set('paramString', 'value1');
|
||||
$this->conf->set('paramBool', false);
|
||||
$this->conf->set('paramArray', array('foo' => 'bar'));
|
||||
$this->conf->set('paramArray', ['foo' => 'bar']);
|
||||
$this->conf->set('paramNull', null);
|
||||
|
||||
$this->conf->setConfigFile('tests/utils/config/configTmp');
|
||||
|
@ -62,7 +63,7 @@ class ConfigManagerTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(42, $this->conf->get('paramInt'));
|
||||
$this->assertEquals('value1', $this->conf->get('paramString'));
|
||||
$this->assertFalse($this->conf->get('paramBool'));
|
||||
$this->assertEquals(array('foo' => 'bar'), $this->conf->get('paramArray'));
|
||||
$this->assertEquals(['foo' => 'bar'], $this->conf->get('paramArray'));
|
||||
$this->assertEquals(null, $this->conf->get('paramNull'));
|
||||
}
|
||||
|
||||
|
@ -112,7 +113,7 @@ class ConfigManagerTest extends \Shaarli\TestCase
|
|||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessageRegExp('#^Invalid setting key parameter. String expected, got.*#');
|
||||
|
||||
$this->conf->set(array('foo' => 'bar'), 'stuff');
|
||||
$this->conf->set(['foo' => 'bar'], 'stuff');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Config;
|
||||
|
||||
/**
|
||||
|
@ -37,7 +38,7 @@ class ConfigPhpTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testReadNonExistent()
|
||||
{
|
||||
$this->assertEquals(array(), $this->configIO->read('nope'));
|
||||
$this->assertEquals([], $this->configIO->read('nope'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,16 +61,16 @@ class ConfigPhpTest extends \Shaarli\TestCase
|
|||
public function testWriteNew()
|
||||
{
|
||||
$dataFile = 'tests/utils/config/configWrite.php';
|
||||
$data = array(
|
||||
$data = [
|
||||
'login' => 'root',
|
||||
'redirector' => 'lala',
|
||||
'config' => array(
|
||||
'config' => [
|
||||
'DATASTORE' => 'data/datastore.php',
|
||||
),
|
||||
'plugins' => array(
|
||||
],
|
||||
'plugins' => [
|
||||
'WALLABAG_VERSION' => '1',
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
$this->configIO->write($dataFile, $data);
|
||||
$expected = '<?php
|
||||
$GLOBALS[\'login\'] = \'root\';
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Config;
|
||||
|
||||
use Shaarli\Config\Exception\PluginConfigOrderException;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
|
||||
require_once 'application/config/ConfigPlugin.php';
|
||||
use Shaarli\TestCase;
|
||||
|
||||
/**
|
||||
* Unitary tests for Shaarli config related functions
|
||||
*/
|
||||
class ConfigPluginTest extends \Shaarli\TestCase
|
||||
class ConfigPluginTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test save_plugin_config with valid data.
|
||||
|
@ -35,12 +35,16 @@ class ConfigPluginTest extends \Shaarli\TestCase
|
|||
|
||||
mkdir($path = __DIR__ . '/folder');
|
||||
PluginManager::$PLUGINS_PATH = $path;
|
||||
array_map(function (string $plugin) use ($path) { touch($path . '/' . $plugin); }, $expected);
|
||||
array_map(function (string $plugin) use ($path) {
|
||||
touch($path . '/' . $plugin);
|
||||
}, $expected);
|
||||
|
||||
$out = save_plugin_config($data);
|
||||
$this->assertEquals($expected, $out);
|
||||
|
||||
array_map(function (string $plugin) use ($path) { unlink($path . '/' . $plugin); }, $expected);
|
||||
array_map(function (string $plugin) use ($path) {
|
||||
unlink($path . '/' . $plugin);
|
||||
}, $expected);
|
||||
rmdir($path);
|
||||
}
|
||||
|
||||
|
@ -49,15 +53,15 @@ class ConfigPluginTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testSavePluginConfigInvalid()
|
||||
{
|
||||
$this->expectException(\Shaarli\Config\Exception\PluginConfigOrderException::class);
|
||||
$this->expectException(PluginConfigOrderException::class);
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'plugin2' => 0,
|
||||
'plugin3' => 0,
|
||||
'order_plugin3' => 0,
|
||||
'plugin4' => 0,
|
||||
'order_plugin4' => 0,
|
||||
);
|
||||
];
|
||||
|
||||
save_plugin_config($data);
|
||||
}
|
||||
|
@ -67,7 +71,7 @@ class ConfigPluginTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testSavePluginConfigEmpty()
|
||||
{
|
||||
$this->assertEquals(array(), save_plugin_config(array()));
|
||||
$this->assertEquals([], save_plugin_config([]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,14 +79,14 @@ class ConfigPluginTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testValidatePluginOrderValid()
|
||||
{
|
||||
$data = array(
|
||||
$data = [
|
||||
'order_plugin1' => 2,
|
||||
'plugin2' => 0,
|
||||
'plugin3' => 0,
|
||||
'order_plugin3' => 1,
|
||||
'plugin4' => 0,
|
||||
'order_plugin4' => 5,
|
||||
);
|
||||
];
|
||||
|
||||
$this->assertTrue(validate_plugin_order($data));
|
||||
}
|
||||
|
@ -92,11 +96,11 @@ class ConfigPluginTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testValidatePluginOrderInvalid()
|
||||
{
|
||||
$data = array(
|
||||
$data = [
|
||||
'order_plugin1' => 2,
|
||||
'order_plugin3' => 1,
|
||||
'order_plugin4' => 1,
|
||||
);
|
||||
];
|
||||
|
||||
$this->assertFalse(validate_plugin_order($data));
|
||||
}
|
||||
|
@ -106,20 +110,20 @@ class ConfigPluginTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testLoadPluginParameterValues()
|
||||
{
|
||||
$plugins = array(
|
||||
'plugin_name' => array(
|
||||
'parameters' => array(
|
||||
'param1' => array('value' => true),
|
||||
'param2' => array('value' => false),
|
||||
'param3' => array('value' => ''),
|
||||
)
|
||||
)
|
||||
);
|
||||
$plugins = [
|
||||
'plugin_name' => [
|
||||
'parameters' => [
|
||||
'param1' => ['value' => true],
|
||||
'param2' => ['value' => false],
|
||||
'param3' => ['value' => ''],
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$parameters = array(
|
||||
$parameters = [
|
||||
'param1' => 'value1',
|
||||
'param2' => 'value2',
|
||||
);
|
||||
];
|
||||
|
||||
$result = load_plugin_parameter_values($plugins, $parameters);
|
||||
$this->assertEquals('value1', $result['plugin_name']['parameters']['param1']['value']);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PageCache tests
|
||||
*/
|
||||
|
||||
namespace Shaarli\Feed;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace Shaarli\Feed;
|
|||
|
||||
use DateTime;
|
||||
use malkusch\lock\mutex\NoMutex;
|
||||
use ReferenceLinkDB;
|
||||
use Shaarli\Bookmark\Bookmark;
|
||||
use Shaarli\Bookmark\BookmarkFileService;
|
||||
use Shaarli\Bookmark\LinkDB;
|
||||
|
@ -13,6 +12,7 @@ use Shaarli\Formatter\FormatterFactory;
|
|||
use Shaarli\History;
|
||||
use Shaarli\Plugin\PluginManager;
|
||||
use Shaarli\TestCase;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
|
||||
/**
|
||||
* FeedBuilderTest class.
|
||||
|
@ -52,7 +52,7 @@ class FeedBuilderTest extends TestCase
|
|||
$mutex = new NoMutex();
|
||||
$conf = new ConfigManager('tests/utils/config/configJson');
|
||||
$conf->set('resource.datastore', self::$testDatastore);
|
||||
$refLinkDB = new \ReferenceLinkDB();
|
||||
$refLinkDB = new ReferenceLinkDB();
|
||||
$refLinkDB->write(self::$testDatastore);
|
||||
$history = new History('sandbox/history.php');
|
||||
$factory = new FormatterFactory($conf, true);
|
||||
|
@ -66,13 +66,13 @@ class FeedBuilderTest extends TestCase
|
|||
true
|
||||
);
|
||||
|
||||
self::$serverInfo = array(
|
||||
self::$serverInfo = [
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/index.php',
|
||||
'REQUEST_URI' => '/feed/atom',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,7 +100,10 @@ class FeedBuilderTest extends TestCase
|
|||
// Test first not pinned link (note link)
|
||||
$link = $data['links'][array_keys($data['links'])[0]];
|
||||
$this->assertEquals(41, $link['id']);
|
||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
|
||||
$this->assertEquals(
|
||||
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'),
|
||||
$link['created']
|
||||
);
|
||||
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
|
||||
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']);
|
||||
$this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']);
|
||||
|
@ -149,10 +152,10 @@ class FeedBuilderTest extends TestCase
|
|||
*/
|
||||
public function testBuildDataFiltered()
|
||||
{
|
||||
$criteria = array(
|
||||
$criteria = [
|
||||
'searchtags' => 'stuff',
|
||||
'searchterm' => 'beard',
|
||||
);
|
||||
];
|
||||
$feedBuilder = new FeedBuilder(
|
||||
self::$bookmarkService,
|
||||
self::$formatter,
|
||||
|
@ -164,7 +167,10 @@ class FeedBuilderTest extends TestCase
|
|||
$this->assertEquals(1, count($data['links']));
|
||||
$link = array_shift($data['links']);
|
||||
$this->assertEquals(41, $link['id']);
|
||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
|
||||
$this->assertEquals(
|
||||
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'),
|
||||
$link['created']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,9 +178,9 @@ class FeedBuilderTest extends TestCase
|
|||
*/
|
||||
public function testBuildDataCount()
|
||||
{
|
||||
$criteria = array(
|
||||
$criteria = [
|
||||
'nb' => '3',
|
||||
);
|
||||
];
|
||||
$feedBuilder = new FeedBuilder(
|
||||
self::$bookmarkService,
|
||||
self::$formatter,
|
||||
|
@ -186,7 +192,10 @@ class FeedBuilderTest extends TestCase
|
|||
$this->assertEquals(3, count($data['links']));
|
||||
$link = $data['links'][array_keys($data['links'])[0]];
|
||||
$this->assertEquals(41, $link['id']);
|
||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
|
||||
$this->assertEquals(
|
||||
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'),
|
||||
$link['created']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,7 +217,10 @@ class FeedBuilderTest extends TestCase
|
|||
// First link is a permalink
|
||||
$link = $data['links'][array_keys($data['links'])[0]];
|
||||
$this->assertEquals(41, $link['id']);
|
||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
|
||||
$this->assertEquals(
|
||||
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'),
|
||||
$link['created']
|
||||
);
|
||||
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
|
||||
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']);
|
||||
$this->assertContainsPolyfill('Direct link', $link['description']);
|
||||
|
@ -216,7 +228,10 @@ class FeedBuilderTest extends TestCase
|
|||
// Second link is a direct link
|
||||
$link = $data['links'][array_keys($data['links'])[1]];
|
||||
$this->assertEquals(8, $link['id']);
|
||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']);
|
||||
$this->assertEquals(
|
||||
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'),
|
||||
$link['created']
|
||||
);
|
||||
$this->assertEquals('http://host.tld/shaare/RttfEw', $link['guid']);
|
||||
$this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']);
|
||||
$this->assertContainsPolyfill('Direct link', $link['description']);
|
||||
|
@ -259,13 +274,13 @@ class FeedBuilderTest extends TestCase
|
|||
*/
|
||||
public function testBuildDataServerSubdir()
|
||||
{
|
||||
$serverInfo = array(
|
||||
$serverInfo = [
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '8080',
|
||||
'SCRIPT_NAME' => '/~user/shaarli/index.php',
|
||||
'REQUEST_URI' => '/~user/shaarli/feed/atom',
|
||||
);
|
||||
];
|
||||
$feedBuilder = new FeedBuilder(
|
||||
self::$bookmarkService,
|
||||
self::$formatter,
|
||||
|
|
|
@ -27,7 +27,7 @@ class BookmarkDefaultFormatterTest extends TestCase
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf . '.json.php');
|
||||
$this->conf = new ConfigManager(self::$testConf);
|
||||
$this->formatter = new BookmarkDefaultFormatter($this->conf, true);
|
||||
}
|
||||
|
@ -112,9 +112,9 @@ class BookmarkDefaultFormatterTest extends TestCase
|
|||
{
|
||||
$description = [];
|
||||
$description[] = 'This a <strong>description</strong>' . PHP_EOL;
|
||||
$description[] = 'text https://sub.domain.tld?query=here&for=real#hash more text'. PHP_EOL;
|
||||
$description[] = 'Also, there is an #hashtag added'. PHP_EOL;
|
||||
$description[] = ' A N D KEEP SPACES ! '. PHP_EOL;
|
||||
$description[] = 'text https://sub.domain.tld?query=here&for=real#hash more text' . PHP_EOL;
|
||||
$description[] = 'Also, there is an #hashtag added' . PHP_EOL;
|
||||
$description[] = ' A N D KEEP SPACES ! ' . PHP_EOL;
|
||||
|
||||
$bookmark = new Bookmark();
|
||||
$bookmark->setDescription(implode('', $description));
|
||||
|
@ -122,10 +122,10 @@ class BookmarkDefaultFormatterTest extends TestCase
|
|||
|
||||
$description[0] = 'This a <strong>description</strong><br />';
|
||||
$url = 'https://sub.domain.tld?query=here&for=real#hash';
|
||||
$description[1] = 'text <a href="'. $url .'">'. $url .'</a> more text<br />';
|
||||
$description[2] = 'Also, there is an <a href="./add-tag/hashtag" '.
|
||||
$description[1] = 'text <a href="' . $url . '">' . $url . '</a> more text<br />';
|
||||
$description[2] = 'Also, there is an <a href="./add-tag/hashtag" ' .
|
||||
'title="Hashtag hashtag">#hashtag</a> added<br />';
|
||||
$description[3] = ' A N D KEEP '.
|
||||
$description[3] = ' A N D KEEP ' .
|
||||
'SPACES ! <br />';
|
||||
|
||||
$this->assertEquals(implode(PHP_EOL, $description) . PHP_EOL, $link['description']);
|
||||
|
@ -148,7 +148,7 @@ class BookmarkDefaultFormatterTest extends TestCase
|
|||
$this->assertEquals($root . $short, $link['url']);
|
||||
$this->assertEquals($root . $short, $link['real_url']);
|
||||
$this->assertEquals(
|
||||
'Text <a href="'. $root .'./add-tag/hashtag" title="Hashtag hashtag">'.
|
||||
'Text <a href="' . $root . './add-tag/hashtag" title="Hashtag hashtag">' .
|
||||
'#hashtag</a> more text',
|
||||
$link['description']
|
||||
);
|
||||
|
|
|
@ -27,7 +27,7 @@ class BookmarkMarkdownExtraFormatterTest extends TestCase
|
|||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf . '.json.php');
|
||||
$this->conf = new ConfigManager(self::$testConf);
|
||||
$this->formatter = new BookmarkMarkdownExtraFormatter($this->conf, true);
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class BookmarkMarkdownExtraFormatterTest extends TestCase
|
|||
);
|
||||
$this->assertEquals('This is a <strong>bookmark</strong>', $link['title']);
|
||||
$this->assertEquals(
|
||||
'<div class="markdown"><p>'.
|
||||
'<h2>Content</h2><p>`Here is some content</p>'.
|
||||
'<div class="markdown"><p>' .
|
||||
'<h2>Content</h2><p>`Here is some content</p>' .
|
||||
'</p></div>',
|
||||
$link['description']
|
||||
);
|
||||
|
@ -112,21 +112,21 @@ class BookmarkMarkdownExtraFormatterTest extends TestCase
|
|||
*/
|
||||
public function testFormatExtrraDescription(): void
|
||||
{
|
||||
$description = 'This a <strong>description</strong>'. PHP_EOL;
|
||||
$description .= 'text https://sub.domain.tld?query=here&for=real#hash more text'. PHP_EOL;
|
||||
$description .= 'Also, there is an #hashtag added'. PHP_EOL;
|
||||
$description .= ' A N D KEEP SPACES ! '. PHP_EOL;
|
||||
$description .= '# Header {.class}'. PHP_EOL;
|
||||
$description = 'This a <strong>description</strong>' . PHP_EOL;
|
||||
$description .= 'text https://sub.domain.tld?query=here&for=real#hash more text' . PHP_EOL;
|
||||
$description .= 'Also, there is an #hashtag added' . PHP_EOL;
|
||||
$description .= ' A N D KEEP SPACES ! ' . PHP_EOL;
|
||||
$description .= '# Header {.class}' . PHP_EOL;
|
||||
|
||||
$bookmark = new Bookmark();
|
||||
$bookmark->setDescription($description);
|
||||
$link = $this->formatter->format($bookmark);
|
||||
|
||||
$description = '<div class="markdown"><p>';
|
||||
$description .= 'This a <strong>description</strong><br />'. PHP_EOL;
|
||||
$description .= 'This a <strong>description</strong><br />' . PHP_EOL;
|
||||
$url = 'https://sub.domain.tld?query=here&for=real#hash';
|
||||
$description .= 'text <a href="'. $url .'">'. $url .'</a> more text<br />'. PHP_EOL;
|
||||
$description .= 'Also, there is an <a href="./add-tag/hashtag">#hashtag</a> added<br />'. PHP_EOL;
|
||||
$description .= 'text <a href="' . $url . '">' . $url . '</a> more text<br />' . PHP_EOL;
|
||||
$description .= 'Also, there is an <a href="./add-tag/hashtag">#hashtag</a> added<br />' . PHP_EOL;
|
||||
$description .= 'A N D KEEP SPACES ! </p>' . PHP_EOL;
|
||||
$description .= '<h1 class="class">Header</h1>';
|
||||
$description .= '</div>';
|
||||
|
@ -148,7 +148,7 @@ class BookmarkMarkdownExtraFormatterTest extends TestCase
|
|||
$this->formatter->addContextData('index_url', $root = 'https://domain.tld/hithere/');
|
||||
|
||||
$description = '<div class="markdown"><p>';
|
||||
$description .= 'Text <a href="'. $root .'./add-tag/hashtag">#hashtag</a> more text';
|
||||
$description .= 'Text <a href="' . $root . './add-tag/hashtag">#hashtag</a> more text';
|
||||
$description .= '</p></div>';
|
||||
|
||||
$link = $this->formatter->format($bookmark);
|
||||
|
|
|
@ -27,7 +27,7 @@ class BookmarkMarkdownFormatterTest extends TestCase
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf . '.json.php');
|
||||
$this->conf = new ConfigManager(self::$testConf);
|
||||
$this->formatter = new BookmarkMarkdownFormatter($this->conf, true);
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class BookmarkMarkdownFormatterTest extends TestCase
|
|||
);
|
||||
$this->assertEquals('This is a <strong>bookmark</strong>', $link['title']);
|
||||
$this->assertEquals(
|
||||
'<div class="markdown"><p>'.
|
||||
'<h2>Content</h2><p>`Here is some content</p>'.
|
||||
'<div class="markdown"><p>' .
|
||||
'<h2>Content</h2><p>`Here is some content</p>' .
|
||||
'</p></div>',
|
||||
$link['description']
|
||||
);
|
||||
|
@ -112,20 +112,20 @@ class BookmarkMarkdownFormatterTest extends TestCase
|
|||
*/
|
||||
public function testFormatDescription()
|
||||
{
|
||||
$description = 'This a <strong>description</strong>'. PHP_EOL;
|
||||
$description .= 'text https://sub.domain.tld?query=here&for=real#hash more text'. PHP_EOL;
|
||||
$description .= 'Also, there is an #hashtag added'. PHP_EOL;
|
||||
$description .= ' A N D KEEP SPACES ! '. PHP_EOL;
|
||||
$description = 'This a <strong>description</strong>' . PHP_EOL;
|
||||
$description .= 'text https://sub.domain.tld?query=here&for=real#hash more text' . PHP_EOL;
|
||||
$description .= 'Also, there is an #hashtag added' . PHP_EOL;
|
||||
$description .= ' A N D KEEP SPACES ! ' . PHP_EOL;
|
||||
|
||||
$bookmark = new Bookmark();
|
||||
$bookmark->setDescription($description);
|
||||
$link = $this->formatter->format($bookmark);
|
||||
|
||||
$description = '<div class="markdown"><p>';
|
||||
$description .= 'This a <strong>description</strong><br />'. PHP_EOL;
|
||||
$description .= 'This a <strong>description</strong><br />' . PHP_EOL;
|
||||
$url = 'https://sub.domain.tld?query=here&for=real#hash';
|
||||
$description .= 'text <a href="'. $url .'">'. $url .'</a> more text<br />'. PHP_EOL;
|
||||
$description .= 'Also, there is an <a href="./add-tag/hashtag">#hashtag</a> added<br />'. PHP_EOL;
|
||||
$description .= 'text <a href="' . $url . '">' . $url . '</a> more text<br />' . PHP_EOL;
|
||||
$description .= 'Also, there is an <a href="./add-tag/hashtag">#hashtag</a> added<br />' . PHP_EOL;
|
||||
$description .= 'A N D KEEP SPACES ! ';
|
||||
$description .= '</p></div>';
|
||||
|
||||
|
@ -137,11 +137,11 @@ class BookmarkMarkdownFormatterTest extends TestCase
|
|||
*/
|
||||
public function testFormatDescriptionWithSearchHighlight()
|
||||
{
|
||||
$description = 'This a <strong>description</strong>'. PHP_EOL;
|
||||
$description .= 'text https://sub.domain.tld?query=here&for=real#hash more text'. PHP_EOL;
|
||||
$description .= 'Also, there is an #hashtag added'. PHP_EOL;
|
||||
$description .= ' A N D KEEP SPACES ! '. PHP_EOL;
|
||||
$description .= 'And [yet another link](https://other.domain.tld)'. PHP_EOL;
|
||||
$description = 'This a <strong>description</strong>' . PHP_EOL;
|
||||
$description .= 'text https://sub.domain.tld?query=here&for=real#hash more text' . PHP_EOL;
|
||||
$description .= 'Also, there is an #hashtag added' . PHP_EOL;
|
||||
$description .= ' A N D KEEP SPACES ! ' . PHP_EOL;
|
||||
$description .= 'And [yet another link](https://other.domain.tld)' . PHP_EOL;
|
||||
|
||||
$bookmark = new Bookmark();
|
||||
$bookmark->setDescription($description);
|
||||
|
@ -164,9 +164,9 @@ class BookmarkMarkdownFormatterTest extends TestCase
|
|||
$url = 'https://sub.domain.tld?query=here&for=real#hash';
|
||||
$highlighted = 'https://<span class="search-highlight">sub</span>.domain.tld';
|
||||
$highlighted .= '?query=here&for=real#<span class="search-highlight">hash</span>';
|
||||
$description .= 'text <a href="'. $url .'">'. $highlighted .'</a> more text<br />'. PHP_EOL;
|
||||
$description .= 'text <a href="' . $url . '">' . $highlighted . '</a> more text<br />' . PHP_EOL;
|
||||
$description .= 'Also, there is an <a href="./add-tag/hashtag">#<span class="search-highlight">hasht</span>' .
|
||||
'ag</a> added<br />'. PHP_EOL;
|
||||
'ag</a> added<br />' . PHP_EOL;
|
||||
$description .= 'A N D KEEP SPACES !<br />' . PHP_EOL;
|
||||
$description .= 'And <a href="https://other.domain.tld">' .
|
||||
'<span class="search-highlight">yet another link</span></a>';
|
||||
|
@ -189,7 +189,7 @@ class BookmarkMarkdownFormatterTest extends TestCase
|
|||
$this->formatter->addContextData('index_url', $root = 'https://domain.tld/hithere/');
|
||||
|
||||
$description = '<div class="markdown"><p>';
|
||||
$description .= 'Text <a href="'. $root .'./add-tag/hashtag">#hashtag</a> more text';
|
||||
$description .= 'Text <a href="' . $root . './add-tag/hashtag">#hashtag</a> more text';
|
||||
$description .= '</p></div>';
|
||||
|
||||
$link = $this->formatter->format($bookmark);
|
||||
|
|
|
@ -27,7 +27,7 @@ class BookmarkRawFormatterTest extends TestCase
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf . '.json.php');
|
||||
$this->conf = new ConfigManager(self::$testConf);
|
||||
$this->formatter = new BookmarkRawFormatter($this->conf, true);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class FormatterFactoryTest extends TestCase
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php');
|
||||
copy('tests/utils/config/configJson.json.php', self::$testConf . '.json.php');
|
||||
$this->conf = new ConfigManager(self::$testConf);
|
||||
$this->factory = new FormatterFactory($this->conf, true);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ class ShaarliAdminMiddlewareTest extends TestCase
|
|||
$response = new Response();
|
||||
|
||||
/** @var Response $result */
|
||||
$result = $this->middleware->__invoke($request, $response, function () {});
|
||||
$result = $this->middleware->__invoke($request, $response, function () {
|
||||
});
|
||||
|
||||
static::assertSame(302, $result->getStatusCode());
|
||||
static::assertSame(
|
||||
|
|
|
@ -91,7 +91,7 @@ class ShaarliMiddlewareTest extends TestCase
|
|||
$controller = function (): void {
|
||||
$exception = new LoginBannedException();
|
||||
|
||||
throw new $exception;
|
||||
throw new $exception();
|
||||
};
|
||||
|
||||
$pageBuilder = $this->createMock(PageBuilder::class);
|
||||
|
@ -148,7 +148,8 @@ class ShaarliMiddlewareTest extends TestCase
|
|||
return $uri;
|
||||
});
|
||||
|
||||
$dummyException = new class() extends \Exception {};
|
||||
$dummyException = new class () extends \Exception {
|
||||
};
|
||||
|
||||
$response = new Response();
|
||||
$controller = function () use ($dummyException): void {
|
||||
|
|
|
@ -62,7 +62,7 @@ class ConfigureControllerTest extends TestCase
|
|||
static::assertSame('privacy.hide_public_links', $assignedVariables['hide_public_links']);
|
||||
static::assertSame('api.enabled', $assignedVariables['api_enabled']);
|
||||
static::assertSame('api.secret', $assignedVariables['api_secret']);
|
||||
static::assertCount(6, $assignedVariables['languages']);
|
||||
static::assertCount(7, $assignedVariables['languages']);
|
||||
static::assertArrayHasKey('gd_enabled', $assignedVariables);
|
||||
static::assertSame('thumbnails.mode', $assignedVariables['thumbnails_mode']);
|
||||
}
|
||||
|
@ -122,8 +122,7 @@ class ConfigureControllerTest extends TestCase
|
|||
}
|
||||
|
||||
return $parameters[$key];
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$response = new Response();
|
||||
|
||||
|
@ -137,8 +136,7 @@ class ConfigureControllerTest extends TestCase
|
|||
}
|
||||
|
||||
static::assertSame($parametersConfigMapping[$key], $value);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$result = $this->controller->save($request, $response);
|
||||
static::assertSame(302, $result->getStatusCode());
|
||||
|
|
|
@ -80,7 +80,10 @@ class ExportControllerTest extends TestCase
|
|||
string $selection,
|
||||
bool $prependNoteUrl,
|
||||
string $indexUrl
|
||||
) use ($parameters, $bookmarks): array {
|
||||
) use (
|
||||
$parameters,
|
||||
$bookmarks
|
||||
): array {
|
||||
static::assertInstanceOf(BookmarkRawFormatter::class, $formatter);
|
||||
static::assertSame($parameters['selection'], $selection);
|
||||
static::assertTrue($prependNoteUrl);
|
||||
|
|
|
@ -74,7 +74,10 @@ class ImportControllerTest extends TestCase
|
|||
function (
|
||||
array $post,
|
||||
UploadedFileInterface $file
|
||||
) use ($parameters, $requestFile): string {
|
||||
) use (
|
||||
$parameters,
|
||||
$requestFile
|
||||
): string {
|
||||
static::assertSame($parameters, $post);
|
||||
static::assertSame($requestFile, $file);
|
||||
|
||||
|
|
|
@ -52,12 +52,12 @@ class PasswordControllerTest extends TestCase
|
|||
{
|
||||
$request = $this->createMock(Request::class);
|
||||
$request->method('getParam')->willReturnCallback(function (string $key): string {
|
||||
if ('oldpassword' === $key) {
|
||||
return 'old';
|
||||
}
|
||||
if ('setpassword' === $key) {
|
||||
return 'new';
|
||||
}
|
||||
if ('oldpassword' === $key) {
|
||||
return 'old';
|
||||
}
|
||||
if ('setpassword' === $key) {
|
||||
return 'new';
|
||||
}
|
||||
|
||||
return $key;
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ class PluginsControllerTest extends TestCase
|
|||
{
|
||||
use FrontAdminControllerMockHelper;
|
||||
|
||||
const PLUGIN_NAMES = ['plugin1', 'plugin2', 'plugin3', 'plugin4'];
|
||||
protected const PLUGIN_NAMES = ['plugin1', 'plugin2', 'plugin3', 'plugin4'];
|
||||
|
||||
/** @var PluginsController */
|
||||
protected $controller;
|
||||
|
@ -29,13 +29,17 @@ class PluginsControllerTest extends TestCase
|
|||
|
||||
mkdir($path = __DIR__ . '/folder');
|
||||
PluginManager::$PLUGINS_PATH = $path;
|
||||
array_map(function (string $plugin) use ($path) { touch($path . '/' . $plugin); }, static::PLUGIN_NAMES);
|
||||
array_map(function (string $plugin) use ($path) {
|
||||
touch($path . '/' . $plugin);
|
||||
}, static::PLUGIN_NAMES);
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
{
|
||||
$path = __DIR__ . '/folder';
|
||||
array_map(function (string $plugin) use ($path) { unlink($path . '/' . $plugin); }, static::PLUGIN_NAMES);
|
||||
array_map(function (string $plugin) use ($path) {
|
||||
unlink($path . '/' . $plugin);
|
||||
}, static::PLUGIN_NAMES);
|
||||
rmdir($path);
|
||||
}
|
||||
|
||||
|
|
|
@ -365,5 +365,4 @@ class SaveBookmarkTest extends TestCase
|
|||
|
||||
$this->controller->save($request, $response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class ShaarliAdminControllerTest extends TestCase
|
|||
{
|
||||
$this->createContainer();
|
||||
|
||||
$this->controller = new class($this->container) extends ShaarliAdminController
|
||||
$this->controller = new class ($this->container) extends ShaarliAdminController
|
||||
{
|
||||
public function checkToken(Request $request): bool
|
||||
{
|
||||
|
|
|
@ -54,8 +54,7 @@ class BookmarkListControllerTest extends TestCase
|
|||
(new Bookmark())->setId(1)->setUrl('http://url1.tld')->setTitle('Title 1'),
|
||||
(new Bookmark())->setId(2)->setUrl('http://url2.tld')->setTitle('Title 2'),
|
||||
(new Bookmark())->setId(3)->setUrl('http://url3.tld')->setTitle('Title 3'),
|
||||
], 0, 2)
|
||||
);
|
||||
], 0, 2));
|
||||
|
||||
$this->container->sessionManager
|
||||
->method('getSessionParameter')
|
||||
|
|
|
@ -102,7 +102,7 @@ class DailyControllerTest extends TestCase
|
|||
static::assertSame(200, $result->getStatusCode());
|
||||
static::assertSame('daily', (string) $result->getBody());
|
||||
static::assertSame(
|
||||
'Daily - '. format_date($currentDay, false, true) .' - Shaarli',
|
||||
'Daily - ' . format_date($currentDay, false, true) . ' - Shaarli',
|
||||
$assignedVariables['pagetitle']
|
||||
);
|
||||
static::assertEquals($currentDay, $assignedVariables['dayDate']);
|
||||
|
@ -225,7 +225,7 @@ class DailyControllerTest extends TestCase
|
|||
static::assertSame(200, $result->getStatusCode());
|
||||
static::assertSame('daily', (string) $result->getBody());
|
||||
static::assertSame(
|
||||
'Daily - '. format_date($currentDay, false, true) .' - Shaarli',
|
||||
'Daily - ' . format_date($currentDay, false, true) . ' - Shaarli',
|
||||
$assignedVariables['pagetitle']
|
||||
);
|
||||
static::assertCount(1, $assignedVariables['linksToDisplay']);
|
||||
|
@ -285,7 +285,9 @@ class DailyControllerTest extends TestCase
|
|||
static::assertCount(7, $assignedVariables['linksToDisplay']);
|
||||
|
||||
$columnIds = function (array $column): array {
|
||||
return array_map(function (array $item): int { return $item['id']; }, $column);
|
||||
return array_map(function (array $item): int {
|
||||
return $item['id'];
|
||||
}, $column);
|
||||
};
|
||||
|
||||
static::assertSame([1, 4, 6], $columnIds($assignedVariables['cols'][0]));
|
||||
|
@ -366,8 +368,7 @@ class DailyControllerTest extends TestCase
|
|||
$cachedPage->expects(static::once())->method('cache')->with('dailyrss');
|
||||
|
||||
return $cachedPage;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Save RainTPL assigned variables
|
||||
$assignedVariables = [];
|
||||
|
@ -390,7 +391,7 @@ class DailyControllerTest extends TestCase
|
|||
static::assertEquals($date, $day['date']);
|
||||
static::assertSame($date->format(\DateTime::RSS), $day['date_rss']);
|
||||
static::assertSame(format_date($date, false), $day['date_human']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?day='. $dates[0]->format('Ymd'), $day['absolute_url']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?day=' . $dates[0]->format('Ymd'), $day['absolute_url']);
|
||||
static::assertCount(1, $day['links']);
|
||||
static::assertSame(1, $day['links'][0]['id']);
|
||||
static::assertSame('http://domain.tld/1', $day['links'][0]['url']);
|
||||
|
@ -402,7 +403,7 @@ class DailyControllerTest extends TestCase
|
|||
static::assertEquals($date, $day['date']);
|
||||
static::assertSame($date->format(\DateTime::RSS), $day['date_rss']);
|
||||
static::assertSame(format_date($date, false), $day['date_human']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?day='. $dates[1]->format('Ymd'), $day['absolute_url']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?day=' . $dates[1]->format('Ymd'), $day['absolute_url']);
|
||||
static::assertCount(2, $day['links']);
|
||||
|
||||
static::assertSame(2, $day['links'][0]['id']);
|
||||
|
@ -418,7 +419,7 @@ class DailyControllerTest extends TestCase
|
|||
static::assertEquals($date, $day['date']);
|
||||
static::assertSame($date->format(\DateTime::RSS), $day['date_rss']);
|
||||
static::assertSame(format_date($date, false), $day['date_human']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?day='. $dates[2]->format('Ymd'), $day['absolute_url']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?day=' . $dates[2]->format('Ymd'), $day['absolute_url']);
|
||||
static::assertCount(1, $day['links']);
|
||||
static::assertSame(4, $day['links'][0]['id']);
|
||||
static::assertSame('http://domain.tld/4', $day['links'][0]['url']);
|
||||
|
@ -647,7 +648,7 @@ class DailyControllerTest extends TestCase
|
|||
static::assertEquals($date, $day['date']);
|
||||
static::assertSame($date->format(\DateTime::RSS), $day['date_rss']);
|
||||
static::assertSame('Week 21 (May 18, 2020)', $day['date_human']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?week='. $dates[0]->format('YW'), $day['absolute_url']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?week=' . $dates[0]->format('YW'), $day['absolute_url']);
|
||||
static::assertCount(1, $day['links']);
|
||||
|
||||
$day = $assignedVariables['days'][$dates[1]->format('YW')];
|
||||
|
@ -656,7 +657,7 @@ class DailyControllerTest extends TestCase
|
|||
static::assertEquals($date, $day['date']);
|
||||
static::assertSame($date->format(\DateTime::RSS), $day['date_rss']);
|
||||
static::assertSame('Week 20 (May 11, 2020)', $day['date_human']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?week='. $dates[1]->format('YW'), $day['absolute_url']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?week=' . $dates[1]->format('YW'), $day['absolute_url']);
|
||||
static::assertCount(2, $day['links']);
|
||||
}
|
||||
|
||||
|
@ -710,7 +711,7 @@ class DailyControllerTest extends TestCase
|
|||
static::assertEquals($date, $day['date']);
|
||||
static::assertSame($date->format(\DateTime::RSS), $day['date_rss']);
|
||||
static::assertSame('May, 2020', $day['date_human']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?month='. $dates[0]->format('Ym'), $day['absolute_url']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?month=' . $dates[0]->format('Ym'), $day['absolute_url']);
|
||||
static::assertCount(1, $day['links']);
|
||||
|
||||
$day = $assignedVariables['days'][$dates[1]->format('Ym')];
|
||||
|
@ -719,7 +720,7 @@ class DailyControllerTest extends TestCase
|
|||
static::assertEquals($date, $day['date']);
|
||||
static::assertSame($date->format(\DateTime::RSS), $day['date_rss']);
|
||||
static::assertSame('April, 2020', $day['date_human']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?month='. $dates[1]->format('Ym'), $day['absolute_url']);
|
||||
static::assertSame('http://shaarli/subfolder/daily?month=' . $dates[1]->format('Ym'), $day['absolute_url']);
|
||||
static::assertCount(2, $day['links']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,8 @@ class ErrorControllerTest extends TestCase
|
|||
$result = ($this->controller)(
|
||||
$request,
|
||||
$response,
|
||||
new class($message, $errorCode) extends ShaarliFrontException {}
|
||||
new class ($message, $errorCode) extends ShaarliFrontException {
|
||||
}
|
||||
);
|
||||
|
||||
static::assertSame($errorCode, $result->getStatusCode());
|
||||
|
|
|
@ -118,5 +118,5 @@ trait FrontControllerMockHelper
|
|||
/**
|
||||
* Force to be used in PHPUnit context.
|
||||
*/
|
||||
protected abstract function isInTestsContext(): bool;
|
||||
abstract protected function isInTestsContext(): bool;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class InstallControllerTest extends TestCase
|
|||
{
|
||||
use FrontControllerMockHelper;
|
||||
|
||||
const MOCK_FILE = '.tmp';
|
||||
protected const MOCK_FILE = '.tmp';
|
||||
|
||||
/** @var InstallController */
|
||||
protected $controller;
|
||||
|
|
|
@ -32,7 +32,7 @@ class ShaarliVisitorControllerTest extends TestCase
|
|||
{
|
||||
$this->createContainer();
|
||||
|
||||
$this->controller = new class($this->container) extends ShaarliVisitorController
|
||||
$this->controller = new class ($this->container) extends ShaarliVisitorController
|
||||
{
|
||||
public function assignView(string $key, $value): ShaarliVisitorController
|
||||
{
|
||||
|
|
|
@ -130,12 +130,12 @@ class TagCloudControllerTest extends TestCase
|
|||
->method('executeHooks')
|
||||
->withConsecutive(['render_tagcloud'])
|
||||
->willReturnCallback(function (string $hook, array $data, array $param): array {
|
||||
if ('render_tagcloud' === $hook) {
|
||||
static::assertSame('ghi@def@', $data['search_tags']);
|
||||
static::assertCount(1, $data['tags']);
|
||||
if ('render_tagcloud' === $hook) {
|
||||
static::assertSame('ghi@def@', $data['search_tags']);
|
||||
static::assertCount(1, $data['tags']);
|
||||
|
||||
static::assertArrayHasKey('loggedin', $param);
|
||||
}
|
||||
static::assertArrayHasKey('loggedin', $param);
|
||||
}
|
||||
|
||||
return $data;
|
||||
})
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Helper;
|
||||
|
||||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\FakeApplicationUtils;
|
||||
|
||||
require_once 'tests/utils/FakeApplicationUtils.php';
|
||||
use Shaarli\Tests\Utils\FakeApplicationUtils;
|
||||
|
||||
/**
|
||||
* Unitary tests for Shaarli utilities
|
||||
|
@ -49,7 +48,7 @@ class ApplicationUtilsTest extends \Shaarli\TestCase
|
|||
'0.5.4',
|
||||
ApplicationUtils::getVersion(
|
||||
'https://raw.githubusercontent.com/shaarli/Shaarli/'
|
||||
.'v0.5.4/shaarli_version.php',
|
||||
. 'v0.5.4/shaarli_version.php',
|
||||
$testTimeout
|
||||
)
|
||||
);
|
||||
|
@ -57,7 +56,7 @@ class ApplicationUtilsTest extends \Shaarli\TestCase
|
|||
self::$versionPattern,
|
||||
ApplicationUtils::getVersion(
|
||||
'https://raw.githubusercontent.com/shaarli/Shaarli/'
|
||||
.'latest/shaarli_version.php',
|
||||
. 'latest/shaarli_version.php',
|
||||
$testTimeout
|
||||
)
|
||||
);
|
||||
|
@ -68,7 +67,7 @@ class ApplicationUtilsTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testGetVersionCodeFromFile()
|
||||
{
|
||||
file_put_contents('sandbox/version.php', '<?php /* 1.2.3 */ ?>'. PHP_EOL);
|
||||
file_put_contents('sandbox/version.php', '<?php /* 1.2.3 */ ?>' . PHP_EOL);
|
||||
$this->assertEquals(
|
||||
'1.2.3',
|
||||
ApplicationUtils::getVersion('sandbox/version.php', 1)
|
||||
|
@ -301,7 +300,7 @@ class ApplicationUtilsTest extends \Shaarli\TestCase
|
|||
$conf->set('resource.update_check', 'data/lastupdatecheck.txt');
|
||||
|
||||
$this->assertEquals(
|
||||
array(),
|
||||
[],
|
||||
ApplicationUtils::checkResourcePermissions($conf)
|
||||
);
|
||||
}
|
||||
|
@ -324,7 +323,7 @@ class ApplicationUtilsTest extends \Shaarli\TestCase
|
|||
$conf->set('resource.raintpl_theme', 'null/tpl/default');
|
||||
$conf->set('resource.update_check', 'null/data/lastupdatecheck.txt');
|
||||
$this->assertEquals(
|
||||
array(
|
||||
[
|
||||
'"null/tpl" directory is not readable',
|
||||
'"null/tpl/default" directory is not readable',
|
||||
'"null/cache" directory is not readable',
|
||||
|
@ -335,7 +334,7 @@ class ApplicationUtilsTest extends \Shaarli\TestCase
|
|||
'"null/pagecache" directory is not writable',
|
||||
'"null/tmp" directory is not readable',
|
||||
'"null/tmp" directory is not writable'
|
||||
),
|
||||
],
|
||||
ApplicationUtils::checkResourcePermissions($conf)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Shaarli\Helper;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Shaarli\Bookmark\Bookmark;
|
||||
|
@ -147,7 +148,8 @@ class DailyPageHelperTest extends TestCase
|
|||
/**
|
||||
* @dataProvider getRssLengthsByType
|
||||
*/
|
||||
public function testGeRssLengthsByType(string $type): void {
|
||||
public function testGeRssLengthsByType(string $type): void
|
||||
{
|
||||
$length = DailyPageHelper::getRssLengthByType($type);
|
||||
|
||||
static::assertIsInt($length);
|
||||
|
@ -208,31 +210,31 @@ class DailyPageHelperTest extends TestCase
|
|||
public function getRequestedDateTimes(): array
|
||||
{
|
||||
return [
|
||||
[DailyPageHelper::DAY, '20201013', null, new \DateTime('2020-10-13')],
|
||||
[DailyPageHelper::DAY, '20201013', null, new DateTime('2020-10-13')],
|
||||
[
|
||||
DailyPageHelper::DAY,
|
||||
'',
|
||||
(new Bookmark())->setCreated($date = new \DateTime('2020-10-13 12:05:31')),
|
||||
(new Bookmark())->setCreated($date = new DateTime('2020-10-13 12:05:31')),
|
||||
$date,
|
||||
],
|
||||
[DailyPageHelper::DAY, '', null, new \DateTime()],
|
||||
[DailyPageHelper::WEEK, '202030', null, new \DateTime('2020-07-20')],
|
||||
[DailyPageHelper::DAY, '', null, new DateTime()],
|
||||
[DailyPageHelper::WEEK, '202030', null, new DateTime('2020-07-20')],
|
||||
[
|
||||
DailyPageHelper::WEEK,
|
||||
'',
|
||||
(new Bookmark())->setCreated($date = new \DateTime('2020-10-13 12:05:31')),
|
||||
new \DateTime('2020-10-13'),
|
||||
(new Bookmark())->setCreated($date = new DateTime('2020-10-13 12:05:31')),
|
||||
new DateTime('2020-10-13'),
|
||||
],
|
||||
[DailyPageHelper::WEEK, '', null, new \DateTime(), 'Ym'],
|
||||
[DailyPageHelper::MONTH, '202008', null, new \DateTime('2020-08-01'), 'Ym'],
|
||||
[DailyPageHelper::WEEK, '', null, new DateTime(), 'Ym'],
|
||||
[DailyPageHelper::MONTH, '202008', null, new DateTime('2020-08-01'), 'Ym'],
|
||||
[
|
||||
DailyPageHelper::MONTH,
|
||||
'',
|
||||
(new Bookmark())->setCreated($date = new \DateTime('2020-10-13 12:05:31')),
|
||||
new \DateTime('2020-10-13'),
|
||||
(new Bookmark())->setCreated($date = new DateTime('2020-10-13 12:05:31')),
|
||||
new DateTime('2020-10-13'),
|
||||
'Ym'
|
||||
],
|
||||
[DailyPageHelper::MONTH, '', null, new \DateTime(), 'Ym'],
|
||||
[DailyPageHelper::MONTH, '', null, new DateTime(), 'Ym'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -254,9 +256,9 @@ class DailyPageHelperTest extends TestCase
|
|||
public function getStartDatesByType(): array
|
||||
{
|
||||
return [
|
||||
[DailyPageHelper::DAY, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-09 00:00:00')],
|
||||
[DailyPageHelper::WEEK, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-05 00:00:00')],
|
||||
[DailyPageHelper::MONTH, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-01 00:00:00')],
|
||||
[DailyPageHelper::DAY, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-09 00:00:00')],
|
||||
[DailyPageHelper::WEEK, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-05 00:00:00')],
|
||||
[DailyPageHelper::MONTH, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-01 00:00:00')],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -266,9 +268,9 @@ class DailyPageHelperTest extends TestCase
|
|||
public function getEndDatesByType(): array
|
||||
{
|
||||
return [
|
||||
[DailyPageHelper::DAY, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-09 23:59:59')],
|
||||
[DailyPageHelper::WEEK, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-11 23:59:59')],
|
||||
[DailyPageHelper::MONTH, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-31 23:59:59')],
|
||||
[DailyPageHelper::DAY, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-09 23:59:59')],
|
||||
[DailyPageHelper::WEEK, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-11 23:59:59')],
|
||||
[DailyPageHelper::MONTH, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-31 23:59:59')],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -321,20 +323,20 @@ class DailyPageHelperTest extends TestCase
|
|||
[
|
||||
DailyPageHelper::DAY,
|
||||
new DateTimeImmutable('2020-10-09 04:05:06'),
|
||||
new \DateTime('2020-10-09 00:00:00'),
|
||||
new \DateTime('2020-10-09 23:59:59'),
|
||||
new DateTime('2020-10-09 00:00:00'),
|
||||
new DateTime('2020-10-09 23:59:59'),
|
||||
],
|
||||
[
|
||||
DailyPageHelper::WEEK,
|
||||
new DateTimeImmutable('2020-10-09 04:05:06'),
|
||||
new \DateTime('2020-10-05 00:00:00'),
|
||||
new \DateTime('2020-10-11 23:59:59'),
|
||||
new DateTime('2020-10-05 00:00:00'),
|
||||
new DateTime('2020-10-11 23:59:59'),
|
||||
],
|
||||
[
|
||||
DailyPageHelper::MONTH,
|
||||
new DateTimeImmutable('2020-10-09 04:05:06'),
|
||||
new \DateTime('2020-10-01 00:00:00'),
|
||||
new \DateTime('2020-10-31 23:59:59'),
|
||||
new DateTime('2020-10-01 00:00:00'),
|
||||
new DateTime('2020-10-31 23:59:59'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* HttpUtils' tests
|
||||
*/
|
||||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/HttpUtils.php';
|
||||
|
||||
/**
|
||||
* Unitary tests for client_ip_id()
|
||||
*/
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* HttpUtils' tests
|
||||
*/
|
||||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/HttpUtils.php';
|
||||
|
||||
/**
|
||||
* Unitary tests for get_http_response()
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/HttpUtils.php';
|
||||
|
||||
/**
|
||||
* Unitary tests for getIpAddressFromProxy()
|
||||
*/
|
||||
|
@ -15,7 +13,7 @@ class GetIpAdressFromProxyTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testWithoutProxy()
|
||||
{
|
||||
$this->assertFalse(getIpAddressFromProxy(array(), array()));
|
||||
$this->assertFalse(getIpAddressFromProxy([], []));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,8 +22,8 @@ class GetIpAdressFromProxyTest extends \Shaarli\TestCase
|
|||
public function testWithOneForwardedIp()
|
||||
{
|
||||
$ip = '1.1.1.1';
|
||||
$server = array('HTTP_X_FORWARDED_FOR' => $ip);
|
||||
$this->assertEquals($ip, getIpAddressFromProxy($server, array()));
|
||||
$server = ['HTTP_X_FORWARDED_FOR' => $ip];
|
||||
$this->assertEquals($ip, getIpAddressFromProxy($server, []));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,11 +34,11 @@ class GetIpAdressFromProxyTest extends \Shaarli\TestCase
|
|||
$ip = '1.1.1.1';
|
||||
$ip2 = '2.2.2.2';
|
||||
|
||||
$server = array('HTTP_X_FORWARDED_FOR' => $ip .','. $ip2);
|
||||
$this->assertEquals($ip2, getIpAddressFromProxy($server, array()));
|
||||
$server = ['HTTP_X_FORWARDED_FOR' => $ip . ',' . $ip2];
|
||||
$this->assertEquals($ip2, getIpAddressFromProxy($server, []));
|
||||
|
||||
$server = array('HTTP_X_FORWARDED_FOR' => $ip .' , '. $ip2);
|
||||
$this->assertEquals($ip2, getIpAddressFromProxy($server, array()));
|
||||
$server = ['HTTP_X_FORWARDED_FOR' => $ip . ' , ' . $ip2];
|
||||
$this->assertEquals($ip2, getIpAddressFromProxy($server, []));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,11 +49,11 @@ class GetIpAdressFromProxyTest extends \Shaarli\TestCase
|
|||
$ip = '1.1.1.1';
|
||||
$ip2 = '2.2.2.2';
|
||||
|
||||
$server = array('HTTP_X_FORWARDED_FOR' => $ip);
|
||||
$this->assertFalse(getIpAddressFromProxy($server, array($ip)));
|
||||
$server = ['HTTP_X_FORWARDED_FOR' => $ip];
|
||||
$this->assertFalse(getIpAddressFromProxy($server, [$ip]));
|
||||
|
||||
$server = array('HTTP_X_FORWARDED_FOR' => $ip .','. $ip2);
|
||||
$this->assertEquals($ip2, getIpAddressFromProxy($server, array($ip)));
|
||||
$this->assertFalse(getIpAddressFromProxy($server, array($ip, $ip2)));
|
||||
$server = ['HTTP_X_FORWARDED_FOR' => $ip . ',' . $ip2];
|
||||
$this->assertEquals($ip2, getIpAddressFromProxy($server, [$ip]));
|
||||
$this->assertFalse(getIpAddressFromProxy($server, [$ip, $ip2]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* HttpUtils' tests
|
||||
*/
|
||||
|
@ -7,8 +8,6 @@ namespace Shaarli\Http;
|
|||
|
||||
use Shaarli\TestCase;
|
||||
|
||||
require_once 'application/http/HttpUtils.php';
|
||||
|
||||
/**
|
||||
* Unitary tests for index_url()
|
||||
*/
|
||||
|
@ -22,24 +21,24 @@ class IndexUrlTest extends TestCase
|
|||
$this->assertEquals(
|
||||
'http://host.tld/',
|
||||
index_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/index.php'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'http://host.tld/admin/',
|
||||
index_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/admin/index.php'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -52,24 +51,24 @@ class IndexUrlTest extends TestCase
|
|||
$this->assertEquals(
|
||||
'http://host.tld/page.php',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/page.php'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'http://host.tld/admin/page.php',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/admin/page.php'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -82,26 +81,26 @@ class IndexUrlTest extends TestCase
|
|||
$this->assertEquals(
|
||||
'http://host.tld/picture-wall',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/index.php',
|
||||
'REQUEST_URI' => '/picture-wall',
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'http://host.tld/admin/picture-wall',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/admin/index.php',
|
||||
'REQUEST_URI' => '/admin/picture-wall',
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -114,26 +113,26 @@ class IndexUrlTest extends TestCase
|
|||
$this->assertEquals(
|
||||
'http://host.tld/subfolder/picture-wall',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/subfolder/index.php',
|
||||
'REQUEST_URI' => '/subfolder/picture-wall',
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'http://host.tld/subfolder/admin/picture-wall',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/subfolder/admin/index.php',
|
||||
'REQUEST_URI' => '/subfolder/admin/picture-wall',
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -25,26 +25,26 @@ class IndexUrlTestWithConstant extends TestCase
|
|||
$this->assertEquals(
|
||||
'http://other-host.tld/subfolder/',
|
||||
index_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/index.php',
|
||||
'REQUEST_URI' => '/picture-wall',
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'http://other-host.tld/subfolder/',
|
||||
index_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/admin/index.php',
|
||||
'REQUEST_URI' => '/admin/picture-wall',
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/HttpUtils.php';
|
||||
|
||||
/**
|
||||
* Class IsHttpsTest
|
||||
*
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* HttpUtils' tests
|
||||
*/
|
||||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/HttpUtils.php';
|
||||
|
||||
/**
|
||||
* Unitary tests for page_url()
|
||||
*/
|
||||
|
@ -20,26 +19,26 @@ class PageUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'http://host.tld/?p1=v1&p2=v2',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/index.php',
|
||||
'QUERY_STRING' => 'p1=v1&p2=v2'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'http://host.tld/admin/?action=edit_tag',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/admin/index.php',
|
||||
'QUERY_STRING' => 'action=edit_tag'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -52,26 +51,26 @@ class PageUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'http://host.tld/page.php?p1=v1&p2=v2',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/page.php',
|
||||
'QUERY_STRING' => 'p1=v1&p2=v2'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'http://host.tld/admin/page.php?action=edit_tag',
|
||||
page_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'SCRIPT_NAME' => '/admin/page.php',
|
||||
'QUERY_STRING' => 'action=edit_tag'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* HttpUtils' tests
|
||||
*/
|
||||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/HttpUtils.php';
|
||||
|
||||
/**
|
||||
* Unitary tests for server_url()
|
||||
*/
|
||||
|
@ -20,22 +19,22 @@ class ServerUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'https://host.tld',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'ON',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '443'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'https://host.tld:8080',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'ON',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '8080'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -48,22 +47,22 @@ class ServerUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'https://host.tld:8080',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTP_X_FORWARDED_PROTO' => 'https',
|
||||
'HTTP_X_FORWARDED_PORT' => '8080',
|
||||
'HTTP_X_FORWARDED_HOST' => 'host.tld'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'https://host.tld:4974',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTP_X_FORWARDED_PROTO' => 'https, https',
|
||||
'HTTP_X_FORWARDED_PORT' => '4974, 80',
|
||||
'HTTP_X_FORWARDED_HOST' => 'host.tld, example.com'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -76,51 +75,51 @@ class ServerUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'https://host.tld:8080',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'HTTP_X_FORWARDED_PROTO' => 'https',
|
||||
'HTTP_X_FORWARDED_PORT' => '8080'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'https://host.tld',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'HTTP_X_FORWARDED_PROTO' => 'https'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'https://host.tld',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'HTTP_X_FORWARDED_PROTO' => 'https',
|
||||
'HTTP_X_FORWARDED_PORT' => '443'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'https://host.tld:4974',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'HTTP_X_FORWARDED_PROTO' => 'https, https',
|
||||
'HTTP_X_FORWARDED_PORT' => '4974, 80'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -134,11 +133,11 @@ class ServerUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'http://host.tld:8080',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'OFF',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '8080'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -146,11 +145,11 @@ class ServerUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'https://host.tld:8080',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'ON',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '8080'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -163,11 +162,11 @@ class ServerUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'http://host.tld',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'OFF',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -180,11 +179,11 @@ class ServerUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'https://host.tld',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'ON',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '443'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -197,26 +196,26 @@ class ServerUrlTest extends \Shaarli\TestCase
|
|||
$this->assertEquals(
|
||||
'https://host.tld',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'HTTP_X_FORWARDED_PROTO' => 'http',
|
||||
'HTTP_X_FORWARDED_PORT' => '443'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'https://host.tld',
|
||||
server_url(
|
||||
array(
|
||||
[
|
||||
'HTTPS' => 'Off',
|
||||
'SERVER_NAME' => 'host.tld',
|
||||
'SERVER_PORT' => '80',
|
||||
'HTTP_X_FORWARDED_PROTO' => 'https, http',
|
||||
'HTTP_X_FORWARDED_PORT' => '443, 80'
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,12 @@ class MetadataRetrieverTest extends TestCase
|
|||
->expects(static::once())
|
||||
->method('getCurlDownloadCallback')
|
||||
->willReturnCallback(
|
||||
function (&$charset, &$title, &$description, &$tags) use (
|
||||
function (
|
||||
&$charset,
|
||||
&$title,
|
||||
&$description,
|
||||
&$tags
|
||||
) use (
|
||||
$remoteCharset,
|
||||
$remoteTitle,
|
||||
$remoteDesc,
|
||||
|
@ -95,7 +100,7 @@ class MetadataRetrieverTest extends TestCase
|
|||
->expects(static::once())
|
||||
->method('getHttpResponse')
|
||||
->with($url, 30, 4194304)
|
||||
->willReturnCallback(function($url, $timeout, $maxBytes, $headerCallback, $dlCallback): void {
|
||||
->willReturnCallback(function ($url, $timeout, $maxBytes, $headerCallback, $dlCallback): void {
|
||||
$headerCallback();
|
||||
$dlCallback();
|
||||
})
|
||||
|
@ -124,7 +129,8 @@ class MetadataRetrieverTest extends TestCase
|
|||
->method('getCurlDownloadCallback')
|
||||
->willReturnCallback(
|
||||
function (): callable {
|
||||
return function (): void {};
|
||||
return function (): void {
|
||||
};
|
||||
}
|
||||
)
|
||||
;
|
||||
|
@ -133,7 +139,8 @@ class MetadataRetrieverTest extends TestCase
|
|||
->method('getCurlHeaderCallback')
|
||||
->willReturnCallback(
|
||||
function (): callable {
|
||||
return function (): void {};
|
||||
return function (): void {
|
||||
};
|
||||
}
|
||||
)
|
||||
;
|
||||
|
@ -141,7 +148,7 @@ class MetadataRetrieverTest extends TestCase
|
|||
->expects(static::once())
|
||||
->method('getHttpResponse')
|
||||
->with($url, 30, 4194304)
|
||||
->willReturnCallback(function($url, $timeout, $maxBytes, $headerCallback, $dlCallback): void {
|
||||
->willReturnCallback(function ($url, $timeout, $maxBytes, $headerCallback, $dlCallback): void {
|
||||
$headerCallback();
|
||||
$dlCallback();
|
||||
})
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* UrlUtils's tests
|
||||
*/
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Unitary tests for cleanup_url()
|
||||
*/
|
||||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/UrlUtils.php';
|
||||
|
||||
class CleanupUrlTest extends \Shaarli\TestCase
|
||||
{
|
||||
/**
|
||||
|
@ -29,7 +28,7 @@ class CleanupUrlTest extends \Shaarli\TestCase
|
|||
public function testCleanupUrlAlreadyClean()
|
||||
{
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref));
|
||||
$this->ref2 = $this->ref.'/path/to/dir/';
|
||||
$this->ref2 = $this->ref . '/path/to/dir/';
|
||||
$this->assertEquals($this->ref2, cleanup_url($this->ref2));
|
||||
}
|
||||
|
||||
|
@ -38,9 +37,9 @@ class CleanupUrlTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testCleanupUrlFragment()
|
||||
{
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'#tk.rss_all'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'#xtor=RSS-'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'#xtor=RSS-U3ht0tkc4b'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '#tk.rss_all'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '#xtor=RSS-'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '#xtor=RSS-U3ht0tkc4b'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,23 +47,23 @@ class CleanupUrlTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testCleanupUrlQuerySingle()
|
||||
{
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?action_object_map=junk'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?action_ref_map=Cr4p!'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?action_type_map=g4R84g3'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?action_object_map=junk'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?action_ref_map=Cr4p!'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?action_type_map=g4R84g3'));
|
||||
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?fb_stuff=v41u3'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?fb=71m3w4573'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?fb_stuff=v41u3'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?fb=71m3w4573'));
|
||||
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?utm_campaign=zomg'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?utm_medium=numnum'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?utm_source=c0d3'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?utm_term=1n4l'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?utm_campaign=zomg'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?utm_medium=numnum'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?utm_source=c0d3'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?utm_term=1n4l'));
|
||||
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?xtor=some-url'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?xtor=some-url'));
|
||||
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?campaign_name=junk'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?campaign_start=junk'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?campaign_item_index=junk'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?campaign_name=junk'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?campaign_start=junk'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?campaign_item_index=junk'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,14 +71,14 @@ class CleanupUrlTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testCleanupUrlQueryMultiple()
|
||||
{
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref.'?xtor=some-url&fb=som3th1ng'));
|
||||
$this->assertEquals($this->ref, cleanup_url($this->ref . '?xtor=some-url&fb=som3th1ng'));
|
||||
|
||||
$this->assertEquals($this->ref, cleanup_url(
|
||||
$this->ref.'?fb=stuff&utm_campaign=zomg&utm_medium=numnum&utm_source=c0d3'
|
||||
$this->ref . '?fb=stuff&utm_campaign=zomg&utm_medium=numnum&utm_source=c0d3'
|
||||
));
|
||||
|
||||
$this->assertEquals($this->ref, cleanup_url(
|
||||
$this->ref.'?campaign_start=zomg&campaign_name=numnum'
|
||||
$this->ref . '?campaign_start=zomg&campaign_name=numnum'
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -89,22 +88,22 @@ class CleanupUrlTest extends \Shaarli\TestCase
|
|||
public function testCleanupUrlQueryFragment()
|
||||
{
|
||||
$this->assertEquals($this->ref, cleanup_url(
|
||||
$this->ref.'?xtor=some-url&fb=som3th1ng#tk.rss_all'
|
||||
$this->ref . '?xtor=some-url&fb=som3th1ng#tk.rss_all'
|
||||
));
|
||||
|
||||
// ditch annoying query params and fragment, keep useful params
|
||||
$this->assertEquals(
|
||||
$this->ref.'?my=stuff&is=kept',
|
||||
$this->ref . '?my=stuff&is=kept',
|
||||
cleanup_url(
|
||||
$this->ref.'?fb=zomg&my=stuff&utm_medium=numnum&is=kept#tk.rss_all'
|
||||
$this->ref . '?fb=zomg&my=stuff&utm_medium=numnum&is=kept#tk.rss_all'
|
||||
)
|
||||
);
|
||||
|
||||
// ditch annoying query params, keep useful params and fragment
|
||||
$this->assertEquals(
|
||||
$this->ref.'?my=stuff&is=kept#again',
|
||||
$this->ref . '?my=stuff&is=kept#again',
|
||||
cleanup_url(
|
||||
$this->ref.'?fb=zomg&my=stuff&utm_medium=numnum&is=kept#again'
|
||||
$this->ref . '?fb=zomg&my=stuff&utm_medium=numnum&is=kept#again'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Unitary tests for get_url_scheme()
|
||||
*/
|
||||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/UrlUtils.php';
|
||||
use Shaarli\TestCase;
|
||||
|
||||
class GetUrlSchemeTest extends \Shaarli\TestCase
|
||||
class GetUrlSchemeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Get empty scheme string for empty UrlUtils
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Unpares UrlUtils's tests
|
||||
*/
|
||||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/UrlUtils.php';
|
||||
use Shaarli\TestCase;
|
||||
|
||||
/**
|
||||
* Unitary tests for unparse_url()
|
||||
*/
|
||||
class UnparseUrlTest extends \Shaarli\TestCase
|
||||
class UnparseUrlTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Thanks for building nothing
|
||||
*/
|
||||
public function testUnparseEmptyArray()
|
||||
{
|
||||
$this->assertEquals('', unparse_url(array()));
|
||||
$this->assertEquals('', unparse_url([]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +27,7 @@ class UnparseUrlTest extends \Shaarli\TestCase
|
|||
public function testUnparseFull()
|
||||
{
|
||||
$ref = 'http://username:password@hostname:9090/path'
|
||||
.'?arg1=value1&arg2=value2#anchor';
|
||||
. '?arg1=value1&arg2=value2#anchor';
|
||||
$this->assertEquals($ref, unparse_url(parse_url($ref)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
namespace Shaarli\Http;
|
||||
|
||||
require_once 'application/http/UrlUtils.php';
|
||||
use Shaarli\TestCase;
|
||||
|
||||
/**
|
||||
* Class WhitelistProtocolsTest
|
||||
*
|
||||
* Test whitelist_protocols() function of UrlUtils.
|
||||
*/
|
||||
class WhitelistProtocolsTest extends \Shaarli\TestCase
|
||||
class WhitelistProtocolsTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test whitelist_protocols() on a note (relative URL).
|
||||
|
@ -30,7 +30,7 @@ class WhitelistProtocolsTest extends \Shaarli\TestCase
|
|||
{
|
||||
$whitelist = ['ftp', 'magnet'];
|
||||
$url = 'test.tld/path/?query=value#hash';
|
||||
$this->assertEquals('http://'. $url, whitelist_protocols($url, $whitelist));
|
||||
$this->assertEquals('http://' . $url, whitelist_protocols($url, $whitelist));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once 'tests/bootstrap.php';
|
||||
|
||||
if (! empty(getenv('UT_LOCALE'))) {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
require_once 'tests/UtilsTest.php';
|
||||
namespace Shaarli\Tests;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class UtilsDeTest extends UtilsTest
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
require_once 'tests/UtilsTest.php';
|
||||
namespace Shaarli\Tests;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class UtilsEnTest extends UtilsTest
|
||||
{
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Shaarli;
|
||||
namespace Shaarli\Tests;
|
||||
|
||||
use Shaarli\Config\ConfigManager;
|
||||
use Shaarli\Languages;
|
||||
use Shaarli\TestCase;
|
||||
|
||||
/**
|
||||
* Class LanguagesFrTest
|
||||
|
@ -12,7 +13,7 @@ use Shaarli\Config\ConfigManager;
|
|||
*
|
||||
* @package Shaarli
|
||||
*/
|
||||
class LanguagesFrTest extends \Shaarli\TestCase
|
||||
class LanguagesFrTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var string Config file path (without extension).
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
require_once 'tests/UtilsTest.php';
|
||||
namespace Shaarli\Tests;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class UtilsFrTest extends UtilsTest
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Updater;
|
||||
|
||||
use Exception;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Link datastore tests
|
||||
*/
|
||||
|
@ -6,14 +7,10 @@
|
|||
namespace Shaarli\Legacy;
|
||||
|
||||
use DateTime;
|
||||
use ReferenceLinkDB;
|
||||
use ReflectionClass;
|
||||
use Shaarli;
|
||||
use Shaarli\Bookmark\Bookmark;
|
||||
|
||||
require_once 'application/Utils.php';
|
||||
require_once 'tests/utils/ReferenceLinkDB.php';
|
||||
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
|
||||
/**
|
||||
* Unitary tests for LegacyLinkDBTest
|
||||
|
@ -118,7 +115,7 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
$this->assertFileNotExists(self::$testDatastore);
|
||||
|
||||
$checkDB = self::getMethod('check');
|
||||
$checkDB->invokeArgs($linkDB, array());
|
||||
$checkDB->invokeArgs($linkDB, []);
|
||||
$this->assertFileExists(self::$testDatastore);
|
||||
|
||||
// ensure the correct data has been written
|
||||
|
@ -135,7 +132,7 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
$this->assertGreaterThan(0, $datastoreSize);
|
||||
|
||||
$checkDB = self::getMethod('check');
|
||||
$checkDB->invokeArgs($linkDB, array());
|
||||
$checkDB->invokeArgs($linkDB, []);
|
||||
|
||||
// ensure the datastore is left unmodified
|
||||
$this->assertEquals(
|
||||
|
@ -185,7 +182,7 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
$testDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||
$dbSize = sizeof($testDB);
|
||||
|
||||
$link = array(
|
||||
$link = [
|
||||
'id' => 43,
|
||||
'title' => 'an additional link',
|
||||
'url' => 'http://dum.my',
|
||||
|
@ -193,7 +190,7 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
'private' => 0,
|
||||
'created' => DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150518_190000'),
|
||||
'tags' => 'unit test'
|
||||
);
|
||||
];
|
||||
$testDB[$link['id']] = $link;
|
||||
$testDB->save('tests');
|
||||
|
||||
|
@ -239,12 +236,12 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
public function testDays()
|
||||
{
|
||||
$this->assertEquals(
|
||||
array('20100309', '20100310', '20121206', '20121207', '20130614', '20150310'),
|
||||
['20100309', '20100310', '20121206', '20121207', '20130614', '20150310'],
|
||||
self::$publicLinkDB->days()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
array('20100309', '20100310', '20121206', '20121207', '20130614', '20141125', '20150310'),
|
||||
['20100309', '20100310', '20121206', '20121207', '20130614', '20141125', '20150310'],
|
||||
self::$privateLinkDB->days()
|
||||
);
|
||||
}
|
||||
|
@ -280,7 +277,7 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
public function testAllTags()
|
||||
{
|
||||
$this->assertEquals(
|
||||
array(
|
||||
[
|
||||
'web' => 3,
|
||||
'cartoon' => 2,
|
||||
'gnu' => 2,
|
||||
|
@ -300,12 +297,12 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
'coding-style' => 1,
|
||||
'quality' => 1,
|
||||
'standards' => 1,
|
||||
),
|
||||
],
|
||||
self::$publicLinkDB->linksCountPerTag()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
[
|
||||
'web' => 4,
|
||||
'cartoon' => 3,
|
||||
'gnu' => 2,
|
||||
|
@ -332,11 +329,11 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
'coding-style' => 1,
|
||||
'quality' => 1,
|
||||
'standards' => 1,
|
||||
),
|
||||
],
|
||||
self::$privateLinkDB->linksCountPerTag()
|
||||
);
|
||||
$this->assertEquals(
|
||||
array(
|
||||
[
|
||||
'web' => 4,
|
||||
'cartoon' => 2,
|
||||
'gnu' => 1,
|
||||
|
@ -349,17 +346,17 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
'Mercurial' => 1,
|
||||
'.hidden' => 1,
|
||||
'hashtag' => 1,
|
||||
),
|
||||
],
|
||||
self::$privateLinkDB->linksCountPerTag(['web'])
|
||||
);
|
||||
$this->assertEquals(
|
||||
array(
|
||||
[
|
||||
'web' => 1,
|
||||
'html' => 1,
|
||||
'w3c' => 1,
|
||||
'css' => 1,
|
||||
'Mercurial' => 1,
|
||||
),
|
||||
],
|
||||
self::$privateLinkDB->linksCountPerTag(['web'], 'private')
|
||||
);
|
||||
}
|
||||
|
@ -370,7 +367,7 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
public function testFilterString()
|
||||
{
|
||||
$tags = 'dev cartoon';
|
||||
$request = array('searchtags' => $tags);
|
||||
$request = ['searchtags' => $tags];
|
||||
$this->assertEquals(
|
||||
2,
|
||||
count(self::$privateLinkDB->filterSearch($request, true, false))
|
||||
|
@ -382,8 +379,8 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testFilterArray()
|
||||
{
|
||||
$tags = array('dev', 'cartoon');
|
||||
$request = array('searchtags' => $tags);
|
||||
$tags = ['dev', 'cartoon'];
|
||||
$request = ['searchtags' => $tags];
|
||||
$this->assertEquals(
|
||||
2,
|
||||
count(self::$privateLinkDB->filterSearch($request, true, false))
|
||||
|
@ -397,7 +394,7 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
public function testHiddenTags()
|
||||
{
|
||||
$tags = '.hidden';
|
||||
$request = array('searchtags' => $tags);
|
||||
$request = ['searchtags' => $tags];
|
||||
$this->assertEquals(
|
||||
1,
|
||||
count(self::$privateLinkDB->filterSearch($request, true, false))
|
||||
|
@ -639,7 +636,7 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
for ($i = 0; $i < 4; ++$i) {
|
||||
$linkDB[$nextId + $i] = [
|
||||
'id' => $nextId + $i,
|
||||
'url' => 'http://'. $i,
|
||||
'url' => 'http://' . $i,
|
||||
'created' => $creation,
|
||||
'title' => true,
|
||||
'description' => true,
|
||||
|
@ -657,7 +654,7 @@ class LegacyLinkDBTest extends \Shaarli\TestCase
|
|||
continue;
|
||||
}
|
||||
$this->assertEquals($nextId + $count, $link['id']);
|
||||
$this->assertEquals('http://'. $count, $link['url']);
|
||||
$this->assertEquals('http://' . $count, $link['url']);
|
||||
if (--$count < 0) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
namespace Shaarli\Bookmark;
|
||||
|
||||
use Exception;
|
||||
use ReferenceLinkDB;
|
||||
use Shaarli\Legacy\LegacyLinkDB;
|
||||
use Shaarli\Legacy\LegacyLinkFilter;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
|
||||
/**
|
||||
* Class LegacyLinkFilterTest.
|
||||
|
@ -450,28 +449,28 @@ class LegacyLinkFilterTest extends \Shaarli\TestCase
|
|||
1,
|
||||
count(self::$linkFilter->filter(
|
||||
LegacyLinkFilter::$FILTER_TAG | LegacyLinkFilter::$FILTER_TEXT,
|
||||
array($tags, $terms)
|
||||
[$tags, $terms]
|
||||
))
|
||||
);
|
||||
$this->assertEquals(
|
||||
2,
|
||||
count(self::$linkFilter->filter(
|
||||
LegacyLinkFilter::$FILTER_TAG | LegacyLinkFilter::$FILTER_TEXT,
|
||||
array('', $terms)
|
||||
['', $terms]
|
||||
))
|
||||
);
|
||||
$this->assertEquals(
|
||||
1,
|
||||
count(self::$linkFilter->filter(
|
||||
LegacyLinkFilter::$FILTER_TAG | LegacyLinkFilter::$FILTER_TEXT,
|
||||
array(false, 'PSR-2')
|
||||
[false, 'PSR-2']
|
||||
))
|
||||
);
|
||||
$this->assertEquals(
|
||||
1,
|
||||
count(self::$linkFilter->filter(
|
||||
LegacyLinkFilter::$FILTER_TAG | LegacyLinkFilter::$FILTER_TEXT,
|
||||
array($tags, '')
|
||||
[$tags, '']
|
||||
))
|
||||
);
|
||||
$this->assertEquals(
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Updater;
|
||||
|
||||
use DateTime;
|
||||
|
@ -9,18 +10,16 @@ use Shaarli\Config\ConfigManager;
|
|||
use Shaarli\Config\ConfigPhp;
|
||||
use Shaarli\Legacy\LegacyLinkDB;
|
||||
use Shaarli\Legacy\LegacyUpdater;
|
||||
use Shaarli\TestCase;
|
||||
use Shaarli\Tests\updater\DummyUpdater;
|
||||
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||
use Shaarli\Thumbnailer;
|
||||
|
||||
require_once 'application/updater/UpdaterUtils.php';
|
||||
require_once 'tests/updater/DummyUpdater.php';
|
||||
require_once 'tests/utils/ReferenceLinkDB.php';
|
||||
require_once 'inc/rain.tpl.class.php';
|
||||
|
||||
/**
|
||||
* Class UpdaterTest.
|
||||
* Runs unit tests against the updater class.
|
||||
*/
|
||||
class LegacyUpdaterTest extends \Shaarli\TestCase
|
||||
class LegacyUpdaterTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var string Path to test datastore.
|
||||
|
@ -42,7 +41,7 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
copy('tests/utils/config/configJson.json.php', self::$configFile .'.json.php');
|
||||
copy('tests/utils/config/configJson.json.php', self::$configFile . '.json.php');
|
||||
$this->conf = new ConfigManager(self::$configFile);
|
||||
}
|
||||
|
||||
|
@ -51,10 +50,10 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testReadEmptyUpdatesFile()
|
||||
{
|
||||
$this->assertEquals(array(), UpdaterUtils::readUpdatesFile(''));
|
||||
$this->assertEquals([], UpdaterUtils::readUpdatesFile(''));
|
||||
$updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt';
|
||||
touch($updatesFile);
|
||||
$this->assertEquals(array(), UpdaterUtils::readUpdatesFile($updatesFile));
|
||||
$this->assertEquals([], UpdaterUtils::readUpdatesFile($updatesFile));
|
||||
unlink($updatesFile);
|
||||
}
|
||||
|
||||
|
@ -64,7 +63,7 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
|
|||
public function testReadWriteUpdatesFile()
|
||||
{
|
||||
$updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt';
|
||||
$updatesMethods = array('m1', 'm2', 'm3');
|
||||
$updatesMethods = ['m1', 'm2', 'm3'];
|
||||
|
||||
UpdaterUtils::writeUpdatesFile($updatesFile, $updatesMethods);
|
||||
$readMethods = UpdaterUtils::readUpdatesFile($updatesFile);
|
||||
|
@ -86,7 +85,7 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
|
|||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/');
|
||||
|
||||
UpdaterUtils::writeUpdatesFile('', array('test'));
|
||||
UpdaterUtils::writeUpdatesFile('', ['test']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,7 +100,7 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
|
|||
touch($updatesFile);
|
||||
chmod($updatesFile, 0444);
|
||||
try {
|
||||
@UpdaterUtils::writeUpdatesFile($updatesFile, array('test'));
|
||||
@UpdaterUtils::writeUpdatesFile($updatesFile, ['test']);
|
||||
} catch (Exception $e) {
|
||||
unlink($updatesFile);
|
||||
throw $e;
|
||||
|
@ -115,17 +114,17 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testNoUpdates()
|
||||
{
|
||||
$updates = array(
|
||||
$updates = [
|
||||
'updateMethodDummy1',
|
||||
'updateMethodDummy2',
|
||||
'updateMethodDummy3',
|
||||
'updateMethodException',
|
||||
);
|
||||
$updater = new DummyUpdater($updates, array(), $this->conf, true);
|
||||
$this->assertEquals(array(), $updater->update());
|
||||
];
|
||||
$updater = new DummyUpdater($updates, [], $this->conf, true);
|
||||
$this->assertEquals([], $updater->update());
|
||||
|
||||
$updater = new DummyUpdater(array(), array(), $this->conf, false);
|
||||
$this->assertEquals(array(), $updater->update());
|
||||
$updater = new DummyUpdater([], [], $this->conf, false);
|
||||
$this->assertEquals([], $updater->update());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,13 +132,13 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testUpdatesFirstTime()
|
||||
{
|
||||
$updates = array('updateMethodException',);
|
||||
$expectedUpdates = array(
|
||||
$updates = ['updateMethodException',];
|
||||
$expectedUpdates = [
|
||||
'updateMethodDummy1',
|
||||
'updateMethodDummy2',
|
||||
'updateMethodDummy3',
|
||||
);
|
||||
$updater = new DummyUpdater($updates, array(), $this->conf, true);
|
||||
];
|
||||
$updater = new DummyUpdater($updates, [], $this->conf, true);
|
||||
$this->assertEquals($expectedUpdates, $updater->update());
|
||||
}
|
||||
|
||||
|
@ -148,14 +147,14 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
|
|||
*/
|
||||
public function testOneUpdate()
|
||||
{
|
||||
$updates = array(
|
||||
$updates = [
|
||||
'updateMethodDummy1',
|
||||
'updateMethodDummy3',
|
||||
'updateMethodException',
|
||||
);
|
||||
$expectedUpdate = array('updateMethodDummy2');
|
||||
];
|
||||
$expectedUpdate = ['updateMethodDummy2'];
|
||||
|
||||
$updater = new DummyUpdater($updates, array(), $this->conf, true);
|
||||
$updater = new DummyUpdater($updates, [], $this->conf, true);
|
||||
$this->assertEquals($expectedUpdate, $updater->update());
|
||||
}
|
||||
|
||||
|
@ -166,13 +165,13 @@ class LegacyUpdaterTest extends \Shaarli\TestCase
|
|||
{
|
||||
$this->expectException(\Exception::class);
|
||||
|
||||
$updates = array(
|
||||
$updates = [
|
||||
'updateMethodDummy1',
|
||||
'updateMethodDummy2',
|
||||
'updateMethodDummy3',
|
||||
);
|
||||
];
|
||||
|
||||
$updater = new DummyUpdater($updates, array(), $this->conf, true);
|
||||
$updater = new DummyUpdater($updates, [], $this->conf, true);
|
||||
$updater->update();
|
||||
}
|
||||
|
||||
|
@ -197,7 +196,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
$this->conf->setConfigFile('tests/updater/config');
|
||||
|
||||
// merge configs
|
||||
$updater = new LegacyUpdater(array(), array(), $this->conf, true);
|
||||
$updater = new LegacyUpdater([], [], $this->conf, true);
|
||||
// This writes a new config file in tests/updater/config.php
|
||||
$updater->updateMethodMergeDeprecatedConfigFile();
|
||||
|
||||
|
@ -214,7 +213,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
*/
|
||||
public function testMergeDeprecatedConfigNoFile()
|
||||
{
|
||||
$updater = new LegacyUpdater(array(), array(), $this->conf, true);
|
||||
$updater = new LegacyUpdater([], [], $this->conf, true);
|
||||
$updater->updateMethodMergeDeprecatedConfigFile();
|
||||
|
||||
$this->assertEquals('root', $this->conf->get('credentials.login'));
|
||||
|
@ -225,14 +224,14 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
*/
|
||||
public function testRenameDashTags()
|
||||
{
|
||||
$refDB = new \ReferenceLinkDB(true);
|
||||
$refDB = new ReferenceLinkDB(true);
|
||||
$refDB->write(self::$testDatastore);
|
||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||
|
||||
$this->assertEmpty($linkDB->filterSearch(array('searchtags' => 'exclude')));
|
||||
$updater = new LegacyUpdater(array(), $linkDB, $this->conf, true);
|
||||
$this->assertEmpty($linkDB->filterSearch(['searchtags' => 'exclude']));
|
||||
$updater = new LegacyUpdater([], $linkDB, $this->conf, true);
|
||||
$updater->updateMethodRenameDashTags();
|
||||
$this->assertNotEmpty($linkDB->filterSearch(array('searchtags' => 'exclude')));
|
||||
$this->assertNotEmpty($linkDB->filterSearch(['searchtags' => 'exclude']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,7 +246,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
// The ConfigIO is initialized with ConfigPhp.
|
||||
$this->assertTrue($this->conf->getConfigIO() instanceof ConfigPhp);
|
||||
|
||||
$updater = new LegacyUpdater(array(), array(), $this->conf, false);
|
||||
$updater = new LegacyUpdater([], [], $this->conf, false);
|
||||
$done = $updater->updateMethodConfigToJson();
|
||||
$this->assertTrue($done);
|
||||
|
||||
|
@ -272,7 +271,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
public function testConfigToJsonNothingToDo()
|
||||
{
|
||||
$filetime = filemtime($this->conf->getConfigFileExt());
|
||||
$updater = new LegacyUpdater(array(), array(), $this->conf, false);
|
||||
$updater = new LegacyUpdater([], [], $this->conf, false);
|
||||
$done = $updater->updateMethodConfigToJson();
|
||||
$this->assertTrue($done);
|
||||
$expected = filemtime($this->conf->getConfigFileExt());
|
||||
|
@ -291,7 +290,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
$headerLink = '<script>alert("header_link");</script>';
|
||||
$this->conf->set('general.title', $title);
|
||||
$this->conf->set('general.header_link', $headerLink);
|
||||
$updater = new LegacyUpdater(array(), array(), $this->conf, true);
|
||||
$updater = new LegacyUpdater([], [], $this->conf, true);
|
||||
$done = $updater->updateMethodEscapeUnescapedConfig();
|
||||
$this->assertTrue($done);
|
||||
$this->conf->reload();
|
||||
|
@ -306,9 +305,9 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
public function testUpdateApiSettings()
|
||||
{
|
||||
$confFile = 'sandbox/config';
|
||||
copy(self::$configFile .'.json.php', $confFile .'.json.php');
|
||||
copy(self::$configFile . '.json.php', $confFile . '.json.php');
|
||||
$conf = new ConfigManager($confFile);
|
||||
$updater = new LegacyUpdater(array(), array(), $conf, true);
|
||||
$updater = new LegacyUpdater([], [], $conf, true);
|
||||
|
||||
$this->assertFalse($conf->exists('api.enabled'));
|
||||
$this->assertFalse($conf->exists('api.secret'));
|
||||
|
@ -316,7 +315,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
$conf->reload();
|
||||
$this->assertTrue($conf->get('api.enabled'));
|
||||
$this->assertTrue($conf->exists('api.secret'));
|
||||
unlink($confFile .'.json.php');
|
||||
unlink($confFile . '.json.php');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -325,15 +324,15 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
public function testUpdateApiSettingsNothingToDo()
|
||||
{
|
||||
$confFile = 'sandbox/config';
|
||||
copy(self::$configFile .'.json.php', $confFile .'.json.php');
|
||||
copy(self::$configFile . '.json.php', $confFile . '.json.php');
|
||||
$conf = new ConfigManager($confFile);
|
||||
$conf->set('api.enabled', false);
|
||||
$conf->set('api.secret', '');
|
||||
$updater = new LegacyUpdater(array(), array(), $conf, true);
|
||||
$updater = new LegacyUpdater([], [], $conf, true);
|
||||
$updater->updateMethodApiSettings();
|
||||
$this->assertFalse($conf->get('api.enabled'));
|
||||
$this->assertEmpty($conf->get('api.secret'));
|
||||
unlink($confFile .'.json.php');
|
||||
unlink($confFile . '.json.php');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -341,8 +340,8 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
*/
|
||||
public function testDatastoreIds()
|
||||
{
|
||||
$links = array(
|
||||
'20121206_182539' => array(
|
||||
$links = [
|
||||
'20121206_182539' => [
|
||||
'linkdate' => '20121206_182539',
|
||||
'title' => 'Geek and Poke',
|
||||
'url' => 'http://geek-and-poke.com/',
|
||||
|
@ -350,25 +349,25 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
'tags' => 'dev cartoon tag1 tag2 tag3 tag4 ',
|
||||
'updated' => '20121206_190301',
|
||||
'private' => false,
|
||||
),
|
||||
'20121206_172539' => array(
|
||||
],
|
||||
'20121206_172539' => [
|
||||
'linkdate' => '20121206_172539',
|
||||
'title' => 'UserFriendly - Samba',
|
||||
'url' => 'http://ars.userfriendly.org/cartoons/?id=20010306',
|
||||
'description' => '',
|
||||
'tags' => 'samba cartoon web',
|
||||
'private' => false,
|
||||
),
|
||||
'20121206_142300' => array(
|
||||
],
|
||||
'20121206_142300' => [
|
||||
'linkdate' => '20121206_142300',
|
||||
'title' => 'UserFriendly - Web Designer',
|
||||
'url' => 'http://ars.userfriendly.org/cartoons/?id=20121206',
|
||||
'description' => 'Naming conventions... #private',
|
||||
'tags' => 'samba cartoon web',
|
||||
'private' => true,
|
||||
),
|
||||
);
|
||||
$refDB = new \ReferenceLinkDB(true);
|
||||
],
|
||||
];
|
||||
$refDB = new ReferenceLinkDB(true);
|
||||
$refDB->setLinks($links);
|
||||
$refDB->write(self::$testDatastore);
|
||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||
|
@ -378,12 +377,12 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
$this->conf->set('resource.data_dir', 'sandbox');
|
||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
|
||||
$updater = new LegacyUpdater(array(), $linkDB, $this->conf, true);
|
||||
$updater = new LegacyUpdater([], $linkDB, $this->conf, true);
|
||||
$this->assertTrue($updater->updateMethodDatastoreIds());
|
||||
|
||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||
|
||||
$backupFiles = glob($this->conf->get('resource.data_dir') . '/datastore.'. date('YmdH') .'*.php');
|
||||
$backupFiles = glob($this->conf->get('resource.data_dir') . '/datastore.' . date('YmdH') . '*.php');
|
||||
$backup = null;
|
||||
foreach ($backupFiles as $backupFile) {
|
||||
if (strpos($backupFile, '_1') === false) {
|
||||
|
@ -437,7 +436,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
*/
|
||||
public function testDatastoreIdsNothingToDo()
|
||||
{
|
||||
$refDB = new \ReferenceLinkDB(true);
|
||||
$refDB = new ReferenceLinkDB(true);
|
||||
$refDB->write(self::$testDatastore);
|
||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||
|
||||
|
@ -445,7 +444,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||
|
||||
$checksum = hash_file('sha1', self::$testDatastore);
|
||||
$updater = new LegacyUpdater(array(), $linkDB, $this->conf, true);
|
||||
$updater = new LegacyUpdater([], $linkDB, $this->conf, true);
|
||||
$this->assertTrue($updater->updateMethodDatastoreIds());
|
||||
$this->assertEquals($checksum, hash_file('sha1', self::$testDatastore));
|
||||
}
|
||||
|
@ -478,9 +477,9 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
$sandbox = 'sandbox/config';
|
||||
copy(self::$configFile . '.json.php', $sandbox . '.json.php');
|
||||
$this->conf = new ConfigManager($sandbox);
|
||||
mkdir('sandbox/'. $theme);
|
||||
touch('sandbox/'. $theme .'/linklist.html');
|
||||
$this->conf->set('resource.raintpl_tpl', 'sandbox/'. $theme .'/');
|
||||
mkdir('sandbox/' . $theme);
|
||||
touch('sandbox/' . $theme . '/linklist.html');
|
||||
$this->conf->set('resource.raintpl_tpl', 'sandbox/' . $theme . '/');
|
||||
$updater = new LegacyUpdater([], [], $this->conf, true);
|
||||
$this->assertTrue($updater->updateMethodDefaultTheme());
|
||||
|
||||
|
@ -490,8 +489,8 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
$this->assertEquals('sandbox', $this->conf->get('resource.raintpl_tpl'));
|
||||
$this->assertEquals($theme, $this->conf->get('resource.theme'));
|
||||
unlink($sandbox . '.json.php');
|
||||
unlink('sandbox/'. $theme .'/linklist.html');
|
||||
rmdir('sandbox/'. $theme);
|
||||
unlink('sandbox/' . $theme . '/linklist.html');
|
||||
rmdir('sandbox/' . $theme);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -572,11 +571,11 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
$this->conf->set('plugins.PIWIK_URL', $url);
|
||||
$updater = new LegacyUpdater([], [], $this->conf, true);
|
||||
$this->assertTrue($updater->updateMethodPiwikUrl());
|
||||
$this->assertEquals('http://'. $url, $this->conf->get('plugins.PIWIK_URL'));
|
||||
$this->assertEquals('http://' . $url, $this->conf->get('plugins.PIWIK_URL'));
|
||||
|
||||
// reload from file
|
||||
$this->conf = new ConfigManager($sandboxConf);
|
||||
$this->assertEquals('http://'. $url, $this->conf->get('plugins.PIWIK_URL'));
|
||||
$this->assertEquals('http://' . $url, $this->conf->get('plugins.PIWIK_URL'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -781,12 +780,12 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
1 => ['id' => 1] + $blank,
|
||||
2 => ['id' => 2] + $blank,
|
||||
];
|
||||
$refDB = new \ReferenceLinkDB(true);
|
||||
$refDB = new ReferenceLinkDB(true);
|
||||
$refDB->setLinks($links);
|
||||
$refDB->write(self::$testDatastore);
|
||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||
|
||||
$updater = new LegacyUpdater(array(), $linkDB, $this->conf, true);
|
||||
$updater = new LegacyUpdater([], $linkDB, $this->conf, true);
|
||||
$this->assertTrue($updater->updateMethodSetSticky());
|
||||
|
||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||
|
@ -812,12 +811,12 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
|
|||
1 => ['id' => 1, 'sticky' => true] + $blank,
|
||||
2 => ['id' => 2] + $blank,
|
||||
];
|
||||
$refDB = new \ReferenceLinkDB(true);
|
||||
$refDB = new ReferenceLinkDB(true);
|
||||
$refDB->setLinks($links);
|
||||
$refDB->write(self::$testDatastore);
|
||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||
|
||||
$updater = new LegacyUpdater(array(), $linkDB, $this->conf, true);
|
||||
$updater = new LegacyUpdater([], $linkDB, $this->conf, true);
|
||||
$this->assertTrue($updater->updateMethodSetSticky());
|
||||
|
||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue