mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 22:06:43 +02:00
Merge branch 'develop' of https://github.com/getgrav/grav into feature/blueprints-update
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -39,4 +39,5 @@ user/config/security.yaml
|
||||
|
||||
tests/_output/*
|
||||
tests/_support/_generated/*
|
||||
tests/cache/*
|
||||
tests/cache/*
|
||||
tests/error.log
|
||||
|
||||
32
.travis.yml
32
.travis.yml
@@ -1,7 +1,12 @@
|
||||
language: php
|
||||
php: 5.6
|
||||
php:
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- hhvm
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
- build_test
|
||||
notifications:
|
||||
@@ -13,7 +18,7 @@ notifications:
|
||||
rooms:
|
||||
- secure: "bqO0wM1B7bJnQw2fuhquSXEqI9gw6WmFytIh9sEWXzbYTzTUP5t0PcKOd3FT2BNMRaDxPJLVl+vG/oqmqDUBkEmOGcG504IQjeNzZqnMz0tXQMIcCc22Las9tFfc4Jf6RVi/qGomFtHGE9Wgii+TAN4zqZaufbNjwd8SyjO0+W8="
|
||||
template:
|
||||
- '%{repository}#%{build_number} (%{branch}): Grav Core and Skeletons packages have been uploaded. (<a href="%{build_url}">Details</a>)'
|
||||
- '%{repository}#%{build_number} (%{branch}): Travis Job Finished [%{duration}] (<a href="%{build_url}">Details</a>)'
|
||||
format: html
|
||||
env:
|
||||
global:
|
||||
@@ -42,15 +47,24 @@ env:
|
||||
before_install:
|
||||
- export TZ=Pacific/Honolulu
|
||||
- composer self-update
|
||||
- go get github.com/aktau/github-release
|
||||
- echo "Travis Date - `date`"
|
||||
- git clone --quiet --depth=50 --branch=master https://${BB_TOKEN}bitbucket.org/rockettheme/grav-devtools.git $RT_DEVTOOLS &>/dev/null;
|
||||
- if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
cd "${RT_DEVTOOLS}";
|
||||
./build-grav.sh skeletons.txt;
|
||||
- if [ $TRAVIS_BRANCH == 'develop' ]; then
|
||||
composer install --dev --prefer-dist;
|
||||
fi
|
||||
- if [ $TRAVIS_BRANCH != 'develop' ] && [ $TRAVIS_PHP_VERSION == '5.6' ] && [ $TRAVIS_PULL_REQUEST == "false" ]; then
|
||||
go get github.com/aktau/github-release;
|
||||
git clone --quiet --depth=50 --branch=master https://${BB_TOKEN}bitbucket.org/rockettheme/grav-devtools.git $RT_DEVTOOLS &>/dev/null;
|
||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
cd ${RT_DEVTOOLS};
|
||||
./build-grav.sh skeletons.txt;
|
||||
fi;
|
||||
fi
|
||||
before_script:
|
||||
- if [ $TRAVIS_PHP_VERSION != 'hhvm' ]; then phpenv config-rm xdebug.ini; fi
|
||||
script:
|
||||
- if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
- if [ $TRAVIS_BRANCH == 'develop' ]; then
|
||||
vendor/bin/codecept run;
|
||||
fi
|
||||
- if [ ! -z "$TRAVIS_TAG" ] && [ $TRAVIS_BRANCH != 'develop' ] && [ $TRAVIS_PHP_VERSION == '5.6' ] && [ $TRAVIS_PULL_REQUEST == "false" ]; then
|
||||
FILES="$RT_DEVTOOLS/grav-dist/*.zip";
|
||||
for file in ${FILES[@]}; do
|
||||
NAME=${file##*/};
|
||||
|
||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,3 +1,9 @@
|
||||
# v1.0.9
|
||||
## XX/XX/2016
|
||||
|
||||
1. [](#improved)
|
||||
* [BC] Metadata now supports only flat arrays. To use open graph metas and the likes (ie, 'og:title'), simply specify it in the key.
|
||||
|
||||
# v1.0.8
|
||||
## 01/08/2016
|
||||
|
||||
@@ -18,13 +24,13 @@
|
||||
* Added support for APCu and PHP7.0 via new Doctrine Cache release
|
||||
* Added global setting for `twig_first` processing (false by default)
|
||||
* New configuration options for Session settings #553
|
||||
1. [](#improved)
|
||||
1. [](#improved)
|
||||
* Switched to SSL for GPM calls
|
||||
* Use `URI->host()` for session domain
|
||||
* Add support for `open_basedir` when installing packages via GPM
|
||||
* Improved `Utils::generateNonceString()` method to handle reverse proxies
|
||||
* Optimized core thumbnails saving 38% in file size
|
||||
* Added new `bin/gpm index --installed-only` option
|
||||
* Added new `bin/gpm index --installed-only` option
|
||||
* Improved GPM errors to provider more helpful diagnostic of issues
|
||||
* Removed old hardcoded PHP version references
|
||||
* Moved `onPageContentProcessed()` event so it's fired more reliably
|
||||
@@ -34,7 +40,7 @@
|
||||
* Fixed an issue with cache/config checksum not being set on cache load
|
||||
* Fix for page blueprint and theme inheritance issue #534
|
||||
* Set `ZipBackup` timeout to 10 minutes if possible
|
||||
* Fix case where we only have inline data for CSS or JS #565
|
||||
* Fix case where we only have inline data for CSS or JS #565
|
||||
* Fix `bin/grav sandbox` command to work with new `webserver-config` folder
|
||||
* Fix for markdown attributes on external URLs
|
||||
* Fixed issue where `data:` page header was acting as `publish_date:`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#  Grav
|
||||
#  Grav [](https://travis-ci.org/getgrav/grav)
|
||||
|
||||
[](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [](https://gitter.im/getgrav/grav?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
@@ -101,7 +101,7 @@ What you mainly want to know is that:
|
||||
* [Install](http://learn.getgrav.org/basics/installation) Grav in few seconds
|
||||
* Understand the [Configuration](http://learn.getgrav.org/basics/grav-configuration)
|
||||
* Take a peek at our available free [Skeletons](http://getgrav.org/downloads/skeletons)
|
||||
* If you have questions, jump on our [Gitter Room](https://gitter.im/getgrav/grav)!
|
||||
* If you have questions, jump on our [Gitter Room](https://gitter.im/getgrav/grav)!
|
||||
* Have fun!
|
||||
|
||||
# Exploring More
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"twig/twig": "~1.24",
|
||||
"erusev/parsedown": "dev-master as 1.6.0",
|
||||
"erusev/parsedown-extra": "~0.7",
|
||||
"symfony/yaml": "~2.8",
|
||||
"symfony/console": "~2.8",
|
||||
@@ -31,12 +32,6 @@
|
||||
"codeception/codeception": "^2.1",
|
||||
"fzaninotto/faker": "^1.5"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/getgrav/parsedown"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Grav\\": "system/src/Grav"
|
||||
|
||||
@@ -190,21 +190,6 @@ class Grav extends Container
|
||||
return new Browser();
|
||||
};
|
||||
|
||||
$container['base_url_absolute'] = function ($c) {
|
||||
/** @var Grav $c */
|
||||
return $c['config']->get('system.base_url_absolute') ?: $c['uri']->rootUrl(true);
|
||||
};
|
||||
|
||||
$container['base_url_relative'] = function ($c) {
|
||||
/** @var Grav $c */
|
||||
return $c['config']->get('system.base_url_relative') ?: $c['uri']->rootUrl(false);
|
||||
};
|
||||
|
||||
$container['base_url'] = function ($c) {
|
||||
/** @var Grav $c */
|
||||
return $c['config']->get('system.absolute_urls') ? $c['base_url_absolute'] : $c['base_url_relative'];
|
||||
};
|
||||
|
||||
$container->register(new StreamsServiceProvider);
|
||||
$container->register(new ConfigServiceProvider);
|
||||
|
||||
|
||||
@@ -317,7 +317,6 @@ trait ParsedownGravTrait
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$url['query'] = http_build_query($actions, null, '&', PHP_QUERY_RFC3986);
|
||||
}
|
||||
|
||||
@@ -326,15 +325,76 @@ trait ParsedownGravTrait
|
||||
unset ($url['query']);
|
||||
}
|
||||
|
||||
// set path to / if not set
|
||||
if (empty($url['path'])) {
|
||||
$url['path'] = '/';
|
||||
}
|
||||
|
||||
// if special scheme, just return
|
||||
if(isset($url['scheme']) && in_array($url['scheme'], $this->special_protocols)) {
|
||||
return $excerpt;
|
||||
}
|
||||
|
||||
// if there is no scheme, the file is local and we'll need to convert that URL
|
||||
if (!isset($url['scheme']) && (count($url) > 0)) {
|
||||
$excerpt['element']['attributes']['href'] = Uri::convertUrl($this->page, Uri::buildUrl($url), $type,
|
||||
$url['path'] = Uri::convertUrl($this->page, Uri::buildUrl($url), $type,
|
||||
true);
|
||||
} elseif (in_array($url['scheme'], $this->special_protocols)) {
|
||||
return $excerpt;
|
||||
} else {
|
||||
$excerpt['element']['attributes']['href'] = Uri::buildUrl($url);
|
||||
$url['path'] = Uri::convertUrl($this->page, $url['path'], $type, true);
|
||||
}
|
||||
|
||||
// URL path already has these now so remove them
|
||||
unset($url['query']);
|
||||
unset($url['fragment']);
|
||||
|
||||
// if absolute urls enabled, add them
|
||||
if (self::getGrav()['config']->get('system.absolute_urls', false)) {
|
||||
$uri = self::getGrav()['uri'];
|
||||
$url['scheme'] = str_replace('://', '', $uri->scheme());
|
||||
$url['host'] = $uri->host();
|
||||
|
||||
if ($uri->port() != 80 && $uri->port() != 443) {
|
||||
$url['port'] = $uri->port();
|
||||
}
|
||||
|
||||
// check if page exists for this route, and if so, check if it has SSL enabled
|
||||
$pages = self::getGrav()['pages'];
|
||||
$routes = $pages->routes();
|
||||
|
||||
// if this is an image, get the proper path
|
||||
$url_bits = pathinfo($url['path']);
|
||||
if (isset($url_bits['extension'])) {
|
||||
$target_path = $url_bits['dirname'];
|
||||
} else {
|
||||
$target_path = $url['path'];
|
||||
}
|
||||
|
||||
// strip base from this path
|
||||
$target_path = str_replace($uri->rootUrl(), '', $target_path);
|
||||
|
||||
// set to / if root
|
||||
if (empty($target_path)) {
|
||||
$target_path = '/';
|
||||
}
|
||||
|
||||
// look to see if this page exists and has ssl enabled
|
||||
if (isset($routes[$target_path])) {
|
||||
$target_page = $pages->get($routes[$target_path]);
|
||||
if ($target_page) {
|
||||
$ssl_enabled = $target_page->ssl();
|
||||
if (isset($ssl_enabled)) {
|
||||
if ($ssl_enabled) {
|
||||
$url['scheme'] = 'https';
|
||||
} else {
|
||||
$url['scheme'] = 'http';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$excerpt['element']['attributes']['href'] = Uri::buildUrl($url);
|
||||
|
||||
}
|
||||
|
||||
return $excerpt;
|
||||
|
||||
@@ -87,6 +87,7 @@ class Page
|
||||
protected $last_modified;
|
||||
protected $home_route;
|
||||
protected $hide_home_route;
|
||||
protected $ssl;
|
||||
|
||||
/**
|
||||
* @var Page Unmodified (original) version of the page. Used for copying and moving the page.
|
||||
@@ -100,6 +101,8 @@ class Page
|
||||
|
||||
/**
|
||||
* Page Object Constructor
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -109,6 +112,8 @@ class Page
|
||||
$this->taxonomy = [];
|
||||
$this->process = $config->get('system.pages.process');
|
||||
$this->published = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,6 +121,8 @@ class Page
|
||||
*
|
||||
* @param \SplFileInfo $file The file information for the .md file that the page represents
|
||||
* @param string $extension
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function init(\SplFileInfo $file, $extension = null)
|
||||
{
|
||||
@@ -147,6 +154,8 @@ class Page
|
||||
// extract page language from page extension
|
||||
$language = trim(basename($this->extension(), 'md'), '.') ?: null;
|
||||
$this->language($language);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -376,6 +385,9 @@ class Page
|
||||
if (isset($this->header->last_modified)) {
|
||||
$this->last_modified = (bool)$this->header->last_modified;
|
||||
}
|
||||
if (isset($this->header->ssl)) {
|
||||
$this->ssl = (bool) $this->header->ssl;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->header;
|
||||
@@ -1182,6 +1194,15 @@ class Page
|
||||
return $this->routable && $this->published();
|
||||
}
|
||||
|
||||
public function ssl($var = null)
|
||||
{
|
||||
if ($var !== null) {
|
||||
$this->ssl = (bool) $var;
|
||||
}
|
||||
|
||||
return $this->ssl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and Sets the process setup for this Page. This is multi-dimensional array that consists of
|
||||
* a simple array of arrays with the form array("markdown"=>true) for example
|
||||
@@ -1234,28 +1255,31 @@ class Page
|
||||
// Build an array of meta objects..
|
||||
foreach ((array)$metadata as $key => $value) {
|
||||
// If this is a property type metadata: "og", "twitter", "facebook" etc
|
||||
// Backward compatibility for nested arrays in metas
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $property => $prop_value) {
|
||||
$prop_key = $key . ":" . $property;
|
||||
$this->metadata[$prop_key] = [
|
||||
'property' => $prop_key,
|
||||
'content' => htmlspecialchars($prop_value, ENT_QUOTES)
|
||||
];
|
||||
$prop_key = $key . ":" . $property;
|
||||
$this->metadata[$prop_key] = ['name' => $prop_key, 'property' => $prop_key, 'content' => htmlspecialchars($prop_value, ENT_QUOTES)];
|
||||
}
|
||||
// If it this is a standard meta data type
|
||||
} else {
|
||||
// If it this is a standard meta data type
|
||||
if ($value) {
|
||||
if (in_array($key, $header_tag_http_equivs)) {
|
||||
$this->metadata[$key] = [
|
||||
'http_equiv' => $key,
|
||||
'content' => htmlspecialchars($value, ENT_QUOTES)
|
||||
];
|
||||
$this->metadata[$key] = ['http_equiv' => $key, 'content' => htmlspecialchars($value, ENT_QUOTES)];
|
||||
} else {
|
||||
$this->metadata[$key] = ['name' => $key, 'content' => htmlspecialchars($value, ENT_QUOTES)];
|
||||
// if it's a social metadata with separator, render as property
|
||||
$separator = strpos($key, ':');
|
||||
$hasSeparator = $separator && $separator < strlen($key) - 1;
|
||||
$entry = ['name' => $key, 'content' => htmlspecialchars($value, ENT_QUOTES)];
|
||||
|
||||
if ($hasSeparator) {
|
||||
$entry['property'] = $key;
|
||||
}
|
||||
|
||||
$this->metadata[$key] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1336,9 +1360,17 @@ class Page
|
||||
/** @var Pages $pages */
|
||||
$pages = self::getGrav()['pages'];
|
||||
|
||||
/** @var Config $config */
|
||||
$config = self::getGrav()['config'];
|
||||
|
||||
/** @var Language $language */
|
||||
$language = self::getGrav()['language'];
|
||||
|
||||
/** @var Uri $uri */
|
||||
$uri = self::getGrav()['uri'];
|
||||
|
||||
$include_port = false;
|
||||
|
||||
// get pre-route
|
||||
if ($include_lang && $language->enabled()) {
|
||||
$pre_route = $language->getLanguageURLPrefix();
|
||||
@@ -1346,6 +1378,11 @@ class Page
|
||||
$pre_route = '';
|
||||
}
|
||||
|
||||
// add full route if configured to do so
|
||||
if ($config->get('system.absolute_urls', false)) {
|
||||
$include_host = true;
|
||||
}
|
||||
|
||||
// get canonical route if requested
|
||||
if ($canonical) {
|
||||
$route = $pre_route . $this->routeCanonical();
|
||||
@@ -1353,9 +1390,6 @@ class Page
|
||||
$route = $pre_route . $this->route();
|
||||
}
|
||||
|
||||
/** @var Uri $uri */
|
||||
$uri = self::getGrav()['uri'];
|
||||
|
||||
$rootUrl = $uri->rootUrl($include_host) . $pages->base();
|
||||
|
||||
$url = $rootUrl . '/' . trim($route, '/') . $this->urlExtension();
|
||||
|
||||
@@ -16,7 +16,7 @@ use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
|
||||
use Whoops\Exception\ErrorException;
|
||||
|
||||
/**
|
||||
* GravPages is the class that is the entry point into the hierarchy of pages
|
||||
* Pages is the class that is the entry point into the hierarchy of pages
|
||||
*
|
||||
* @author RocketTheme
|
||||
* @license MIT
|
||||
@@ -63,8 +63,19 @@ class Pages
|
||||
*/
|
||||
protected $last_modified;
|
||||
|
||||
/**
|
||||
* @var array|string[]
|
||||
*/
|
||||
protected $ignore_files;
|
||||
|
||||
/**
|
||||
* @var array|string[]
|
||||
*/
|
||||
protected $ignore_folders;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $ignore_hidden;
|
||||
|
||||
/**
|
||||
@@ -72,6 +83,9 @@ class Pages
|
||||
*/
|
||||
static protected $types;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
static protected $home_route;
|
||||
|
||||
/**
|
||||
@@ -112,6 +126,10 @@ class Pages
|
||||
$this->ignore_folders = $config->get('system.pages.ignore_folders');
|
||||
$this->ignore_hidden = $config->get('system.pages.ignore_hidden');
|
||||
|
||||
$this->instances = [];
|
||||
$this->children = [];
|
||||
$this->routes = [];
|
||||
|
||||
$this->buildPages();
|
||||
}
|
||||
|
||||
@@ -351,7 +369,6 @@ class Pages
|
||||
{
|
||||
/** @var UniformResourceLocator $locator */
|
||||
$locator = $this->grav['locator'];
|
||||
|
||||
return $this->instances[rtrim($locator->findResource('page://'), DS)];
|
||||
}
|
||||
|
||||
|
||||
@@ -457,6 +457,11 @@ class TwigExtension extends \Twig_Extension
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->grav['config']->get('system.absolute_urls', false)) {
|
||||
$domain = true;
|
||||
}
|
||||
|
||||
|
||||
if (strpos((string) $input, '://')) {
|
||||
/** @var UniformResourceLocator $locator */
|
||||
$locator = $this->grav['locator'];
|
||||
|
||||
@@ -24,6 +24,7 @@ class Uri
|
||||
protected $params;
|
||||
protected $path;
|
||||
protected $paths;
|
||||
protected $scheme;
|
||||
protected $port;
|
||||
protected $query;
|
||||
protected $root;
|
||||
@@ -42,6 +43,7 @@ class Uri
|
||||
$this->name = $this->buildHostname();
|
||||
$this->port = $this->buildPort();
|
||||
$this->uri = $this->buildUri();
|
||||
$this->scheme = $this->buildScheme();
|
||||
$this->base = $this->buildBaseUrl();
|
||||
$this->host = $this->buildHost();
|
||||
$this->root_path = $this->buildRootPath();
|
||||
@@ -56,15 +58,15 @@ class Uri
|
||||
*/
|
||||
private function buildHostname()
|
||||
{
|
||||
$name = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost');
|
||||
$hostname = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost');
|
||||
|
||||
// Remove port from HTTP_HOST generated $name
|
||||
$name = Utils::substrToString($name, ':');
|
||||
// Remove port from HTTP_HOST generated $hostname
|
||||
$hostname = Utils::substrToString($hostname, ':');
|
||||
|
||||
// Validate the hostname
|
||||
$name = $this->validateHostname($name) ? $name : 'unknown';
|
||||
$hostname = $this->validateHostname($hostname) ? $hostname : 'unknown';
|
||||
|
||||
return $name;
|
||||
return $hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,6 +105,18 @@ class Uri
|
||||
return $uri;
|
||||
}
|
||||
|
||||
private function buildScheme()
|
||||
{
|
||||
// set the base
|
||||
if (isset($_SERVER['HTTPS'])) {
|
||||
$scheme = (strtolower(@$_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
|
||||
} else {
|
||||
$scheme = 'http://';
|
||||
}
|
||||
|
||||
return $scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base URI with port if needed
|
||||
*
|
||||
@@ -110,17 +124,7 @@ class Uri
|
||||
*/
|
||||
private function buildBaseUrl()
|
||||
{
|
||||
// set the base
|
||||
if (isset($_SERVER['HTTPS'])) {
|
||||
$base = (strtolower(@$_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
|
||||
} else {
|
||||
$base = 'http://';
|
||||
}
|
||||
|
||||
// add the server name
|
||||
$base .= $this->name;
|
||||
|
||||
return $base;
|
||||
return $this->scheme . $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,7 +221,6 @@ class Uri
|
||||
{
|
||||
$this->initializeWithUrl($url);
|
||||
$this->root_path = $root_path;
|
||||
$this->root = $this->base . $this->root_path;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -300,6 +303,11 @@ class Uri
|
||||
if ($this->content_path != '') {
|
||||
$this->paths = explode('/', $this->content_path);
|
||||
}
|
||||
|
||||
// Set some Grav stuff
|
||||
$grav['base_url_absolute'] = $this->rootUrl(true);
|
||||
$grav['base_url_relative'] = $this->rootUrl(false);
|
||||
$grav['base_url'] = $grav['config']->get('system.absolute_urls') ? $grav['base_url_absolute'] : $grav['base_url_relative'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -483,6 +491,17 @@ class Uri
|
||||
return $this->extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the scheme of the URI
|
||||
*
|
||||
* @return String The scheme of the URI
|
||||
*/
|
||||
public function scheme()
|
||||
{
|
||||
return $this->scheme;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the host of the URI
|
||||
*
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace Grav;
|
||||
use Codeception\Util\Fixtures;
|
||||
use Faker\Factory;
|
||||
|
||||
ini_set('error_log', __DIR__ . '/error.log');
|
||||
|
||||
// Ensure vendor libraries exist
|
||||
$autoload = __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
@@ -38,8 +40,11 @@ $grav = Grav::instance(
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$grav['uri']->init();
|
||||
$grav['debugger']->init();
|
||||
$grav['assets']->init();
|
||||
$grav['config']->set('system.cache.enabled', false);
|
||||
|
||||
// Set default $_SERVER value used for nonces
|
||||
empty( $_SERVER['HTTP_CLIENT_IP'] ) && $_SERVER['HTTP_CLIENT_IP'] = '127.0.0.1';
|
||||
|
||||
@@ -1,10 +1,80 @@
|
||||
<?php
|
||||
namespace Helper;
|
||||
|
||||
use Codeception;
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
class Unit extends \Codeception\Module
|
||||
/**
|
||||
* Class Unit
|
||||
* @package Helper
|
||||
*/
|
||||
class Unit extends Codeception\Module
|
||||
{
|
||||
/**
|
||||
* HOOK: used after configuration is loaded
|
||||
*/
|
||||
public function _initialize() {
|
||||
}
|
||||
|
||||
/**
|
||||
* HOOK: on every Actor class initialization
|
||||
*/
|
||||
public function _cleanup() {
|
||||
}
|
||||
|
||||
/**
|
||||
* HOOK: before suite
|
||||
*
|
||||
* @param array $settings
|
||||
*/
|
||||
public function _beforeSuite($settings = []) {
|
||||
}
|
||||
|
||||
/**
|
||||
* HOOK: after suite
|
||||
**/
|
||||
public function _afterSuite() {
|
||||
}
|
||||
|
||||
/**
|
||||
* HOOK: before each step
|
||||
*
|
||||
* @param Codeception\Step $step*
|
||||
*/
|
||||
public function _beforeStep(Codeception\Step $step) {
|
||||
}
|
||||
|
||||
/**
|
||||
* HOOK: after each step
|
||||
*
|
||||
* @param Codeception\Step $step
|
||||
*/
|
||||
public function _afterStep(Codeception\Step $step) {
|
||||
}
|
||||
|
||||
/**
|
||||
* HOOK: before each suite
|
||||
*
|
||||
* @param Codeception\TestCase $test
|
||||
*/
|
||||
public function _before(Codeception\TestCase $test) {
|
||||
}
|
||||
|
||||
/**
|
||||
* HOOK: before each suite
|
||||
*
|
||||
* @param Codeception\TestCase $test
|
||||
*/
|
||||
public function _after(Codeception\TestCase $test) {
|
||||
}
|
||||
|
||||
/**
|
||||
* HOOK: on fail
|
||||
*
|
||||
* @param Codeception\TestCase $test
|
||||
* @param $fail
|
||||
*/
|
||||
public function _failed(Codeception\TestCase $test, $fail) {
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
<?php //[STAMP] 217732cfcf1663b385a9cfd121bbeed3
|
||||
namespace _generated;
|
||||
|
||||
// This class was automatically generated by build task
|
||||
// You should not change it manually as it will be overwritten on next build
|
||||
// @codingStandardsIgnoreFile
|
||||
|
||||
use Helper\Functional;
|
||||
|
||||
trait FunctionalTesterActions
|
||||
{
|
||||
/**
|
||||
* @return \Codeception\Scenario
|
||||
*/
|
||||
abstract protected function getScenario();
|
||||
|
||||
|
||||
}
|
||||
@@ -1,348 +0,0 @@
|
||||
<?php //[STAMP] 8c2b6acdd1e147b7717797f40c58c89c
|
||||
namespace _generated;
|
||||
|
||||
// This class was automatically generated by build task
|
||||
// You should not change it manually as it will be overwritten on next build
|
||||
// @codingStandardsIgnoreFile
|
||||
|
||||
use Codeception\Module\Asserts;
|
||||
use Helper\Unit;
|
||||
|
||||
trait UnitTesterActions
|
||||
{
|
||||
/**
|
||||
* @return \Codeception\Scenario
|
||||
*/
|
||||
abstract protected function getScenario();
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that two variables are equal.
|
||||
*
|
||||
* @param $expected
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
*
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Asserts::assertEquals()
|
||||
*/
|
||||
public function assertEquals($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that two variables are not equal
|
||||
*
|
||||
* @param $expected
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertNotEquals()
|
||||
*/
|
||||
public function assertNotEquals($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that two variables are same
|
||||
*
|
||||
* @param $expected
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
*
|
||||
* @return mixed
|
||||
* @see \Codeception\Module\Asserts::assertSame()
|
||||
*/
|
||||
public function assertSame($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that two variables are not same
|
||||
*
|
||||
* @param $expected
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertNotSame()
|
||||
*/
|
||||
public function assertNotSame($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that actual is greater than expected
|
||||
*
|
||||
* @param $expected
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertGreaterThan()
|
||||
*/
|
||||
public function assertGreaterThan($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* @deprecated
|
||||
* @see \Codeception\Module\Asserts::assertGreaterThen()
|
||||
*/
|
||||
public function assertGreaterThen($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThen', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that actual is greater or equal than expected
|
||||
*
|
||||
* @param $expected
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertGreaterThanOrEqual()
|
||||
*/
|
||||
public function assertGreaterThanOrEqual($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* @deprecated
|
||||
* @see \Codeception\Module\Asserts::assertGreaterThenOrEqual()
|
||||
*/
|
||||
public function assertGreaterThenOrEqual($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThenOrEqual', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that actual is less than expected
|
||||
*
|
||||
* @param $expected
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertLessThan()
|
||||
*/
|
||||
public function assertLessThan($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that actual is less or equal than expected
|
||||
*
|
||||
* @param $expected
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertLessThanOrEqual()
|
||||
*/
|
||||
public function assertLessThanOrEqual($expected, $actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that haystack contains needle
|
||||
*
|
||||
* @param $needle
|
||||
* @param $haystack
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertContains()
|
||||
*/
|
||||
public function assertContains($needle, $haystack, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that haystack doesn't contain needle.
|
||||
*
|
||||
* @param $needle
|
||||
* @param $haystack
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertNotContains()
|
||||
*/
|
||||
public function assertNotContains($needle, $haystack, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that string match with pattern
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param string $string
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertRegExp()
|
||||
*/
|
||||
public function assertRegExp($pattern, $string, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that string not match with pattern
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param string $string
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertNotRegExp()
|
||||
*/
|
||||
public function assertNotRegExp($pattern, $string, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that variable is empty.
|
||||
*
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertEmpty()
|
||||
*/
|
||||
public function assertEmpty($actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that variable is not empty.
|
||||
*
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertNotEmpty()
|
||||
*/
|
||||
public function assertNotEmpty($actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that variable is NULL
|
||||
*
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertNull()
|
||||
*/
|
||||
public function assertNull($actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that variable is not NULL
|
||||
*
|
||||
* @param $actual
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertNotNull()
|
||||
*/
|
||||
public function assertNotNull($actual, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that condition is positive.
|
||||
*
|
||||
* @param $condition
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertTrue()
|
||||
*/
|
||||
public function assertTrue($condition, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks that condition is negative.
|
||||
*
|
||||
* @param $condition
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertFalse()
|
||||
*/
|
||||
public function assertFalse($condition, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks if file exists
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertFileExists()
|
||||
*/
|
||||
public function assertFileExists($filename, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Checks if file doesn't exist
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
* @see \Codeception\Module\Asserts::assertFileNotExists()
|
||||
*/
|
||||
public function assertFileNotExists($filename, $message = null) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [!] Method is generated. Documentation taken from corresponding module.
|
||||
*
|
||||
* Fails the test with message.
|
||||
*
|
||||
* @param $message
|
||||
* @see \Codeception\Module\Asserts::fail()
|
||||
*/
|
||||
public function fail($message) {
|
||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-1-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-1-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-1-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-2-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-2-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-2-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-3-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-3-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-3-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
10
tests/fake/nested-site/user/pages/01.item1/default.md
Normal file
10
tests/fake/nested-site/user/pages/01.item1/default.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-1-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-1-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-1-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-2-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-2-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-2-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-3-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-3-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-3-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
10
tests/fake/nested-site/user/pages/02.item2/default.md
Normal file
10
tests/fake/nested-site/user/pages/02.item2/default.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: Animal
|
||||
taxonomy:
|
||||
tag: [animal, cat]
|
||||
---
|
||||
|
||||
<h1>Tags: animal</h1
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 3-1-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 3-1-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 3-2-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 3-2-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 3-2-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 3-3-1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 3-3-2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 3-3-3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
10
tests/fake/nested-site/user/pages/03.item3/default.md
Normal file
10
tests/fake/nested-site/user/pages/03.item3/default.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Item 3
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
10
tests/fake/simple-site/user/pages/01.home/default.md
Normal file
10
tests/fake/simple-site/user/pages/01.home/default.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Home
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
10
tests/fake/simple-site/user/pages/02.blog/blog.md
Normal file
10
tests/fake/simple-site/user/pages/02.blog/blog.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Blog
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
10
tests/fake/simple-site/user/pages/02.blog/post-one/item.md
Normal file
10
tests/fake/simple-site/user/pages/02.blog/post-one/item.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Post 1
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
10
tests/fake/simple-site/user/pages/02.blog/post-two/item.md
Normal file
10
tests/fake/simple-site/user/pages/02.blog/post-two/item.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Post 2
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
10
tests/fake/simple-site/user/pages/03.about/default.md
Normal file
10
tests/fake/simple-site/user/pages/03.about/default.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: About
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
@@ -1,473 +1,432 @@
|
||||
<?php
|
||||
|
||||
use Codeception\Util\Fixtures;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Assets;
|
||||
|
||||
/**
|
||||
* Class AssetsTest
|
||||
*/
|
||||
class AssetsTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
/**
|
||||
* @var \UnitTester
|
||||
*/
|
||||
protected $tester;
|
||||
/** @var Grav $grav */
|
||||
protected $grav;
|
||||
|
||||
/** @var Assets $assets */
|
||||
protected $assets;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
$this->grav = Fixtures::get('grav');
|
||||
$this->assets = $this->grav['assets'];
|
||||
}
|
||||
|
||||
protected function _after()
|
||||
{
|
||||
}
|
||||
|
||||
public function grav()
|
||||
{
|
||||
$grav = Fixtures::get('grav');
|
||||
return $grav;
|
||||
}
|
||||
|
||||
public function assets()
|
||||
{
|
||||
return $this->grav()['assets'];
|
||||
}
|
||||
|
||||
public function testAddingAssets()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
//test add()
|
||||
$assets->add('test.css');
|
||||
$this->assets->add('test.css');
|
||||
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, '<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame('<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
|
||||
$array = $assets->getCss();
|
||||
$this->assertSame(reset($array), [
|
||||
'asset' => '/test.css',
|
||||
$array = $this->assets->getCss();
|
||||
$this->assertSame([
|
||||
'asset' => '/test.css',
|
||||
'priority' => 10,
|
||||
'order' => 0,
|
||||
'order' => 0,
|
||||
'pipeline' => true,
|
||||
'group' => 'head'
|
||||
]);
|
||||
'group' => 'head'
|
||||
], reset($array));
|
||||
|
||||
$assets->add('test.js');
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/test.js" type="text/javascript" ></script>' . PHP_EOL);
|
||||
$this->assets->add('test.js');
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/test.js" type="text/javascript" ></script>' . PHP_EOL, $js);
|
||||
|
||||
$array = $assets->getCss();
|
||||
$this->assertSame(reset($array), [
|
||||
'asset' => '/test.css',
|
||||
$array = $this->assets->getCss();
|
||||
$this->assertSame([
|
||||
'asset' => '/test.css',
|
||||
'priority' => 10,
|
||||
'order' => 0,
|
||||
'order' => 0,
|
||||
'pipeline' => true,
|
||||
'group' => 'head'
|
||||
]);
|
||||
'group' => 'head'
|
||||
], reset($array));
|
||||
|
||||
//test addCss(). Test adding asset to a separate group
|
||||
$assets->reset();
|
||||
$assets->addCSS('test.css');
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, '<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addCSS('test.css');
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame('<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
|
||||
$array = $assets->getCss();
|
||||
$this->assertSame(reset($array), [
|
||||
'asset' => '/test.css',
|
||||
$array = $this->assets->getCss();
|
||||
$this->assertSame([
|
||||
'asset' => '/test.css',
|
||||
'priority' => 10,
|
||||
'order' => 0,
|
||||
'order' => 0,
|
||||
'pipeline' => true,
|
||||
'group' => 'head'
|
||||
]);
|
||||
'group' => 'head'
|
||||
], reset($array));
|
||||
|
||||
//test addJs()
|
||||
$assets->reset();
|
||||
$assets->addJs('test.js');
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/test.js" type="text/javascript" ></script>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs('test.js');
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/test.js" type="text/javascript" ></script>' . PHP_EOL, $js);
|
||||
|
||||
$array = $assets->getJs();
|
||||
$this->assertSame(reset($array), [
|
||||
'asset' => '/test.js',
|
||||
$array = $this->assets->getJs();
|
||||
$this->assertSame([
|
||||
'asset' => '/test.js',
|
||||
'priority' => 10,
|
||||
'order' => 0,
|
||||
'order' => 0,
|
||||
'pipeline' => true,
|
||||
'loading' => '',
|
||||
'group' => 'head'
|
||||
]);
|
||||
'loading' => '',
|
||||
'group' => 'head'
|
||||
], reset($array));
|
||||
|
||||
//Test CSS Groups
|
||||
$assets->reset();
|
||||
$assets->addCSS('test.css', null, true, 'footer');
|
||||
$css = $assets->css();
|
||||
$this->assets->reset();
|
||||
$this->assets->addCSS('test.css', null, true, 'footer');
|
||||
$css = $this->assets->css();
|
||||
$this->assertEmpty($css);
|
||||
$css = $assets->css('footer');
|
||||
$this->assertSame($css, '<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
$css = $this->assets->css('footer');
|
||||
$this->assertSame('<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
|
||||
$array = $assets->getCss();
|
||||
$this->assertSame(reset($array), [
|
||||
'asset' => '/test.css',
|
||||
$array = $this->assets->getCss();
|
||||
$this->assertSame([
|
||||
'asset' => '/test.css',
|
||||
'priority' => 10,
|
||||
'order' => 0,
|
||||
'order' => 0,
|
||||
'pipeline' => true,
|
||||
'group' => 'footer'
|
||||
]);
|
||||
'group' => 'footer'
|
||||
], reset($array));
|
||||
|
||||
//Test JS Groups
|
||||
$assets->reset();
|
||||
$assets->addJs('test.js', null, true, null, 'footer');
|
||||
$js = $assets->js();
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs('test.js', null, true, null, 'footer');
|
||||
$js = $this->assets->js();
|
||||
$this->assertEmpty($js);
|
||||
$js = $assets->js('footer');
|
||||
$this->assertSame($js, '<script src="/test.js" type="text/javascript" ></script>' . PHP_EOL);
|
||||
$js = $this->assets->js('footer');
|
||||
$this->assertSame('<script src="/test.js" type="text/javascript" ></script>' . PHP_EOL, $js);
|
||||
|
||||
$array = $assets->getJs();
|
||||
$this->assertSame(reset($array), [
|
||||
'asset' => '/test.js',
|
||||
$array = $this->assets->getJs();
|
||||
$this->assertSame([
|
||||
'asset' => '/test.js',
|
||||
'priority' => 10,
|
||||
'order' => 0,
|
||||
'order' => 0,
|
||||
'pipeline' => true,
|
||||
'loading' => '',
|
||||
'group' => 'footer'
|
||||
]);
|
||||
'loading' => '',
|
||||
'group' => 'footer'
|
||||
], reset($array));
|
||||
|
||||
//Test async / defer
|
||||
$assets->reset();
|
||||
$assets->addJs('test.js', null, true, 'async', null);
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs('test.js', null, true, 'async', null);
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL, $js);
|
||||
|
||||
$array = $assets->getJs();
|
||||
$this->assertSame(reset($array), [
|
||||
'asset' => '/test.js',
|
||||
$array = $this->assets->getJs();
|
||||
$this->assertSame([
|
||||
'asset' => '/test.js',
|
||||
'priority' => 10,
|
||||
'order' => 0,
|
||||
'order' => 0,
|
||||
'pipeline' => true,
|
||||
'loading' => 'async',
|
||||
'group' => 'head'
|
||||
]);
|
||||
'loading' => 'async',
|
||||
'group' => 'head'
|
||||
], reset($array));
|
||||
|
||||
$assets->reset();
|
||||
$assets->addJs('test.js', null, true, 'defer', null);
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/test.js" type="text/javascript" defer></script>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs('test.js', null, true, 'defer', null);
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/test.js" type="text/javascript" defer></script>' . PHP_EOL, $js);
|
||||
|
||||
$array = $assets->getJs();
|
||||
$this->assertSame(reset($array), [
|
||||
'asset' => '/test.js',
|
||||
$array = $this->assets->getJs();
|
||||
$this->assertSame([
|
||||
'asset' => '/test.js',
|
||||
'priority' => 10,
|
||||
'order' => 0,
|
||||
'order' => 0,
|
||||
'pipeline' => true,
|
||||
'loading' => 'defer',
|
||||
'group' => 'head'
|
||||
]);
|
||||
'loading' => 'defer',
|
||||
'group' => 'head'
|
||||
], reset($array));
|
||||
}
|
||||
|
||||
public function testAddingAssetPropertiesWithArray()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
//Test adding assets with object to define properties
|
||||
$assets->reset();
|
||||
$assets->addJs('test.js', ['loading' => 'async']);
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL);
|
||||
$assets->reset();
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs('test.js', ['loading' => 'async']);
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL, $js);
|
||||
$this->assets->reset();
|
||||
|
||||
}
|
||||
|
||||
public function testAddingJSAssetPropertiesWithArrayFromCollection()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
//Test adding properties with array
|
||||
$assets->reset();
|
||||
$assets->addJs('jquery', ['loading' => 'async']);
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs('jquery', ['loading' => 'async']);
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL, $js);
|
||||
|
||||
//Test priority too
|
||||
$assets->reset();
|
||||
$assets->addJs('jquery', ['loading' => 'async', 'priority' => 1]);
|
||||
$assets->addJs('test.js', ['loading' => 'async', 'priority' => 2]);
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL .
|
||||
'<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs('jquery', ['loading' => 'async', 'priority' => 1]);
|
||||
$this->assets->addJs('test.js', ['loading' => 'async', 'priority' => 2]);
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL .
|
||||
'<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL, $js);
|
||||
|
||||
//Test multiple groups
|
||||
$assets->reset();
|
||||
$assets->addJs('jquery', ['loading' => 'async', 'priority' => 1, 'group' => 'footer']);
|
||||
$assets->addJs('test.js', ['loading' => 'async', 'priority' => 2]);
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL);
|
||||
$js = $assets->js('footer');
|
||||
$this->assertSame($js, '<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs('jquery', ['loading' => 'async', 'priority' => 1, 'group' => 'footer']);
|
||||
$this->assets->addJs('test.js', ['loading' => 'async', 'priority' => 2]);
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL, $js);
|
||||
$js = $this->assets->js('footer');
|
||||
$this->assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL, $js);
|
||||
|
||||
//Test adding array of assets
|
||||
//Test priority too
|
||||
$assets->reset();
|
||||
$assets->addJs(['jquery', 'test.js'], ['loading' => 'async']);
|
||||
$js = $assets->js();
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs(['jquery', 'test.js'], ['loading' => 'async']);
|
||||
$js = $this->assets->js();
|
||||
|
||||
$this->assertSame($js, '<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL .
|
||||
'<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL);
|
||||
$this->assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL .
|
||||
'<script src="/test.js" type="text/javascript" async></script>' . PHP_EOL, $js);
|
||||
}
|
||||
|
||||
public function testAddingCSSAssetPropertiesWithArrayFromCollection()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$assets->registerCollection('test', ['/system/assets/whoops.css']);
|
||||
$this->assets->registerCollection('test', ['/system/assets/whoops.css']);
|
||||
|
||||
//Test priority too
|
||||
$assets->reset();
|
||||
$assets->addCss('test', ['priority' => 1]);
|
||||
$assets->addCss('test.css', ['priority' => 2]);
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, '<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/system/assets/whoops.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addCss('test', ['priority' => 1]);
|
||||
$this->assets->addCss('test.css', ['priority' => 2]);
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame('<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/system/assets/whoops.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
|
||||
//Test multiple groups
|
||||
$assets->reset();
|
||||
$assets->addCss('test', ['priority' => 1, 'group' => 'footer']);
|
||||
$assets->addCss('test.css', ['priority' => 2]);
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, '<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
$css = $assets->css('footer');
|
||||
$this->assertSame($css, '<link href="/system/assets/whoops.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addCss('test', ['priority' => 1, 'group' => 'footer']);
|
||||
$this->assets->addCss('test.css', ['priority' => 2]);
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame('<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
$css = $this->assets->css('footer');
|
||||
$this->assertSame('<link href="/system/assets/whoops.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
|
||||
//Test adding array of assets
|
||||
//Test priority too
|
||||
$assets->reset();
|
||||
$assets->addCss(['test', 'test.css'], ['loading' => 'async']);
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, '<link href="/system/assets/whoops.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addCss(['test', 'test.css'], ['loading' => 'async']);
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame('<link href="/system/assets/whoops.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
}
|
||||
|
||||
public function testPriorityOfAssets()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
$this->assets->reset();
|
||||
$this->assets->add('test.css');
|
||||
$this->assets->add('test-after.css');
|
||||
|
||||
$assets->reset();
|
||||
$assets->add('test.css');
|
||||
$assets->add('test-after.css');
|
||||
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, '<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/test-after.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame('<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/test-after.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
|
||||
//----------------
|
||||
$assets->reset();
|
||||
$assets->add('test-after.css', 1);
|
||||
$assets->add('test.css', 2);
|
||||
$this->assets->reset();
|
||||
$this->assets->add('test-after.css', 1);
|
||||
$this->assets->add('test.css', 2);
|
||||
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, '<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/test-after.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame('<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/test-after.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
|
||||
//----------------
|
||||
$assets->reset();
|
||||
$assets->add('test-after.css', 1);
|
||||
$assets->add('test.css', 2);
|
||||
$assets->add('test-before.css', 3);
|
||||
$this->assets->reset();
|
||||
$this->assets->add('test-after.css', 1);
|
||||
$this->assets->add('test.css', 2);
|
||||
$this->assets->add('test-before.css', 3);
|
||||
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, '<link href="/test-before.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame('<link href="/test-before.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/test.css" type="text/css" rel="stylesheet" />' . PHP_EOL .
|
||||
'<link href="/test-after.css" type="text/css" rel="stylesheet" />' . PHP_EOL);
|
||||
'<link href="/test-after.css" type="text/css" rel="stylesheet" />' . PHP_EOL, $css);
|
||||
}
|
||||
|
||||
public function testPipeline()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$assets->reset();
|
||||
$this->assets->reset();
|
||||
|
||||
//File not existing. Pipeline searches for that file without reaching it. Output is empty.
|
||||
$assets->add('test.css', null, true);
|
||||
$assets->setCssPipeline(true);
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, '');
|
||||
$this->assets->add('test.css', null, true);
|
||||
$this->assets->setCssPipeline(true);
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame('', $css);
|
||||
|
||||
//Add a core Grav CSS file, which is found. Pipeline will now return a file
|
||||
$assets->add('/system/assets/debugger.css', null, true);
|
||||
$css = $assets->css();
|
||||
$this->assets->add('/system/assets/debugger.css', null, true);
|
||||
$css = $this->assets->css();
|
||||
$this->assertContains('<link href=', $css);
|
||||
$this->assertContains('type="text/css" rel="stylesheet" />', $css);
|
||||
}
|
||||
|
||||
public function testAddAsyncJs()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$assets->reset();
|
||||
$assets->addAsyncJs('jquery');
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addAsyncJs('jquery');
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" async></script>' . PHP_EOL, $js);
|
||||
}
|
||||
|
||||
public function testAddDeferJs()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$assets->reset();
|
||||
$assets->addDeferJs('jquery');
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, '<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" defer></script>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addDeferJs('jquery');
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" type="text/javascript" defer></script>' . PHP_EOL, $js);
|
||||
}
|
||||
|
||||
public function testAddInlineCss()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$assets->reset();
|
||||
$assets->addInlineCss('body { color: black }');
|
||||
$css = $assets->css();
|
||||
$this->assertSame($css, PHP_EOL. '<style>' .PHP_EOL . 'body { color: black }' . PHP_EOL.PHP_EOL .'</style>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addInlineCss('body { color: black }');
|
||||
$css = $this->assets->css();
|
||||
$this->assertSame(PHP_EOL . '<style>' . PHP_EOL . 'body { color: black }' . PHP_EOL . PHP_EOL . '</style>' . PHP_EOL, $css);
|
||||
}
|
||||
|
||||
public function testAddInlineJs()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$assets->reset();
|
||||
$assets->addInlineJs('alert("test")');
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js,
|
||||
PHP_EOL . '<script>' . PHP_EOL . 'alert("test")' . PHP_EOL . PHP_EOL . '</script>' . PHP_EOL);
|
||||
$this->assets->reset();
|
||||
$this->assets->addInlineJs('alert("test")');
|
||||
$js = $this->assets->js();
|
||||
$this->assertSame(PHP_EOL . '<script>' . PHP_EOL . 'alert("test")' . PHP_EOL . PHP_EOL . '</script>' . PHP_EOL, $js);
|
||||
}
|
||||
|
||||
public function testGetCollections()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$this->assertTrue(is_array($assets->getCollections()));
|
||||
$this->assertTrue(in_array('jquery', array_keys($assets->getCollections())));
|
||||
$this->assertTrue(in_array('system://assets/jquery/jquery-2.x.min.js', $assets->getCollections()));
|
||||
$this->assertTrue(is_array($this->assets->getCollections()));
|
||||
$this->assertTrue(in_array('jquery', array_keys($this->assets->getCollections())));
|
||||
$this->assertTrue(in_array('system://assets/jquery/jquery-2.x.min.js', $this->assets->getCollections()));
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$this->assertTrue($assets->exists('jquery'));
|
||||
$this->assertFalse($assets->exists('another-unexisting-library'));
|
||||
$this->assertTrue($this->assets->exists('jquery'));
|
||||
$this->assertFalse($this->assets->exists('another-unexisting-library'));
|
||||
}
|
||||
|
||||
public function testRegisterCollection()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$assets->registerCollection('debugger', ['/system/assets/debugger.css']);
|
||||
$this->assertTrue($assets->exists('debugger'));
|
||||
$this->assertTrue(in_array('debugger', array_keys($assets->getCollections())));
|
||||
$this->assets->registerCollection('debugger', ['/system/assets/debugger.css']);
|
||||
$this->assertTrue($this->assets->exists('debugger'));
|
||||
$this->assertTrue(in_array('debugger', array_keys($this->assets->getCollections())));
|
||||
}
|
||||
|
||||
public function testReset()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
$this->assets->addInlineJs('alert("test")');
|
||||
$this->assets->reset();
|
||||
$this->assertTrue(count($this->assets->js()) == 0);
|
||||
|
||||
$assets->addInlineJs('alert("test")');
|
||||
$assets->reset();
|
||||
$this->assertTrue(count($assets->js()) == 0);
|
||||
$this->assets->addAsyncJs('jquery');
|
||||
$this->assets->reset();
|
||||
|
||||
$assets->addAsyncJs('jquery');
|
||||
$assets->reset();
|
||||
$this->assertTrue(count($this->assets->js()) == 0);
|
||||
|
||||
$this->assertTrue(count($assets->js()) == 0);
|
||||
$this->assets->addInlineCss('body { color: black }');
|
||||
$this->assets->reset();
|
||||
|
||||
$assets->addInlineCss('body { color: black }');
|
||||
$assets->reset();
|
||||
$this->assertTrue(count($this->assets->css()) == 0);
|
||||
|
||||
$this->assertTrue(count($assets->css()) == 0);
|
||||
$this->assets->add('/system/assets/debugger.css', null, true);
|
||||
$this->assets->reset();
|
||||
|
||||
$assets->add('/system/assets/debugger.css', null, true);
|
||||
$assets->reset();
|
||||
|
||||
$this->assertTrue(count($assets->css()) == 0);
|
||||
$this->assertTrue(count($this->assets->css()) == 0);
|
||||
}
|
||||
|
||||
public function testResetJs()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
$this->assets->addInlineJs('alert("test")');
|
||||
$this->assets->resetJs();
|
||||
$this->assertTrue(count($this->assets->js()) == 0);
|
||||
|
||||
$assets->addInlineJs('alert("test")');
|
||||
$assets->resetJs();
|
||||
$this->assertTrue(count($assets->js()) == 0);
|
||||
$this->assets->addAsyncJs('jquery');
|
||||
$this->assets->resetJs();
|
||||
|
||||
$assets->addAsyncJs('jquery');
|
||||
$assets->resetJs();
|
||||
|
||||
$this->assertTrue(count($assets->js()) == 0);
|
||||
$this->assertTrue(count($this->assets->js()) == 0);
|
||||
}
|
||||
|
||||
public function testResetCss()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
$this->assertTrue(count($this->assets->js()) == 0);
|
||||
|
||||
$this->assertTrue(count($assets->js()) == 0);
|
||||
$this->assets->addInlineCss('body { color: black }');
|
||||
$this->assets->resetCss();
|
||||
|
||||
$assets->addInlineCss('body { color: black }');
|
||||
$assets->resetCss();
|
||||
$this->assertTrue(count($this->assets->css()) == 0);
|
||||
|
||||
$this->assertTrue(count($assets->css()) == 0);
|
||||
$this->assets->add('/system/assets/debugger.css', null, true);
|
||||
$this->assets->resetCss();
|
||||
|
||||
$assets->add('/system/assets/debugger.css', null, true);
|
||||
$assets->resetCss();
|
||||
|
||||
$this->assertTrue(count($assets->css()) == 0);
|
||||
$this->assertTrue(count($this->assets->css()) == 0);
|
||||
}
|
||||
|
||||
public function testAddDirCss()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
$assets->reset();
|
||||
$assets->addDirCss('/system');
|
||||
$this->assets->addDirCss('/system');
|
||||
|
||||
$this->assertTrue(is_array($assets->getCss()));
|
||||
$this->assertTrue(count($assets->getCss()) > 0);
|
||||
$this->assertTrue(is_array($assets->getJs()));
|
||||
$this->assertTrue(count($assets->getJs()) == 0);
|
||||
$this->assertTrue(is_array($this->assets->getCss()));
|
||||
$this->assertTrue(count($this->assets->getCss()) > 0);
|
||||
$this->assertTrue(is_array($this->assets->getJs()));
|
||||
$this->assertTrue(count($this->assets->getJs()) == 0);
|
||||
|
||||
$assets->reset();
|
||||
$assets->addDirCss('/system/assets');
|
||||
$this->assets->reset();
|
||||
$this->assets->addDirCss('/system/assets');
|
||||
|
||||
$this->assertTrue(is_array($assets->getCss()));
|
||||
$this->assertTrue(count($assets->getCss()) > 0);
|
||||
$this->assertTrue(is_array($assets->getJs()));
|
||||
$this->assertTrue(count($assets->getJs()) == 0);
|
||||
$this->assertTrue(is_array($this->assets->getCss()));
|
||||
$this->assertTrue(count($this->assets->getCss()) > 0);
|
||||
$this->assertTrue(is_array($this->assets->getJs()));
|
||||
$this->assertTrue(count($this->assets->getJs()) == 0);
|
||||
|
||||
$assets->reset();
|
||||
$assets->addDirJs('/system');
|
||||
$this->assets->reset();
|
||||
$this->assets->addDirJs('/system');
|
||||
|
||||
$this->assertTrue(is_array($assets->getCss()));
|
||||
$this->assertTrue(count($assets->getCss()) == 0);
|
||||
$this->assertTrue(is_array($assets->getJs()));
|
||||
$this->assertTrue(count($assets->getJs()) > 0);
|
||||
$this->assertTrue(is_array($this->assets->getCss()));
|
||||
$this->assertTrue(count($this->assets->getCss()) == 0);
|
||||
$this->assertTrue(is_array($this->assets->getJs()));
|
||||
$this->assertTrue(count($this->assets->getJs()) > 0);
|
||||
|
||||
$assets->reset();
|
||||
$assets->addDirJs('/system/assets');
|
||||
$this->assets->reset();
|
||||
$this->assets->addDirJs('/system/assets');
|
||||
|
||||
$this->assertTrue(is_array($assets->getCss()));
|
||||
$this->assertTrue(count($assets->getCss()) == 0);
|
||||
$this->assertTrue(is_array($assets->getJs()));
|
||||
$this->assertTrue(count($assets->getJs()) > 0);
|
||||
$this->assertTrue(is_array($this->assets->getCss()));
|
||||
$this->assertTrue(count($this->assets->getCss()) == 0);
|
||||
$this->assertTrue(is_array($this->assets->getJs()));
|
||||
$this->assertTrue(count($this->assets->getJs()) > 0);
|
||||
|
||||
$assets->reset();
|
||||
$assets->addDir('/system/assets');
|
||||
$this->assets->reset();
|
||||
$this->assets->addDir('/system/assets');
|
||||
|
||||
$this->assertTrue(is_array($assets->getCss()));
|
||||
$this->assertTrue(count($assets->getCss()) > 0);
|
||||
$this->assertTrue(is_array($assets->getJs()));
|
||||
$this->assertTrue(count($assets->getJs()) > 0);
|
||||
$this->assertTrue(is_array($this->assets->getCss()));
|
||||
$this->assertTrue(count($this->assets->getCss()) > 0);
|
||||
$this->assertTrue(is_array($this->assets->getJs()));
|
||||
$this->assertTrue(count($this->assets->getJs()) > 0);
|
||||
|
||||
//Use streams
|
||||
$assets->reset();
|
||||
$assets->addDir('system://assets');
|
||||
$this->assets->reset();
|
||||
$this->assets->addDir('system://assets');
|
||||
|
||||
$this->assertTrue(is_array($assets->getCss()));
|
||||
$this->assertTrue(count($assets->getCss()) > 0);
|
||||
$this->assertTrue(is_array($assets->getJs()));
|
||||
$this->assertTrue(count($assets->getJs()) > 0);
|
||||
$this->assertTrue(is_array($this->assets->getCss()));
|
||||
$this->assertTrue(count($this->assets->getCss()) > 0);
|
||||
$this->assertTrue(is_array($this->assets->getJs()));
|
||||
$this->assertTrue(count($this->assets->getJs()) > 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Codeception\Util\Fixtures;
|
||||
use Grav\Common\Grav;
|
||||
|
||||
/**
|
||||
* Class BrowserTest
|
||||
*/
|
||||
class BrowserTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
/**
|
||||
* @var \UnitTester
|
||||
*/
|
||||
protected $tester;
|
||||
/** @var Grav $grav */
|
||||
protected $grav;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
$this->grav = Fixtures::get('grav');
|
||||
}
|
||||
|
||||
protected function _after()
|
||||
{
|
||||
}
|
||||
|
||||
public function grav()
|
||||
{
|
||||
return Fixtures::get('grav');
|
||||
public function testGetBrowser()
|
||||
{ /* Already covered by PhpUserAgent tests */
|
||||
}
|
||||
|
||||
public function testGetBrowser() { /* Already covered by PhpUserAgent tests */ }
|
||||
public function testGetPlatform() { /* Already covered by PhpUserAgent tests */ }
|
||||
public function testGetLongVersion() { /* Already covered by PhpUserAgent tests */ }
|
||||
public function testGetVersion() { /* Already covered by PhpUserAgent tests */ }
|
||||
public function testGetPlatform()
|
||||
{ /* Already covered by PhpUserAgent tests */
|
||||
}
|
||||
|
||||
public function testGetLongVersion()
|
||||
{ /* Already covered by PhpUserAgent tests */
|
||||
}
|
||||
|
||||
public function testGetVersion()
|
||||
{ /* Already covered by PhpUserAgent tests */
|
||||
}
|
||||
|
||||
public function testIsHuman()
|
||||
{
|
||||
//Already Partially covered by PhpUserAgent tests
|
||||
|
||||
//Make sure it recognizes the test as not human
|
||||
$this->assertFalse($this->grav()['browser']->isHuman());
|
||||
$this->assertFalse($this->grav['browser']->isHuman());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,6 @@ use Grav\Common\Composer;
|
||||
|
||||
class ComposerTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
/**
|
||||
* @var \UnitTester
|
||||
*/
|
||||
protected $tester;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,74 +1,271 @@
|
||||
<?php
|
||||
|
||||
use Codeception\Util\Fixtures;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Uri;
|
||||
use Grav\Common\Config\Config;
|
||||
use Grav\Common\Page\Pages;
|
||||
use Grav\Common\Page\Page;
|
||||
use Grav\Common\Markdown\Parsedown;
|
||||
|
||||
|
||||
/**
|
||||
* Class AssetsTest
|
||||
*/
|
||||
class MarkdownTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
/**
|
||||
* @var \UnitTester
|
||||
*/
|
||||
protected $tester;
|
||||
/** @var Parsedown $parsedown */
|
||||
protected $parsedown;
|
||||
|
||||
/** @var Grav $grav */
|
||||
protected $grav;
|
||||
|
||||
/** @var Pages $pages */
|
||||
protected $pages;
|
||||
|
||||
/** @var Config $config */
|
||||
protected $config;
|
||||
|
||||
/** @var Uri $uri */
|
||||
protected $uri;
|
||||
|
||||
static $run = false;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
$this->grav = Fixtures::get('grav');
|
||||
|
||||
$this->pages = $this->grav['pages'];
|
||||
|
||||
$this->config = $this->grav['config'];
|
||||
|
||||
$this->uri = $this->grav['uri'];
|
||||
|
||||
if (!self::$run) {
|
||||
|
||||
/** @var UniformResourceLocator $locator */
|
||||
$locator = $this->grav['locator'];
|
||||
$locator->addPath('page', '', 'tests/fake/nested-site/user/pages', false);
|
||||
$this->pages->init();
|
||||
|
||||
self::$run = true;
|
||||
}
|
||||
|
||||
$defaults = [
|
||||
'extra' => false,
|
||||
'extra' => false,
|
||||
'auto_line_breaks' => false,
|
||||
'auto_url_links' => false,
|
||||
'escape_markup' => false,
|
||||
'special_chars' => ['>' => 'gt', '<' => 'lt'],
|
||||
'auto_url_links' => false,
|
||||
'escape_markup' => false,
|
||||
'special_chars' => ['>' => 'gt', '<' => 'lt'],
|
||||
];
|
||||
$page = new \Grav\Common\Page\Page();
|
||||
$page = $this->pages->dispatch('/item2/item2-2');
|
||||
|
||||
$this->parsedown = new Parsedown($page, $defaults);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function _after()
|
||||
{
|
||||
}
|
||||
|
||||
public function grav()
|
||||
{
|
||||
$grav = Fixtures::get('grav');
|
||||
return $grav;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $string
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function stripLeadingWhitespace($string)
|
||||
{
|
||||
return preg_replace('/^\s*(.*)/', '', $string);
|
||||
}
|
||||
|
||||
|
||||
public function testMarkdownSpecialProtocols()
|
||||
public function testAnchorLinksNoPortRelativeUrls()
|
||||
{
|
||||
$this->assertSame($this->parsedown->text('[mailto](mailto:user@domain.com)'), '<p><a href="mailto:user@domain.com">mailto</a></p>');
|
||||
$this->assertSame($this->parsedown->text('[xmpp](xmpp:xyx@domain.com)'), '<p><a href="xmpp:xyx@domain.com">xmpp</a></p>');
|
||||
$this->assertSame($this->parsedown->text('[tel](tel:123-555-12345)'), '<p><a href="tel:123-555-12345">tel</a></p>');
|
||||
$this->assertSame($this->parsedown->text('[sms](sms:123-555-12345)'), '<p><a href="sms:123-555-12345">sms</a></p>');
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item-2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
$this->assertSame('<p><a href="/item2/item2-1/#foo">Peer Anchor 2</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
// $this->assertSame('<p><a href="#foo">Current Anchor</a></p>',
|
||||
// $this->parsedown->text('[Current Anchor](#foo)'));
|
||||
$this->assertSame('<p><a href="/#foo">Root Anchor</a></p>',
|
||||
$this->parsedown->text('[Root Anchor](/#foo)'));
|
||||
|
||||
}
|
||||
|
||||
public function testMarkdownReferenceLinks()
|
||||
public function testAnchorLinksNoPortAbsoluteUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item-2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://localhost/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item2/item2-1/#foo">Peer Anchor 2</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
// $this->assertSame('<p><a href="#foo">Current Anchor</a></p>',
|
||||
// $this->parsedown->text('[Current Anchor](#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/#foo">Root Anchor</a></p>',
|
||||
$this->parsedown->text('[Root Anchor](/#foo)'));
|
||||
}
|
||||
|
||||
public function testAnchorLinksWithPortAbsoluteUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithURL('http://localhost:8080/item2/item-2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://localhost:8080/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost:8080/item2/item2-1/#foo">Peer Anchor 2</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
// $this->assertSame('<p><a href="http://localhost:8080#foo">Current Anchor</a></p>',
|
||||
// $this->parsedown->text('[Current Anchor](#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost:8080/#foo">Root Anchor</a></p>',
|
||||
$this->parsedown->text('[Root Anchor](/#foo)'));
|
||||
|
||||
}
|
||||
|
||||
public function testAnchorLinksSubDirRelativeUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithUrlAndRootPath('http://localhost/subdir/item2/item-2-2', '/subdir')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/subdir/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
$this->assertSame('<p><a href="/subdir/item2/item2-1/#foo">Peer Anchor 2</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
// $this->assertSame('<p><a href="/subdir/#foo">Current Anchor</a></p>',
|
||||
// $this->parsedown->text('[Current Anchor](#foo)'));
|
||||
$this->assertSame('<p><a href="/subdir/#foo">Root Anchor</a></p>',
|
||||
$this->parsedown->text('[Root Anchor](/#foo)'));
|
||||
|
||||
}
|
||||
|
||||
public function testAnchorLinksSubDirAbsoluteUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithUrlAndRootPath('http://localhost/subdir/item2/item-2-2', '/subdir')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-1/#foo">Peer Anchor 2</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
// $this->assertSame('<p><a href="http://localhost/subdir#foo">Current Anchor</a></p>',
|
||||
// $this->parsedown->text('[Current Anchor](#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/#foo">Root Anchor</a></p>',
|
||||
$this->parsedown->text('[Root Anchor](/#foo)'));
|
||||
|
||||
}
|
||||
|
||||
public function testSlugRelativeLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item-2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/item2/item2-1">Peer Page</a></p>',
|
||||
$this->parsedown->text('[Peer Page](../item2-1)'));
|
||||
$this->assertSame('<p><a href="/item2/item2-2/item2-2-1">Down a Level</a></p>',
|
||||
$this->parsedown->text('[Down a Level](item2-2-1)'));
|
||||
$this->assertSame('<p><a href="/item2">Up a Level</a></p>',
|
||||
$this->parsedown->text('[Up a Level](..)'));
|
||||
$this->assertSame('<p><a href="/item3/item3-3">Up and Down</a></p>',
|
||||
$this->parsedown->text('[Up and Down](../../item3/item3-3)'));
|
||||
$this->assertSame('<p><a href="/item2/item2-2/item2-2-1?foo=bar">Down a Level with Query</a></p>',
|
||||
$this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)'));
|
||||
// $this->assertSame('<p><a href="/item2?foo=bar">Up a Level with Query</a></p>',
|
||||
// $this->parsedown->text('[Up a Level with Query](../?foo=bar)'));
|
||||
$this->assertSame('<p><a href="/item3/item3-3?foo=bar">Up and Down with Query</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)'));
|
||||
$this->assertSame('<p><a href="/item3/item3-3/foo:bar">Up and Down with Param</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)'));
|
||||
$this->assertSame('<p><a href="/item3/item3-3#foo">Up and Down with Anchor</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)'));
|
||||
}
|
||||
|
||||
public function testDirectoryRelativeLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item-2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/item2/item2-1">Peer Page</a></p>',
|
||||
$this->parsedown->text('[Peer Page](../01.item2-1)'));
|
||||
$this->assertSame('<p><a href="/item2/item2-2/item2-2-1">Down a Level</a></p>',
|
||||
$this->parsedown->text('[Down a Level](01.item2-2-1)'));
|
||||
$this->assertSame('<p><a href="/item3/item3-3">Up and Down</a></p>',
|
||||
$this->parsedown->text('[Up and Down](../../03.item3/03.item3-3)'));
|
||||
$this->assertSame('<p><a href="/item2/item2-2/item2-2-1?foo=bar">Down a Level with Query</a></p>',
|
||||
$this->parsedown->text('[Down a Level with Query](01.item2-2-1?foo=bar)'));
|
||||
$this->assertSame('<p><a href="/item3/item3-3?foo=bar">Up and Down with Query</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Query](../../03.item3/03.item3-3?foo=bar)'));
|
||||
// $this->assertSame('<p><a href="/item3/item3-3/foo:bar">Up and Down with Param</a></p>',
|
||||
// $this->parsedown->text('[Up and Down with Param](../../03.item3/03.item3-3/foo:bar)'));
|
||||
$this->assertSame('<p><a href="/item3/item3-3#foo">Up and Down with Anchor</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Anchor](../../03.item3/03.item3-3#foo)'));
|
||||
}
|
||||
|
||||
public function testDirectoryAbsoluteLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item-2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/item2/item2-1">Peer Page</a></p>',
|
||||
$this->parsedown->text('[Peer Page](/item2/item2-1)'));
|
||||
$this->assertSame('<p><a href="/item2/item2-2/item2-2-1">Down a Level</a></p>',
|
||||
$this->parsedown->text('[Down a Level](/item2/item2-2/item2-2-1)'));
|
||||
$this->assertSame('<p><a href="/item2">Up a Level</a></p>',
|
||||
$this->parsedown->text('[Up a Level](/item2)'));
|
||||
$this->assertSame('<p><a href="/item2?foo=bar">With Query</a></p>',
|
||||
$this->parsedown->text('[With Query](/item2?foo=bar)'));
|
||||
$this->assertSame('<p><a href="/item2/foo:bar">With Param</a></p>',
|
||||
$this->parsedown->text('[With Param](/item2/foo:bar)'));
|
||||
$this->assertSame('<p><a href="/item2#foo">With Anchor</a></p>',
|
||||
$this->parsedown->text('[With Anchor](/item2#foo)'));
|
||||
}
|
||||
|
||||
public function testSpecialProtocols()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item-2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="mailto:user@domain.com">mailto</a></p>',
|
||||
$this->parsedown->text('[mailto](mailto:user@domain.com)'));
|
||||
$this->assertSame('<p><a href="xmpp:xyx@domain.com">xmpp</a></p>',
|
||||
$this->parsedown->text('[xmpp](xmpp:xyx@domain.com)'));
|
||||
$this->assertSame('<p><a href="tel:123-555-12345">tel</a></p>',
|
||||
$this->parsedown->text('[tel](tel:123-555-12345)'));
|
||||
$this->assertSame('<p><a href="sms:123-555-12345">sms</a></p>',
|
||||
$this->parsedown->text('[sms](sms:123-555-12345)'));
|
||||
}
|
||||
|
||||
public function testReferenceLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item-2-2')->init();
|
||||
|
||||
$sample = '[relative link][r_relative]
|
||||
[r_relative]: ../03.assets#blah';
|
||||
$this->assertSame($this->parsedown->text($sample), '<p><a href="../03.assets#blah">relative link</a></p>');
|
||||
[r_relative]: ../item2-3#blah';
|
||||
$this->assertSame('<p><a href="/item2/item2-3#blah">relative link</a></p>',
|
||||
$this->parsedown->text($sample));
|
||||
|
||||
$sample = '[absolute link][r_absolute]
|
||||
[r_absolute]: /blog/focus-and-blur#blah';
|
||||
$this->assertSame($this->parsedown->text($sample), '<p><a href="/blog/focus-and-blur#blah">absolute link</a></p>');
|
||||
[r_absolute]: /item3#blah';
|
||||
$this->assertSame('<p><a href="/item3#blah">absolute link</a></p>',
|
||||
$this->parsedown->text($sample));
|
||||
|
||||
$sample = '[external link][r_external]
|
||||
[r_external]: http://www.cnn.com';
|
||||
$this->assertSame($this->parsedown->text($sample), '<p><a href="http://www.cnn.com">external link</a></p>');
|
||||
$this->assertSame('<p><a href="http://www.cnn.com">external link</a></p>',
|
||||
$this->parsedown->text($sample));
|
||||
}
|
||||
|
||||
public function testMarkdownExternalLinks()
|
||||
public function testExternalLinks()
|
||||
{
|
||||
$this->assertSame($this->parsedown->text('[cnn.com](http://www.cnn.com)'), '<p><a href="http://www.cnn.com">cnn.com</a></p>');
|
||||
$this->assertSame($this->parsedown->text('[google.com](https://www.google.com)'), '<p><a href="https://www.google.com">google.com</a></p>');
|
||||
$this->assertSame('<p><a href="http://www.cnn.com">cnn.com</a></p>',
|
||||
$this->parsedown->text('[cnn.com](http://www.cnn.com)'));
|
||||
$this->assertSame('<p><a href="https://www.google.com">google.com</a></p>',
|
||||
$this->parsedown->text('[google.com](https://www.google.com)'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
55
tests/unit/Grav/Common/Page/PagesTest.php
Normal file
55
tests/unit/Grav/Common/Page/PagesTest.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Codeception\Util\Fixtures;
|
||||
use Codeception\Util\Stub;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Page\Pages;
|
||||
use Grav\Common\Page\Page;
|
||||
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
|
||||
|
||||
/**
|
||||
* Class PagesTest
|
||||
*/
|
||||
class PagesTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
/** @var Grav $grav */
|
||||
protected $grav;
|
||||
|
||||
/** @var Pages $pages */
|
||||
protected $pages;
|
||||
|
||||
/** @var Page $root_page */
|
||||
protected $root_page;
|
||||
|
||||
static $run = false;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
$this->grav = Fixtures::get('grav');
|
||||
$this->pages = $this->grav['pages'];
|
||||
|
||||
if (!self::$run) {
|
||||
/** @var UniformResourceLocator $locator */
|
||||
$locator = $this->grav['locator'];
|
||||
$locator->addPath('page', '', 'tests/fake/simple-site/user/pages', false);
|
||||
$this->pages->init();
|
||||
self::$run = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testAll()
|
||||
{
|
||||
$this->assertTrue(is_object($this->pages->all()));
|
||||
$this->assertTrue(is_array($this->pages->all()->toArray()));
|
||||
$this->assertInstanceOf('Grav\Common\Page\Page', $this->pages->all()->first());
|
||||
}
|
||||
|
||||
public function testGetList()
|
||||
{
|
||||
$list = $this->pages->getList();
|
||||
$this->assertTrue(is_array($list));
|
||||
$this->assertSame('Home', $list['/']);
|
||||
$this->assertSame('Blog', $list['/blog']);
|
||||
}
|
||||
}
|
||||
@@ -1,439 +1,401 @@
|
||||
<?php
|
||||
|
||||
use Codeception\Util\Fixtures;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Uri;
|
||||
use Grav\Common\Utils;
|
||||
|
||||
/**
|
||||
* Class UriTest
|
||||
*/
|
||||
class UriTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
/**
|
||||
* @var \UnitTester
|
||||
*/
|
||||
protected $tester;
|
||||
/** @var Grav $grav */
|
||||
protected $grav;
|
||||
|
||||
/** @var Uri $uri */
|
||||
protected $uri;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
$this->grav = Fixtures::get('grav');
|
||||
$this->uri = $this->grav['uri'];
|
||||
}
|
||||
|
||||
protected function _after()
|
||||
{
|
||||
}
|
||||
|
||||
public function grav()
|
||||
{
|
||||
return Fixtures::get('grav');
|
||||
}
|
||||
|
||||
public function getURI()
|
||||
{
|
||||
return $this->grav()['uri'];
|
||||
}
|
||||
|
||||
public function testValidatingHostname()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
$this->assertTrue($this->uri->validateHostname('localhost') == 1);
|
||||
$this->assertTrue($this->uri->validateHostname('google.com') == 1);
|
||||
$this->assertTrue($this->uri->validateHostname('google.it') == 1);
|
||||
$this->assertTrue($this->uri->validateHostname('goog.le') == 1);
|
||||
$this->assertTrue($this->uri->validateHostname('goog.wine') == 1);
|
||||
$this->assertTrue($this->uri->validateHostname('goog.localhost') == 1);
|
||||
|
||||
$this->assertTrue($uri->validateHostname('localhost') == 1);
|
||||
$this->assertTrue($uri->validateHostname('google.com') == 1);
|
||||
$this->assertTrue($uri->validateHostname('google.it') == 1);
|
||||
$this->assertTrue($uri->validateHostname('goog.le') == 1);
|
||||
$this->assertTrue($uri->validateHostname('goog.wine') == 1);
|
||||
$this->assertTrue($uri->validateHostname('goog.localhost') == 1);
|
||||
|
||||
$this->assertFalse($uri->validateHostname('localhost:80') == 1);
|
||||
$this->assertFalse($uri->validateHostname('http://localhost') == 1);
|
||||
$this->assertFalse($uri->validateHostname('localhost!') == 1);
|
||||
$this->assertFalse($this->uri->validateHostname('localhost:80') == 1);
|
||||
$this->assertFalse($this->uri->validateHostname('http://localhost') == 1);
|
||||
$this->assertFalse($this->uri->validateHostname('localhost!') == 1);
|
||||
}
|
||||
|
||||
public function testInitializingUris()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertTrue($this->uri->params() == null);
|
||||
$this->assertTrue($this->uri->query() == '');
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertTrue($uri->params() == null);
|
||||
$this->assertTrue($uri->query() == '');
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertFalse($this->uri->params() == null);
|
||||
$this->assertTrue($this->uri->query() == '');
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertFalse($uri->params() == null);
|
||||
$this->assertTrue($uri->query() == '');
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertTrue($this->uri->params() == null);
|
||||
$this->assertTrue($this->uri->query() != '');
|
||||
$this->assertTrue($this->uri->query() == 'test=x');
|
||||
$this->assertTrue($this->uri->port() == '8080');
|
||||
|
||||
$this->assertTrue($uri->params() == null);
|
||||
$this->assertTrue($uri->query() != '');
|
||||
$this->assertTrue($uri->query() == 'test=x');
|
||||
$this->assertTrue($uri->port() == '8080');
|
||||
$this->uri->initializeWithURL('http://localhost:80/grav/it/ueper?test=x')->init();
|
||||
$this->assertTrue($this->uri->port() == '80');
|
||||
|
||||
$uri->initializeWithURL('http://localhost:80/grav/it/ueper?test=x')->init();
|
||||
$this->assertTrue($uri->port() == '80');
|
||||
$this->uri->initializeWithURL('http://localhost/grav/it/ueper?test=x')->init();
|
||||
$this->assertTrue($this->uri->port() == '80');
|
||||
|
||||
$uri->initializeWithURL('http://localhost/grav/it/ueper?test=x')->init();
|
||||
$this->assertTrue($uri->port() == '80');
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertTrue($this->uri->params() == null);
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertTrue($uri->params() == null);
|
||||
|
||||
$uri->initializeWithURL('http://grav/grav/it/ueper')->init();
|
||||
$this->assertTrue($uri->params() == null);
|
||||
$this->uri->initializeWithURL('http://grav/grav/it/ueper')->init();
|
||||
$this->assertTrue($this->uri->params() == null);
|
||||
}
|
||||
|
||||
public function testPaths()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame($uri->paths(), ['grav', 'it', 'ueper']);
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame($uri->paths(), ['grav', 'it']);
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame($uri->paths(), ['grav', 'it', 'ueper']);
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame($uri->paths(), ['a', 'b', 'c', 'd']);
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame($uri->paths(), ['a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'c', 'd', 'e', 'f']);
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame(['grav', 'it', 'ueper'], $this->uri->paths());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame(['grav', 'it'], $this->uri->paths());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame(['grav', 'it', 'ueper'], $this->uri->paths());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame(['a', 'b', 'c', 'd'], $this->uri->paths());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame(['a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'c', 'd', 'e', 'f'],
|
||||
$this->uri->paths());
|
||||
}
|
||||
|
||||
public function testRoute()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame($uri->route(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame($uri->route(), '/grav/it');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame($uri->route(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame($uri->route(), '/a/b/c/d');
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame($uri->route(), '/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f');
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->route());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame('/grav/it', $this->uri->route());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->route());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame('/a/b/c/d', $this->uri->route());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame('/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f', $this->uri->route());
|
||||
}
|
||||
|
||||
public function testQuery()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame($uri->query(), '');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame($uri->query(), '');
|
||||
$this->assertSame($uri->query('id'), null);
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame($uri->query(), 'test=x');
|
||||
$this->assertSame($uri->query('id'), null);
|
||||
$this->assertSame($uri->query('test'), 'x');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame($uri->query(), 'test=x&test2=y');
|
||||
$this->assertSame($uri->query('id'), null);
|
||||
$this->assertSame($uri->query('test'), 'x');
|
||||
$this->assertSame($uri->query('test2'), 'y');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame($uri->query(), 'test=x&test2=y&test3=x&test4=y');
|
||||
$this->assertSame($uri->query('id'), null);
|
||||
$this->assertSame($uri->query('test'), 'x');
|
||||
$this->assertSame($uri->query('test2'), 'y');
|
||||
$this->assertSame($uri->query('test4'), 'y');
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame('', $this->uri->query());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame('', $this->uri->query());
|
||||
$this->assertSame(null, $this->uri->query('id'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame('test=x', $this->uri->query());
|
||||
$this->assertSame(null, $this->uri->query('id'));
|
||||
$this->assertSame('x', $this->uri->query('test'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame('test=x&test2=y', $this->uri->query());
|
||||
$this->assertSame(null, $this->uri->query('id'));
|
||||
$this->assertSame('x', $this->uri->query('test'));
|
||||
$this->assertSame('y', $this->uri->query('test2'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame('test=x&test2=y&test3=x&test4=y', $this->uri->query());
|
||||
$this->assertSame(null, $this->uri->query('id'));
|
||||
$this->assertSame('x', $this->uri->query('test'));
|
||||
$this->assertSame('y', $this->uri->query('test2'));
|
||||
$this->assertSame('y', $this->uri->query('test4'));
|
||||
//Test all after the ? is encoded in the query
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame($uri->query(), 'test=x&test2=y&test3=x&test4=y%2Ftest');
|
||||
$this->assertSame($uri->query('id'), null);
|
||||
$this->assertSame($uri->query('test'), 'x');
|
||||
$this->assertSame($uri->query('test2'), 'y');
|
||||
$this->assertSame($uri->query('test4'), 'y/test');
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame($uri->query(), '');
|
||||
$this->assertSame($uri->query('id'), null);
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame($uri->query(), '');
|
||||
$this->assertSame($uri->query('id'), null);
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame('test=x&test2=y&test3=x&test4=y%2Ftest', $this->uri->query());
|
||||
$this->assertSame(null, $this->uri->query('id'));
|
||||
$this->assertSame('x', $this->uri->query('test'));
|
||||
$this->assertSame('y', $this->uri->query('test2'));
|
||||
$this->assertSame('y/test', $this->uri->query('test4'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame('', $this->uri->query());
|
||||
$this->assertSame(null, $this->uri->query('id'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame('', $this->uri->query());
|
||||
$this->assertSame(null, $this->uri->query('id'));
|
||||
}
|
||||
|
||||
public function testParams()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame($uri->params(), null);
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame($uri->params(), '/ueper:xxx');
|
||||
$this->assertSame($uri->params('ueper'), '/ueper:xxx');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame($uri->params(), '/ueper:xxx/test:yyy');
|
||||
$this->assertSame($uri->params('ueper'), '/ueper:xxx');
|
||||
$this->assertSame($uri->params('test'), '/test:yyy');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame($uri->params(), null);
|
||||
$this->assertSame($uri->params('ueper'), null);
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame($uri->params(), null);
|
||||
$this->assertSame($uri->params('ueper'), null);
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame($uri->params(), null);
|
||||
$this->assertSame($uri->params('ueper'), null);
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame($uri->params(), null);
|
||||
$this->assertSame($uri->params('ueper'), null);
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame($uri->params(), null);
|
||||
$this->assertSame($uri->params('ueper'), null);
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame($uri->params(), null);
|
||||
$this->assertSame($uri->params('ueper'), null);
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame(null, $this->uri->params());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame('/ueper:xxx', $this->uri->params());
|
||||
$this->assertSame('/ueper:xxx', $this->uri->params('ueper'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame('/ueper:xxx/test:yyy', $this->uri->params());
|
||||
$this->assertSame('/ueper:xxx', $this->uri->params('ueper'));
|
||||
$this->assertSame('/test:yyy', $this->uri->params('test'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame(null, $this->uri->params());
|
||||
$this->assertSame(null, $this->uri->params('ueper'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame(null, $this->uri->params());
|
||||
$this->assertSame(null, $this->uri->params('ueper'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame(null, $this->uri->params());
|
||||
$this->assertSame(null, $this->uri->params('ueper'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame(null, $this->uri->params());
|
||||
$this->assertSame(null, $this->uri->params('ueper'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame(null, $this->uri->params());
|
||||
$this->assertSame(null, $this->uri->params('ueper'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame(null, $this->uri->params());
|
||||
$this->assertSame(null, $this->uri->params('ueper'));
|
||||
}
|
||||
|
||||
public function testParam()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame($uri->param('ueper'), 'xxx');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame($uri->param('ueper'), 'xxx');
|
||||
$this->assertSame($uri->param('test'), 'yyy');
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame('xxx', $this->uri->param('ueper'));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame('xxx', $this->uri->param('ueper'));
|
||||
$this->assertSame('yyy', $this->uri->param('test'));
|
||||
}
|
||||
|
||||
public function testUrl()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame($uri->url(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame($uri->url(), '/grav/it');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame($uri->url(), '/grav/it');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame($uri->url(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame($uri->url(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame($uri->url(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame($uri->url(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame($uri->url(), '/a/b/c/d');
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame($uri->url(), '/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f');
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->url());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame('/grav/it', $this->uri->url());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame('/grav/it', $this->uri->url());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->url());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->url());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->url());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->url());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame('/a/b/c/d', $this->uri->url());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame('/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f', $this->uri->url());
|
||||
}
|
||||
|
||||
public function testPath()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame($uri->path(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame($uri->path(), '/grav/it');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame($uri->path(), '/grav/it');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame($uri->path(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame($uri->path(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame($uri->path(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame($uri->path(), '/grav/it/ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame($uri->path(), '/a/b/c/d');
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame($uri->path(), '/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f');
|
||||
$uri->initializeWithURL('http://localhost/')->init();
|
||||
$this->assertSame($uri->path(), '/');
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->path());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame('/grav/it', $this->uri->path());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame('/grav/it', $this->uri->path());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->path());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->path());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->path());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame('/grav/it/ueper', $this->uri->path());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame('/a/b/c/d', $this->uri->path());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame('/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f', $this->uri->path());
|
||||
$this->uri->initializeWithURL('http://localhost/')->init();
|
||||
$this->assertSame('/', $this->uri->path());
|
||||
}
|
||||
|
||||
public function testExtension()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
$uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($uri->extension(), null);
|
||||
$uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($uri->extension('x'), 'x');
|
||||
$uri->initializeWithURL('http://localhost/a-page.html')->init();
|
||||
$this->assertSame($uri->extension(), 'html');
|
||||
$uri->initializeWithURL('http://localhost/a-page.xml')->init();
|
||||
$this->assertSame($uri->extension(), 'xml');
|
||||
$uri->initializeWithURL('http://localhost/a-page.foo')->init();
|
||||
$this->assertSame($uri->extension(), 'foo');
|
||||
$this->uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame(null, $this->uri->extension());
|
||||
$this->uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame('x', $this->uri->extension('x'));
|
||||
$this->uri->initializeWithURL('http://localhost/a-page.html')->init();
|
||||
$this->assertSame('html', $this->uri->extension());
|
||||
$this->uri->initializeWithURL('http://localhost/a-page.xml')->init();
|
||||
$this->assertSame('xml', $this->uri->extension());
|
||||
$this->uri->initializeWithURL('http://localhost/a-page.foo')->init();
|
||||
$this->assertSame('foo', $this->uri->extension());
|
||||
}
|
||||
|
||||
public function testHost()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$address = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '::1';
|
||||
if ($uri->host() == 'localhost' || $address == '::1' || $address == '127.0.0.1') {
|
||||
if ($this->uri->host() == 'localhost' || $address == '::1' || $address == '127.0.0.1') {
|
||||
$address = 'localhost';
|
||||
}
|
||||
|
||||
$uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($uri->host(), $address);
|
||||
$uri->initializeWithURL('http://localhost/')->init();
|
||||
$this->assertSame($uri->host(), $address);
|
||||
$this->uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($address, $this->uri->host());
|
||||
$this->uri->initializeWithURL('http://localhost/')->init();
|
||||
$this->assertSame($address, $this->uri->host());
|
||||
//Host is set to localhost when running from local
|
||||
$uri->initializeWithURL('http://google.com/')->init();
|
||||
$this->assertSame($uri->host(), $address);
|
||||
$this->uri->initializeWithURL('http://google.com/')->init();
|
||||
$this->assertSame($address, $this->uri->host());
|
||||
}
|
||||
|
||||
public function testPort()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
$uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($uri->port(), '80');
|
||||
$uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame($uri->port(), 8080);
|
||||
$uri->initializeWithURL('http://localhost:443/a-page')->init();
|
||||
$this->assertSame($uri->port(), 443);
|
||||
$uri->initializeWithURL('https://localhost/a-page')->init();
|
||||
$this->assertSame($uri->port(), '80');
|
||||
$this->uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame('80', $this->uri->port());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame(8080, $this->uri->port());
|
||||
$this->uri->initializeWithURL('http://localhost:443/a-page')->init();
|
||||
$this->assertSame(443, $this->uri->port());
|
||||
$this->uri->initializeWithURL('https://localhost/a-page')->init();
|
||||
$this->assertSame('80', $this->uri->port());
|
||||
}
|
||||
|
||||
public function testEnvironment()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$address = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '::1';
|
||||
if ($uri->host() == 'localhost' || $address == '::1' || $address == '127.0.0.1') {
|
||||
if ($this->uri->host() == 'localhost' || $address == '::1' || $address == '127.0.0.1') {
|
||||
$address = 'localhost';
|
||||
}
|
||||
|
||||
$uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($uri->environment(), $address);
|
||||
$uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame($uri->environment(), $address);
|
||||
$uri->initializeWithURL('http://foobar.it:443/a-page')->init();
|
||||
$this->assertSame($uri->environment(), $address);
|
||||
$uri->initializeWithURL('https://google.com/a-page')->init();
|
||||
$this->assertSame($uri->environment(), $address);
|
||||
$this->uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($address, $this->uri->environment());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame($address, $this->uri->environment());
|
||||
$this->uri->initializeWithURL('http://foobar.it:443/a-page')->init();
|
||||
$this->assertSame($address, $this->uri->environment());
|
||||
$this->uri->initializeWithURL('https://google.com/a-page')->init();
|
||||
$this->assertSame($address, $this->uri->environment());
|
||||
}
|
||||
|
||||
public function testBasename()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame($uri->basename(), 'ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame($uri->basename(), 'it');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame($uri->basename(), 'it');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame($uri->basename(), 'ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame($uri->basename(), 'ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame($uri->basename(), 'ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame($uri->basename(), 'ueper');
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame($uri->basename(), 'd');
|
||||
$uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame($uri->basename(), 'f');
|
||||
$uri->initializeWithURL('http://localhost/')->init();
|
||||
$this->assertSame($uri->basename(), '');
|
||||
$uri->initializeWithURL('http://localhost/test.xml')->init();
|
||||
$this->assertSame($uri->basename(), 'test.xml');
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper')->init();
|
||||
$this->assertSame('ueper', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx')->init();
|
||||
$this->assertSame('it', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper:xxx/test:yyy')->init();
|
||||
$this->assertSame('it', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x')->init();
|
||||
$this->assertSame('ueper', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y')->init();
|
||||
$this->assertSame('ueper', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y')->init();
|
||||
$this->assertSame('ueper', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/grav/it/ueper?test=x&test2=y&test3=x&test4=y/test')->init();
|
||||
$this->assertSame('ueper', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d')->init();
|
||||
$this->assertSame('d', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a/b/c/d/e/f/a/b/c/d/e/f/a/b/c/d/e/f')->init();
|
||||
$this->assertSame('f', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost/')->init();
|
||||
$this->assertSame('', $this->uri->basename());
|
||||
$this->uri->initializeWithURL('http://localhost/test.xml')->init();
|
||||
$this->assertSame('test.xml', $this->uri->basename());
|
||||
}
|
||||
|
||||
public function testBase()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($uri->base(), 'http://localhost');
|
||||
$uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame($uri->base(), 'http://localhost:8080');
|
||||
$uri->initializeWithURL('http://foobar.it:80/a-page')->init();
|
||||
$this->assertSame($uri->base(), 'http://foobar.it');
|
||||
$uri->initializeWithURL('https://google.com/a-page')->init();
|
||||
$this->assertSame($uri->base(), 'http://google.com');
|
||||
$this->uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame('http://localhost', $this->uri->base());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame('http://localhost:8080', $this->uri->base());
|
||||
$this->uri->initializeWithURL('http://foobar.it:80/a-page')->init();
|
||||
$this->assertSame('http://foobar.it', $this->uri->base());
|
||||
$this->uri->initializeWithURL('https://google.com/a-page')->init();
|
||||
$this->assertSame('http://google.com', $this->uri->base());
|
||||
}
|
||||
|
||||
public function testRootUrl()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
//Without explicitly adding the root path via `initializeWithUrlAndRootPath`,
|
||||
//tests always default to the base empty root path
|
||||
$uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($uri->rootUrl(true), 'http://localhost');
|
||||
$uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame($uri->rootUrl(true), 'http://localhost:8080');
|
||||
$uri->initializeWithURL('http://foobar.it:80/a-page')->init();
|
||||
$this->assertSame($uri->rootUrl(true), 'http://foobar.it');
|
||||
$uri->initializeWithURL('https://google.com/a-page/xxx')->init();
|
||||
$this->assertSame($uri->rootUrl(true), 'http://google.com');
|
||||
$this->uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame('http://localhost', $this->uri->rootUrl(true));
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame('http://localhost:8080', $this->uri->rootUrl(true));
|
||||
$this->uri->initializeWithURL('http://foobar.it:80/a-page')->init();
|
||||
$this->assertSame('http://foobar.it', $this->uri->rootUrl(true));
|
||||
$this->uri->initializeWithURL('https://google.com/a-page/xxx')->init();
|
||||
$this->assertSame('http://google.com', $this->uri->rootUrl(true));
|
||||
|
||||
$uri->initializeWithUrlAndRootPath('https://localhost/grav/page-foo', '/grav')->init();
|
||||
$this->assertSame($uri->rootUrl(), '/grav');
|
||||
$this->assertSame($uri->rootUrl(true), 'http://localhost/grav');
|
||||
$this->uri->initializeWithUrlAndRootPath('https://localhost/grav/page-foo', '/grav')->init();
|
||||
$this->assertSame('/grav', $this->uri->rootUrl());
|
||||
$this->assertSame('http://localhost/grav', $this->uri->rootUrl(true));
|
||||
}
|
||||
|
||||
public function testCurrentPage()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost/foo/page:test')->init();
|
||||
$this->assertSame($uri->currentPage(), 'test');
|
||||
$uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame($uri->currentPage(), 1);
|
||||
$uri->initializeWithURL('http://localhost:8080/a-page/page:2')->init();
|
||||
$this->assertSame($uri->currentPage(), '2');
|
||||
$uri->initializeWithURL('http://localhost:8080/a-page/page:x')->init();
|
||||
$this->assertSame($uri->currentPage(), 'x');
|
||||
$uri->initializeWithURL('http://localhost:8080/a-page/page:')->init();
|
||||
$this->assertSame($uri->currentPage(), '');
|
||||
$this->uri->initializeWithURL('http://localhost/foo/page:test')->init();
|
||||
$this->assertSame('test', $this->uri->currentPage());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame(1, $this->uri->currentPage());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a-page/page:2')->init();
|
||||
$this->assertSame('2', $this->uri->currentPage());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a-page/page:x')->init();
|
||||
$this->assertSame('x', $this->uri->currentPage());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a-page/page:')->init();
|
||||
$this->assertSame('', $this->uri->currentPage());
|
||||
}
|
||||
|
||||
public function testReferrer()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost/foo/page:test')->init();
|
||||
$this->assertSame($uri->referrer(), '/foo');
|
||||
$uri->initializeWithURL('http://localhost/foo/bar/page:test')->init();
|
||||
$this->assertSame($uri->referrer(), '/foo/bar');
|
||||
$this->uri->initializeWithURL('http://localhost/foo/page:test')->init();
|
||||
$this->assertSame('/foo', $this->uri->referrer());
|
||||
$this->uri->initializeWithURL('http://localhost/foo/bar/page:test')->init();
|
||||
$this->assertSame('/foo/bar', $this->uri->referrer());
|
||||
}
|
||||
|
||||
public function testIp()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost/foo/page:test')->init();
|
||||
$this->assertSame($uri->ip(), 'UNKNOWN');
|
||||
$this->uri->initializeWithURL('http://localhost/foo/page:test')->init();
|
||||
$this->assertSame('UNKNOWN', $this->uri->ip());
|
||||
}
|
||||
|
||||
public function testIsExternal()
|
||||
{
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL('http://localhost/')->init();
|
||||
$this->assertFalse($uri->isExternal('/test'));
|
||||
$this->assertFalse($uri->isExternal('/foo/bar'));
|
||||
$this->assertTrue($uri->isExternal('http://localhost/test'));
|
||||
$this->assertTrue($uri->isExternal('http://google.it/test'));
|
||||
$this->uri->initializeWithURL('http://localhost/')->init();
|
||||
$this->assertFalse($this->uri->isExternal('/test'));
|
||||
$this->assertFalse($this->uri->isExternal('/foo/bar'));
|
||||
$this->assertTrue($this->uri->isExternal('http://localhost/test'));
|
||||
$this->assertTrue($this->uri->isExternal('http://google.it/test'));
|
||||
}
|
||||
|
||||
public function testBuildUrl()
|
||||
{
|
||||
$parsed_url = [
|
||||
'scheme' => 'http',
|
||||
'host' => 'localhost',
|
||||
'port' => '8080',
|
||||
'host' => 'localhost',
|
||||
'port' => '8080',
|
||||
];
|
||||
|
||||
$this->assertSame(Uri::buildUrl($parsed_url), 'http://localhost:8080');
|
||||
$this->assertSame('http://localhost:8080', Uri::buildUrl($parsed_url));
|
||||
|
||||
$parsed_url = [
|
||||
'scheme' => 'http',
|
||||
'host' => 'localhost',
|
||||
'port' => '8080',
|
||||
'user' => 'foo',
|
||||
'pass' => 'bar',
|
||||
'path' => '/test',
|
||||
'query' => 'x=2',
|
||||
'scheme' => 'http',
|
||||
'host' => 'localhost',
|
||||
'port' => '8080',
|
||||
'user' => 'foo',
|
||||
'pass' => 'bar',
|
||||
'path' => '/test',
|
||||
'query' => 'x=2',
|
||||
'fragment' => 'xxx',
|
||||
];
|
||||
|
||||
$this->assertSame(Uri::buildUrl($parsed_url), 'http://foo:bar@localhost:8080/test?x=2#xxx');
|
||||
$this->assertSame('http://foo:bar@localhost:8080/test?x=2#xxx', Uri::buildUrl($parsed_url));
|
||||
}
|
||||
|
||||
public function testConvertUrl()
|
||||
@@ -447,11 +409,9 @@ class UriTest extends \Codeception\TestCase\Test
|
||||
$this->assertStringStartsWith($url, Uri::addNonce($url, 'test-action'));
|
||||
$this->assertStringStartsWith($url . '/nonce:', Uri::addNonce($url, 'test-action'));
|
||||
|
||||
$uri = $this->getURI();
|
||||
|
||||
$uri->initializeWithURL(Uri::addNonce($url, 'test-action'))->init();
|
||||
$this->assertTrue(is_string($uri->param('nonce')));
|
||||
$this->assertSame($uri->param('nonce'), Utils::getNonce('test-action'));
|
||||
$this->uri->initializeWithURL(Uri::addNonce($url, 'test-action'))->init();
|
||||
$this->assertTrue(is_string($this->uri->param('nonce')));
|
||||
$this->assertSame(Utils::getNonce('test-action'), $this->uri->param('nonce'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Codeception\Util\Fixtures;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Utils;
|
||||
|
||||
/**
|
||||
* Class UtilsTest
|
||||
*/
|
||||
class UtilsTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
/**
|
||||
* @var \UnitTester
|
||||
*/
|
||||
protected $tester;
|
||||
/** @var Grav $grav */
|
||||
protected $grav;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
$this->grav = Fixtures::get('grav');
|
||||
}
|
||||
|
||||
protected function _after()
|
||||
{
|
||||
}
|
||||
|
||||
public function grav()
|
||||
{
|
||||
$grav = Fixtures::get('grav');
|
||||
return $grav;
|
||||
}
|
||||
|
||||
public function testStartsWith()
|
||||
{
|
||||
$this->assertTrue(Utils::startsWith('english', 'en'));
|
||||
$this->assertTrue(Utils::startsWith('English', 'En'));
|
||||
$this->assertTrue(Utils::startsWith('ENGLISH', 'EN'));
|
||||
$this->assertTrue(Utils::startsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'EN'));
|
||||
$this->assertTrue(Utils::startsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
|
||||
'EN'));
|
||||
|
||||
$this->assertFalse(Utils::startsWith('english', 'En'));
|
||||
$this->assertFalse(Utils::startsWith('English', 'EN'));
|
||||
$this->assertFalse(Utils::startsWith('ENGLISH', 'en'));
|
||||
$this->assertFalse(Utils::startsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'e'));
|
||||
$this->assertFalse(Utils::startsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
|
||||
'e'));
|
||||
}
|
||||
|
||||
public function testEndsWith()
|
||||
@@ -42,12 +41,14 @@ class UtilsTest extends \Codeception\TestCase\Test
|
||||
$this->assertTrue(Utils::endsWith('english', 'sh'));
|
||||
$this->assertTrue(Utils::endsWith('EngliSh', 'Sh'));
|
||||
$this->assertTrue(Utils::endsWith('ENGLISH', 'SH'));
|
||||
$this->assertTrue(Utils::endsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'ENGLISH'));
|
||||
$this->assertTrue(Utils::endsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
|
||||
'ENGLISH'));
|
||||
|
||||
$this->assertFalse(Utils::endsWith('english', 'de'));
|
||||
$this->assertFalse(Utils::endsWith('EngliSh', 'sh'));
|
||||
$this->assertFalse(Utils::endsWith('ENGLISH', 'Sh'));
|
||||
$this->assertFalse(Utils::endsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'DEUSTCH'));
|
||||
$this->assertFalse(Utils::endsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
|
||||
'DEUSTCH'));
|
||||
}
|
||||
|
||||
public function testContains()
|
||||
@@ -55,11 +56,14 @@ class UtilsTest extends \Codeception\TestCase\Test
|
||||
$this->assertTrue(Utils::contains('english', 'nglis'));
|
||||
$this->assertTrue(Utils::contains('EngliSh', 'gliSh'));
|
||||
$this->assertTrue(Utils::contains('ENGLISH', 'ENGLI'));
|
||||
$this->assertTrue(Utils::contains('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'ENGLISH'));
|
||||
$this->assertTrue(Utils::contains('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
|
||||
'ENGLISH'));
|
||||
|
||||
$this->assertFalse(Utils::contains('EngliSh', 'GLI')); $this->assertFalse(Utils::contains('EngliSh', 'English'));
|
||||
$this->assertFalse(Utils::contains('EngliSh', 'GLI'));
|
||||
$this->assertFalse(Utils::contains('EngliSh', 'English'));
|
||||
$this->assertFalse(Utils::contains('ENGLISH', 'SCH'));
|
||||
$this->assertFalse(Utils::contains('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH', 'DEUSTCH'));
|
||||
$this->assertFalse(Utils::contains('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
|
||||
'DEUSTCH'));
|
||||
}
|
||||
|
||||
public function testSubstrToString()
|
||||
@@ -84,12 +88,11 @@ class UtilsTest extends \Codeception\TestCase\Test
|
||||
|
||||
public function testDateFormats()
|
||||
{
|
||||
$grav = $this->grav();
|
||||
$dateFormats = Utils::dateFormats();
|
||||
$this->assertTrue(is_array($dateFormats));
|
||||
$this->assertContainsOnly('string', $dateFormats);
|
||||
|
||||
$default_format = $grav['config']->get('system.pages.dateformat.default');
|
||||
$default_format = $this->grav['config']->get('system.pages.dateformat.default');
|
||||
|
||||
if ($default_format !== null) {
|
||||
$this->assertTrue(isset($dateFormats[$default_format]));
|
||||
@@ -177,13 +180,13 @@ class UtilsTest extends \Codeception\TestCase\Test
|
||||
public function testArrayFilterRecursive()
|
||||
{
|
||||
$array = [
|
||||
'test' => '',
|
||||
'test' => '',
|
||||
'test2' => 'test2'
|
||||
];
|
||||
|
||||
$array = Utils::arrayFilterRecursive($array, function($k, $v) {
|
||||
return !(is_null($v) || $v === '');
|
||||
});
|
||||
$array = Utils::arrayFilterRecursive($array, function ($k, $v) {
|
||||
return !(is_null($v) || $v === '');
|
||||
});
|
||||
|
||||
$this->assertContainsOnly('string', $array);
|
||||
$this->assertFalse(isset($array['test']));
|
||||
@@ -193,7 +196,7 @@ class UtilsTest extends \Codeception\TestCase\Test
|
||||
|
||||
public function testPathPrefixedByLangCode()
|
||||
{
|
||||
$languagesEnabled = $this->grav()['config']->get('system.languages.supported', []);
|
||||
$languagesEnabled = $this->grav['config']->get('system.languages.supported', []);
|
||||
$arrayOfLanguages = ['en', 'de', 'it', 'es', 'dk', 'el'];
|
||||
$languagesNotEnabled = array_diff($arrayOfLanguages, $languagesEnabled);
|
||||
$oneLanguageNotEnabled = reset($languagesNotEnabled);
|
||||
@@ -212,8 +215,8 @@ class UtilsTest extends \Codeception\TestCase\Test
|
||||
public function testDate2timestamp()
|
||||
{
|
||||
$timestamp = strtotime('10 September 2000');
|
||||
$this->assertSame(Utils::date2timestamp('10 September 2000'), $timestamp);
|
||||
$this->assertSame(Utils::date2timestamp('2000-09-10 00:00:00'), $timestamp);
|
||||
$this->assertSame($timestamp, Utils::date2timestamp('10 September 2000'));
|
||||
$this->assertSame($timestamp, Utils::date2timestamp('2000-09-10 00:00:00'));
|
||||
}
|
||||
|
||||
public function testResolve()
|
||||
|
||||
@@ -44,7 +44,7 @@ RewriteRule .* index.php [L]
|
||||
|
||||
## Begin - Security
|
||||
# Block all direct access for these folders
|
||||
RewriteRule ^(.git|cache|bin|logs|backup|webserver-configs)/(.*) error [F]
|
||||
RewriteRule ^(.git|cache|bin|logs|backup|webserver-configs|tests)/(.*) error [F]
|
||||
# Block access to specific file types for these system folders
|
||||
RewriteRule ^(system|vendor)/(.*)\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ error [F]
|
||||
# Block access to specific file types for these user folders
|
||||
|
||||
@@ -30,7 +30,7 @@ url.rewrite-if-not-file = (
|
||||
$HTTP["url"] =~ "^/grav_path/(LICENSE.txt|composer.json|composer.lock|nginx.conf|web.config)$" {
|
||||
url.access-deny = ("")
|
||||
}
|
||||
$HTTP["url"] =~ "^/grav_path/(.git|cache|bin|logs|backup)/(.*)" {
|
||||
$HTTP["url"] =~ "^/grav_path/(.git|cache|bin|logs|backup|tests)/(.*)" {
|
||||
url.access-deny = ("")
|
||||
}
|
||||
$HTTP["url"] =~ "^/grav_path/(system|user|vendor)/(.*)\.(txt|md|html|yaml|php|twig|sh|bat)$" {
|
||||
|
||||
@@ -3,7 +3,7 @@ server {
|
||||
index index.html index.php;
|
||||
|
||||
## Begin - Server Info
|
||||
root /home/user/www/html;
|
||||
root /home/USER/www/html;
|
||||
server_name localhost;
|
||||
## End - Server Info
|
||||
|
||||
@@ -32,7 +32,7 @@ server {
|
||||
|
||||
## Begin - Security
|
||||
# deny all direct access for these folders
|
||||
location ~* /(.git|cache|bin|logs|backups)/.*$ { return 403; }
|
||||
location ~* /(.git|cache|bin|logs|backups|tests)/.*$ { return 403; }
|
||||
# deny running scripts inside core system folders
|
||||
location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
|
||||
# deny running scripts inside user folder
|
||||
|
||||
@@ -17,28 +17,12 @@
|
||||
</conditions>
|
||||
<action type="Rewrite" url="index.php" />
|
||||
</rule>
|
||||
<rule name="user_accounts" stopProcessing="true">
|
||||
<match url="^user/accounts/(.*)$" ignoreCase="false" />
|
||||
<action type="Redirect" url="error" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="user_config" stopProcessing="true">
|
||||
<match url="^user/config/(.*)$" ignoreCase="false" />
|
||||
<action type="Redirect" url="error" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="user_error_redirect" stopProcessing="true">
|
||||
<match url="^user/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$" ignoreCase="false" />
|
||||
<match url="^(user)/(.*)\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$" ignoreCase="false" />
|
||||
<action type="Redirect" url="error" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="cache" stopProcessing="true">
|
||||
<match url="^cache/(.*)" ignoreCase="false" />
|
||||
<action type="Redirect" url="error" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="bin" stopProcessing="true">
|
||||
<match url="^bin/(.*)$" ignoreCase="false" />
|
||||
<action type="Redirect" url="error" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="backup" stopProcessing="true">
|
||||
<match url="^backup/(.*)" ignoreCase="false" />
|
||||
<rule name="ignore_folders" stopProcessing="true">
|
||||
<match url="^(.git|cache|bin|logs|backup|webserver-configs|tests)/(.*)" ignoreCase="false" />
|
||||
<action type="Redirect" url="error" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="system" stopProcessing="true">
|
||||
@@ -52,4 +36,7 @@
|
||||
</rules>
|
||||
</rewrite>
|
||||
</system.webServer>
|
||||
<system.web>
|
||||
<httpRuntime requestPathInvalidCharacters="<,>,*,%,&,\,?" />
|
||||
</system.web>
|
||||
</configuration>
|
||||
|
||||
Reference in New Issue
Block a user