' : ucfirst($this->slug())));
}
);
@@ -208,7 +208,7 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'menu',
$var,
- function($value) {
+ function ($value) {
return trim($value ?: $this->title());
}
);
@@ -222,7 +222,7 @@ trait PageContentTrait
$value = $this->loadHeaderProperty(
'visible',
$var,
- function($value) {
+ function ($value) {
return ($value ?? $this->order() !== false) && !$this->modular();
}
);
@@ -238,7 +238,7 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'published',
$var,
- static function($value) {
+ static function ($value) {
return (bool)($value ?? true);
}
);
@@ -252,7 +252,7 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'publish_date',
$var,
- function($value) {
+ function ($value) {
return $value ? Utils::date2timestamp($value, $this->getProperty('dateformat')) : null;
}
);
@@ -266,7 +266,7 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'unpublish_date',
$var,
- function($value) {
+ function ($value) {
return $value ? Utils::date2timestamp($value, $this->getProperty('dateformat')) : null;
}
);
@@ -280,7 +280,7 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'process',
$var,
- function($value) {
+ function ($value) {
$value = array_replace(Grav::instance()['config']->get('system.pages.process', []), is_array($value) ? $value : []);
foreach ($value as $process => $status) {
$value[$process] = (bool)$status;
@@ -299,7 +299,7 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'slug',
$var,
- function($value) {
+ function ($value) {
return $value ?: static::normalizeRoute(preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder()));
}
);
@@ -313,7 +313,7 @@ trait PageContentTrait
$property = $this->loadProperty(
'order',
$var,
- function($value) {
+ function ($value) {
if (null === $value) {
preg_match(static::PAGE_ORDER_REGEX, $this->folder(), $order);
@@ -337,7 +337,7 @@ trait PageContentTrait
$property = 'id';
$value = null === $var ? $this->getProperty($property) : null;
if (null === $value) {
- $value = $this->language() . ($var ?? ($this->modified() . md5( 'flex-' . $this->getFlexType() . '-' . $this->getKey())));
+ $value = $this->language() . ($var ?? ($this->modified() . md5('flex-' . $this->getFlexType() . '-' . $this->getKey())));
$this->setProperty($property, $value);
if ($this->doHasProperty($property)) {
@@ -375,7 +375,7 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'last_modified',
$var,
- static function($value) {
+ static function ($value) {
return (bool)($value ?? Grav::instance()['config']->get('system.pages.last_modified'));
}
);
@@ -389,7 +389,7 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'date',
$var,
- function($value) {
+ function ($value) {
$value = $value ? Utils::date2timestamp($value, $this->getProperty('dateformat')) : false;
return $value ?: $this->modified();
@@ -405,7 +405,7 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'dateformat',
$var,
- static function($value) {
+ static function ($value) {
return $value ?? null;
}
);
@@ -419,14 +419,14 @@ trait PageContentTrait
return $this->loadHeaderProperty(
'taxonomy',
$var,
- static function($value) {
+ static function ($value) {
if (is_array($value)) {
// make sure first level are arrays
- array_walk($value, static function(&$val) {
+ array_walk($value, static function (&$val) {
$val = (array) $val;
});
// make sure all values are strings
- array_walk_recursive($value, static function(&$val) {
+ array_walk_recursive($value, static function (&$val) {
$val = (string) $val;
});
}
@@ -691,7 +691,6 @@ trait PageContentTrait
// Content Processed but not cached yet
$grav->fireEvent('onPageContentProcessed', new Event(['page' => $this]));
-
} else {
if ($process_markdown) {
$this->_content = $this->processMarkdown($this->_content, $options);
diff --git a/system/src/Grav/Framework/Flex/Pages/Traits/PageLegacyTrait.php b/system/src/Grav/Framework/Flex/Pages/Traits/PageLegacyTrait.php
index fabfcfb4e..b0c721a1d 100644
--- a/system/src/Grav/Framework/Flex/Pages/Traits/PageLegacyTrait.php
+++ b/system/src/Grav/Framework/Flex/Pages/Traits/PageLegacyTrait.php
@@ -469,7 +469,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'template',
$var,
- function($value) {
+ function ($value) {
return trim($value ?? (($this->modular() ? 'modular/' : '') . str_replace($this->extension(), '', $this->name())));
}
);
@@ -488,7 +488,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'template_format',
$var,
- function($value) {
+ function ($value) {
return ltrim($value ?? $this->getNestedProperty('header.append_url_extension') ?: Utils::getPageFormat(), '.');
}
);
@@ -528,7 +528,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'expires',
$var,
- static function($value) {
+ static function ($value) {
return (int)($value ?? Grav::instance()['config']->get('system.pages.expires'));
}
);
@@ -546,7 +546,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'cache_control',
$var,
- static function($value) {
+ static function ($value) {
return ((string)($value ?? Grav::instance()['config']->get('system.pages.cache_control'))) ?: null;
}
);
@@ -557,7 +557,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'ssl',
$var,
- static function($value) {
+ static function ($value) {
return $value ? (bool)$value : null;
}
);
@@ -669,7 +669,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'etag',
$var,
- static function($value) {
+ static function ($value) {
return (bool)($value ?? Grav::instance()['config']->get('system.pages.last_modified'));
}
);
@@ -730,7 +730,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'order_dir',
$var,
- static function($value) {
+ static function ($value) {
return strtolower(trim($value) ?: Grav::instance()['config']->get('system.pages.order.dir')) === 'desc' ? 'desc' : 'asc';
}
);
@@ -753,7 +753,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'order_by',
$var,
- static function($value) {
+ static function ($value) {
return trim($value) ?: Grav::instance()['config']->get('system.pages.order.by');
}
);
@@ -771,7 +771,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'order_manual',
$var,
- static function($value) {
+ static function ($value) {
return (array)$value;
}
);
@@ -790,7 +790,7 @@ trait PageLegacyTrait
return $this->loadHeaderProperty(
'max_count',
$var,
- static function($value) {
+ static function ($value) {
return (int)($value ?? Grav::instance()['config']->get('system.pages.list.count'));
}
);
diff --git a/system/src/Grav/Framework/Flex/Pages/Traits/PageRoutableTrait.php b/system/src/Grav/Framework/Flex/Pages/Traits/PageRoutableTrait.php
index d15a0f6de..66a882103 100644
--- a/system/src/Grav/Framework/Flex/Pages/Traits/PageRoutableTrait.php
+++ b/system/src/Grav/Framework/Flex/Pages/Traits/PageRoutableTrait.php
@@ -33,7 +33,7 @@ trait PageRoutableTrait
return $this->loadHeaderProperty(
'url_extension',
null,
- function($value) {
+ function ($value) {
if ($this->home()) {
return '';
}
@@ -56,7 +56,7 @@ trait PageRoutableTrait
$value = $this->loadHeaderProperty(
'routable',
$var,
- function($value) {
+ function ($value) {
return ($value ?? true) && $this->published() && $this->getLanguages(true);
}
);
@@ -243,7 +243,7 @@ trait PageRoutableTrait
return $this->loadHeaderProperty(
'redirect',
$var,
- static function($value) {
+ static function ($value) {
return trim($value) ?: null;
}
);
@@ -306,7 +306,7 @@ trait PageRoutableTrait
return $this->loadProperty(
'folder',
$var,
- function($value) {
+ function ($value) {
if (null === $value) {
$value = $this->getStorageKey(true) ?: $this->getKey();
}
@@ -328,7 +328,7 @@ trait PageRoutableTrait
return $this->loadProperty(
'parent_key',
$var,
- function($value) {
+ function ($value) {
if (null === $value) {
$value = $this->getStorageKey(true) ?: $this->getKey();
$value = ltrim(dirname("/{$value}"), '/') ?: '';
diff --git a/system/src/Grav/Framework/Flex/Pages/Traits/PageTranslateTrait.php b/system/src/Grav/Framework/Flex/Pages/Traits/PageTranslateTrait.php
index 01d7aa926..5cfd5bbc3 100644
--- a/system/src/Grav/Framework/Flex/Pages/Traits/PageTranslateTrait.php
+++ b/system/src/Grav/Framework/Flex/Pages/Traits/PageTranslateTrait.php
@@ -206,7 +206,7 @@ trait PageTranslateTrait
return $this->loadHeaderProperty(
'lang',
$var,
- function($value) {
+ function ($value) {
$value = $value ?? $this->getMetaData()['lang'] ?? '';
return trim($value) ?: null;
diff --git a/system/src/Grav/Framework/Form/FormFlash.php b/system/src/Grav/Framework/Form/FormFlash.php
index 9b712eeda..2e99c579b 100644
--- a/system/src/Grav/Framework/Form/FormFlash.php
+++ b/system/src/Grav/Framework/Form/FormFlash.php
@@ -62,7 +62,9 @@ class FormFlash implements FormFlashInterface
'unique_id' => $args[1] ?? null,
'form_name' => $args[2] ?? null,
];
- $config = array_filter($config, static function ($val) { return $val !== null; });
+ $config = array_filter($config, static function ($val) {
+ return $val !== null;
+ });
}
$this->sessionId = $config['session_id'] ?? 'no-session';
@@ -112,7 +114,8 @@ class FormFlash implements FormFlashInterface
if ($exists) {
try {
$data = (array)$file->content();
- } catch (\Exception $e) {}
+ } catch (\Exception $e) {
+ }
}
return $data;
diff --git a/system/src/Grav/Framework/Form/Traits/FormTrait.php b/system/src/Grav/Framework/Form/Traits/FormTrait.php
index d596c0a3b..c58e51b68 100644
--- a/system/src/Grav/Framework/Form/Traits/FormTrait.php
+++ b/system/src/Grav/Framework/Form/Traits/FormTrait.php
@@ -248,7 +248,7 @@ trait FormTrait
$this->validateUploads($this->getFiles());
} catch (ValidationException $e) {
$this->setErrors($e->getMessages());
- } catch (\Exception $e) {
+ } catch (\Exception $e) {
/** @var Debugger $debugger */
$debugger = Grav::instance()['debugger'];
$debugger->addException($e);
diff --git a/system/src/Grav/Framework/Object/Base/ObjectTrait.php b/system/src/Grav/Framework/Object/Base/ObjectTrait.php
index baeeb2bb7..0fbbafa19 100644
--- a/system/src/Grav/Framework/Object/Base/ObjectTrait.php
+++ b/system/src/Grav/Framework/Object/Base/ObjectTrait.php
@@ -17,7 +17,7 @@ namespace Grav\Framework\Object\Base;
trait ObjectTrait
{
/** @var string */
- static protected $type;
+ protected static $type;
/**
* @var string
diff --git a/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php b/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php
index 0eefb78a0..1d6a999ae 100644
--- a/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php
+++ b/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php
@@ -101,7 +101,7 @@ class ObjectExpressionVisitor extends ClosureExpressionVisitor
public static function sortByField($name, $orientation = 1, \Closure $next = null)
{
if (!$next) {
- $next = function($a, $b) {
+ $next = function ($a, $b) {
return 0;
};
}
diff --git a/system/src/Grav/Framework/Object/ObjectIndex.php b/system/src/Grav/Framework/Object/ObjectIndex.php
index 4ba9b75e6..73ca13f88 100644
--- a/system/src/Grav/Framework/Object/ObjectIndex.php
+++ b/system/src/Grav/Framework/Object/ObjectIndex.php
@@ -24,7 +24,7 @@ use Grav\Framework\Object\Interfaces\ObjectCollectionInterface;
abstract class ObjectIndex extends AbstractIndexCollection implements ObjectCollectionInterface, NestedObjectInterface
{
/** @var string */
- static protected $type;
+ protected static $type;
/**
* @var string
diff --git a/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php b/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php
index 7092e15d5..4932acf6a 100644
--- a/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php
+++ b/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php
@@ -95,7 +95,9 @@ trait ArrayPropertyTrait
*/
protected function getElements()
{
- return array_filter($this->_elements, function ($val) { return $val !== null; });
+ return array_filter($this->_elements, function ($val) {
+ return $val !== null;
+ });
}
/**
diff --git a/system/src/Grav/Framework/RequestHandler/RequestHandler.php b/system/src/Grav/Framework/RequestHandler/RequestHandler.php
index c4d53873b..80f5fd85d 100644
--- a/system/src/Grav/Framework/RequestHandler/RequestHandler.php
+++ b/system/src/Grav/Framework/RequestHandler/RequestHandler.php
@@ -63,4 +63,4 @@ class RequestHandler implements RequestHandlerInterface
return $this;
}
-}
\ No newline at end of file
+}
diff --git a/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php b/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
index 153d1a160..79358003d 100644
--- a/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
+++ b/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
@@ -56,4 +56,4 @@ trait RequestHandlerTrait
return $this->handle($request);
}
-}
\ No newline at end of file
+}
diff --git a/system/src/Grav/Framework/Route/Route.php b/system/src/Grav/Framework/Route/Route.php
index 95a111c16..0cdac8b0a 100644
--- a/system/src/Grav/Framework/Route/Route.php
+++ b/system/src/Grav/Framework/Route/Route.php
@@ -411,7 +411,6 @@ class Route
$this->extension = $gravParts['extension'] ?? '';
$this->gravParams = $gravParts['params'] ?: [];
$this->queryParams = $parts['query_params'] ?: [];
-
} else {
$this->root = RouteFactory::getRoot();
$this->language = RouteFactory::getLanguage();
diff --git a/system/src/Grav/Framework/Uri/UriFactory.php b/system/src/Grav/Framework/Uri/UriFactory.php
index e5cb1d319..e8172980d 100644
--- a/system/src/Grav/Framework/Uri/UriFactory.php
+++ b/system/src/Grav/Framework/Uri/UriFactory.php
@@ -122,7 +122,9 @@ class UriFactory
$encodedUrl = preg_replace_callback(
'%[^:/@?&=#]+%u',
- function ($matches) { return rawurlencode($matches[0]); },
+ function ($matches) {
+ return rawurlencode($matches[0]);
+ },
$url
);
diff --git a/system/src/Grav/Installer/Install.php b/system/src/Grav/Installer/Install.php
index 5345ce3a0..dc7d556e9 100644
--- a/system/src/Grav/Installer/Install.php
+++ b/system/src/Grav/Installer/Install.php
@@ -144,7 +144,7 @@ class Install
{
$results = [];
- $this->checkVersion($results, 'php','php', $this->requires['php'], PHP_VERSION);
+ $this->checkVersion($results, 'php', 'php', $this->requires['php'], PHP_VERSION);
$this->checkVersion($results, 'grav', 'grav', $this->requires['grav'], GRAV_VERSION);
$this->checkPlugins($results, $this->requires['plugins']);
@@ -284,4 +284,4 @@ class Install
$this->checkVersion($results, 'plugin', $name, $check, $version);
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php
index 1c0ffd94b..03677dd84 100644
--- a/tests/_bootstrap.php
+++ b/tests/_bootstrap.php
@@ -7,7 +7,7 @@ use Grav\Common\Grav;
ini_set('error_log', __DIR__ . '/error.log');
-$grav = function() {
+$grav = function () {
Grav::resetInstance();
$grav = Grav::instance();
$grav['config']->init();
@@ -32,4 +32,3 @@ Fixtures::add('grav', $grav);
$fake = Factory::create();
Fixtures::add('fake', $fake);
-
diff --git a/tests/_support/Helper/Unit.php b/tests/_support/Helper/Unit.php
index 199872966..74ef5a6b8 100644
--- a/tests/_support/Helper/Unit.php
+++ b/tests/_support/Helper/Unit.php
@@ -2,6 +2,7 @@
namespace Helper;
use Codeception;
+
// here you can define custom actions
// all public methods declared in helper class will be available in $I
@@ -14,13 +15,15 @@ class Unit extends Codeception\Module
/**
* HOOK: used after configuration is loaded
*/
- public function _initialize() {
+ public function _initialize()
+ {
}
/**
* HOOK: on every Actor class initialization
*/
- public function _cleanup() {
+ public function _cleanup()
+ {
}
/**
@@ -28,13 +31,15 @@ class Unit extends Codeception\Module
*
* @param array $settings
*/
- public function _beforeSuite($settings = []) {
+ public function _beforeSuite($settings = [])
+ {
}
/**
* HOOK: after suite
**/
- public function _afterSuite() {
+ public function _afterSuite()
+ {
}
/**
@@ -42,7 +47,8 @@ class Unit extends Codeception\Module
*
* @param Codeception\Step $step*
*/
- public function _beforeStep(Codeception\Step $step) {
+ public function _beforeStep(Codeception\Step $step)
+ {
}
/**
@@ -50,7 +56,8 @@ class Unit extends Codeception\Module
*
* @param Codeception\Step $step
*/
- public function _afterStep(Codeception\Step $step) {
+ public function _afterStep(Codeception\Step $step)
+ {
}
/**
@@ -58,7 +65,8 @@ class Unit extends Codeception\Module
*
* @param Codeception\TestCase $test
*/
- public function _before(Codeception\TestCase $test) {
+ public function _before(Codeception\TestCase $test)
+ {
}
/**
@@ -66,7 +74,8 @@ class Unit extends Codeception\Module
*
* @param Codeception\TestCase $test
*/
- public function _after(Codeception\TestCase $test) {
+ public function _after(Codeception\TestCase $test)
+ {
}
/**
@@ -75,6 +84,7 @@ class Unit extends Codeception\Module
* @param Codeception\TestCase $test
* @param $fail
*/
- public function _failed(Codeception\TestCase $test, $fail) {
+ public function _failed(Codeception\TestCase $test, $fail)
+ {
}
}
diff --git a/tests/functional/Grav/Console/DirectInstallCommandTest.php b/tests/functional/Grav/Console/DirectInstallCommandTest.php
index d1bc6cf76..d26a29ce2 100644
--- a/tests/functional/Grav/Console/DirectInstallCommandTest.php
+++ b/tests/functional/Grav/Console/DirectInstallCommandTest.php
@@ -4,7 +4,6 @@ use Codeception\Util\Fixtures;
use Grav\Common\Grav;
use Grav\Console\Gpm\DirectInstallCommand;
-
/**
* Class DirectInstallCommandTest
*/
@@ -22,7 +21,6 @@ class DirectInstallCommandTest extends \Codeception\TestCase\Test
$this->grav = Fixtures::get('grav');
$this->directInstallCommand = new DirectInstallCommand();
}
-
}
/**
diff --git a/tests/phpstan/plugins-bootstrap.php b/tests/phpstan/plugins-bootstrap.php
index 8d5492971..0126d28d6 100644
--- a/tests/phpstan/plugins-bootstrap.php
+++ b/tests/phpstan/plugins-bootstrap.php
@@ -30,7 +30,7 @@ $grav['config']->init();
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
$iterator = $locator->getIterator('plugins://');
-foreach($iterator as $directory) {
+foreach ($iterator as $directory) {
if (!$directory->isDir()) {
continue;
}
diff --git a/tests/unit/Grav/Common/AssetsTest.php b/tests/unit/Grav/Common/AssetsTest.php
index 4c574e389..d3e72dd7f 100644
--- a/tests/unit/Grav/Common/AssetsTest.php
+++ b/tests/unit/Grav/Common/AssetsTest.php
@@ -322,8 +322,6 @@ class AssetsTest extends \Codeception\TestCase\Test
$this->assets->add('test.css', ['media' => 'only screen and (min-width: 640px)']);
$css = $this->assets->css();
$this->assertSame(' ' . PHP_EOL, $css);
-
-
}
public function testAddingAssetPropertiesWithArray()
@@ -334,7 +332,6 @@ class AssetsTest extends \Codeception\TestCase\Test
$js = $this->assets->js();
$this->assertSame('' . PHP_EOL, $js);
$this->assets->reset();
-
}
public function testAddingJSAssetPropertiesWithArrayFromCollection()
@@ -444,7 +441,6 @@ class AssetsTest extends \Codeception\TestCase\Test
$this->assets->addInlineJs('alert("test")', 15, 'bottom', ['id' => 'foo']);
$js = $this->assets->js('bottom');
$this->assertSame('' . PHP_EOL, $js);
-
}
public function testAddingCSSAssetPropertiesWithArrayFromCollection()
@@ -773,6 +769,5 @@ class AssetsTest extends \Codeception\TestCase\Test
$this->assertGreaterThan(0, (array) $this->assets->getCss());
$this->assertInternalType('array', $this->assets->getJs());
$this->assertGreaterThan(0, (array) $this->assets->getJs());
-
}
}
diff --git a/tests/unit/Grav/Common/BrowserTest.php b/tests/unit/Grav/Common/BrowserTest.php
index 6e637384e..a4df12003 100644
--- a/tests/unit/Grav/Common/BrowserTest.php
+++ b/tests/unit/Grav/Common/BrowserTest.php
@@ -22,19 +22,23 @@ class BrowserTest extends \Codeception\TestCase\Test
}
public function testGetBrowser()
- { /* Already covered by PhpUserAgent tests */
+ {
+ /* Already covered by PhpUserAgent tests */
}
public function testGetPlatform()
- { /* Already covered by PhpUserAgent tests */
+ {
+ /* Already covered by PhpUserAgent tests */
}
public function testGetLongVersion()
- { /* Already covered by PhpUserAgent tests */
+ {
+ /* Already covered by PhpUserAgent tests */
}
public function testGetVersion()
- { /* Already covered by PhpUserAgent tests */
+ {
+ /* Already covered by PhpUserAgent tests */
}
public function testIsHuman()
@@ -45,4 +49,3 @@ class BrowserTest extends \Codeception\TestCase\Test
$this->assertFalse($this->grav['browser']->isHuman());
}
}
-
diff --git a/tests/unit/Grav/Common/ComposerTest.php b/tests/unit/Grav/Common/ComposerTest.php
index 243a88862..c1d7dbbfd 100644
--- a/tests/unit/Grav/Common/ComposerTest.php
+++ b/tests/unit/Grav/Common/ComposerTest.php
@@ -28,5 +28,4 @@ class ComposerTest extends \Codeception\TestCase\Test
$this->assertNotNull(strstr($composerExecutor, 'php'));
$this->assertNotNull(strstr($composerExecutor, 'composer'));
}
-
}
diff --git a/tests/unit/Grav/Common/GPM/GPMTest.php b/tests/unit/Grav/Common/GPM/GPMTest.php
index 7e1c03e92..51049c47a 100644
--- a/tests/unit/Grav/Common/GPM/GPMTest.php
+++ b/tests/unit/Grav/Common/GPM/GPMTest.php
@@ -16,7 +16,6 @@ class GpmStub extends GPM
if (isset($this->data[$packageName])) {
return $this->data[$packageName];
}
-
}
public function findPackages($searches = [])
diff --git a/tests/unit/Grav/Common/Helpers/ExcerptsTest.php b/tests/unit/Grav/Common/Helpers/ExcerptsTest.php
index 3673da558..e344a8fdc 100644
--- a/tests/unit/Grav/Common/Helpers/ExcerptsTest.php
+++ b/tests/unit/Grav/Common/Helpers/ExcerptsTest.php
@@ -78,10 +78,13 @@ class ExcerptsTest extends \Codeception\TestCase\Test
public function testProcessImageHtml()
{
- $this->assertRegexp('| |',
- Excerpts::processImageHtml(' ', $this->page));
- $this->assertRegexp('| |',
- Excerpts::processImageHtml(' ', $this->page));
+ $this->assertRegexp(
+ '| |',
+ Excerpts::processImageHtml(' ', $this->page)
+ );
+ $this->assertRegexp(
+ '| |',
+ Excerpts::processImageHtml(' ', $this->page)
+ );
}
-
}
diff --git a/tests/unit/Grav/Common/InflectorTest.php b/tests/unit/Grav/Common/InflectorTest.php
index 9fad48964..b0b1d4ad9 100644
--- a/tests/unit/Grav/Common/InflectorTest.php
+++ b/tests/unit/Grav/Common/InflectorTest.php
@@ -29,119 +29,117 @@ class InflectorTest extends \Codeception\TestCase\Test
public function testPluralize()
{
- $this->assertSame('words', $this->inflector->pluralize('word'));
- $this->assertSame('kisses', $this->inflector->pluralize('kiss'));
- $this->assertSame('volcanoes', $this->inflector->pluralize('volcanoe'));
- $this->assertSame('cherries', $this->inflector->pluralize('cherry'));
- $this->assertSame('days', $this->inflector->pluralize('day'));
- $this->assertSame('knives', $this->inflector->pluralize('knife'));
+ $this->assertSame('words', $this->inflector->pluralize('word'));
+ $this->assertSame('kisses', $this->inflector->pluralize('kiss'));
+ $this->assertSame('volcanoes', $this->inflector->pluralize('volcanoe'));
+ $this->assertSame('cherries', $this->inflector->pluralize('cherry'));
+ $this->assertSame('days', $this->inflector->pluralize('day'));
+ $this->assertSame('knives', $this->inflector->pluralize('knife'));
}
public function testSingularize()
{
- $this->assertSame('word', $this->inflector->singularize('words'));
- $this->assertSame('kiss', $this->inflector->singularize('kisses'));
- $this->assertSame('volcanoe', $this->inflector->singularize('volcanoe'));
- $this->assertSame('cherry', $this->inflector->singularize('cherries'));
- $this->assertSame('day', $this->inflector->singularize('days'));
- $this->assertSame('knife', $this->inflector->singularize('knives'));
+ $this->assertSame('word', $this->inflector->singularize('words'));
+ $this->assertSame('kiss', $this->inflector->singularize('kisses'));
+ $this->assertSame('volcanoe', $this->inflector->singularize('volcanoe'));
+ $this->assertSame('cherry', $this->inflector->singularize('cherries'));
+ $this->assertSame('day', $this->inflector->singularize('days'));
+ $this->assertSame('knife', $this->inflector->singularize('knives'));
}
public function testTitleize()
{
- $this->assertSame('This String Is Titleized', $this->inflector->titleize('ThisStringIsTitleized'));
- $this->assertSame('This String Is Titleized', $this->inflector->titleize('this string is titleized'));
- $this->assertSame('This String Is Titleized', $this->inflector->titleize('this_string_is_titleized'));
- $this->assertSame('This String Is Titleized', $this->inflector->titleize('this-string-is-titleized'));
+ $this->assertSame('This String Is Titleized', $this->inflector->titleize('ThisStringIsTitleized'));
+ $this->assertSame('This String Is Titleized', $this->inflector->titleize('this string is titleized'));
+ $this->assertSame('This String Is Titleized', $this->inflector->titleize('this_string_is_titleized'));
+ $this->assertSame('This String Is Titleized', $this->inflector->titleize('this-string-is-titleized'));
- $this->assertSame('This string is titleized', $this->inflector->titleize('ThisStringIsTitleized', 'first'));
- $this->assertSame('This string is titleized', $this->inflector->titleize('this string is titleized', 'first'));
- $this->assertSame('This string is titleized', $this->inflector->titleize('this_string_is_titleized', 'first'));
- $this->assertSame('This string is titleized', $this->inflector->titleize('this-string-is-titleized', 'first'));
+ $this->assertSame('This string is titleized', $this->inflector->titleize('ThisStringIsTitleized', 'first'));
+ $this->assertSame('This string is titleized', $this->inflector->titleize('this string is titleized', 'first'));
+ $this->assertSame('This string is titleized', $this->inflector->titleize('this_string_is_titleized', 'first'));
+ $this->assertSame('This string is titleized', $this->inflector->titleize('this-string-is-titleized', 'first'));
}
public function testCamelize()
{
- $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('This String Is Camelized'));
- $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('thisStringIsCamelized'));
- $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('This_String_Is_Camelized'));
- $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('this string is camelized'));
- $this->assertSame('GravSPrettyCoolMy1', $this->inflector->camelize("Grav's Pretty Cool. My #1!"));
+ $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('This String Is Camelized'));
+ $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('thisStringIsCamelized'));
+ $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('This_String_Is_Camelized'));
+ $this->assertSame('ThisStringIsCamelized', $this->inflector->camelize('this string is camelized'));
+ $this->assertSame('GravSPrettyCoolMy1', $this->inflector->camelize("Grav's Pretty Cool. My #1!"));
}
public function testUnderscorize()
{
- $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('This String Is Underscorized'));
- $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('ThisStringIsUnderscorized'));
- $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('This_String_Is_Underscorized'));
- $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('This-String-Is-Underscorized'));
+ $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('This String Is Underscorized'));
+ $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('ThisStringIsUnderscorized'));
+ $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('This_String_Is_Underscorized'));
+ $this->assertSame('this_string_is_underscorized', $this->inflector->underscorize('This-String-Is-Underscorized'));
}
public function testHyphenize()
{
- $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This String Is Hyphenized'));
- $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('ThisStringIsHyphenized'));
- $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This-String-Is-Hyphenized'));
- $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This_String_Is_Hyphenized'));
+ $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This String Is Hyphenized'));
+ $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('ThisStringIsHyphenized'));
+ $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This-String-Is-Hyphenized'));
+ $this->assertSame('this-string-is-hyphenized', $this->inflector->hyphenize('This_String_Is_Hyphenized'));
}
public function testHumanize()
{
//$this->assertSame('This string is humanized', $this->inflector->humanize('ThisStringIsHumanized'));
- $this->assertSame('This string is humanized', $this->inflector->humanize('this_string_is_humanized'));
+ $this->assertSame('This string is humanized', $this->inflector->humanize('this_string_is_humanized'));
//$this->assertSame('This string is humanized', $this->inflector->humanize('this-string-is-humanized'));
- $this->assertSame('This String Is Humanized', $this->inflector->humanize('this_string_is_humanized', 'all'));
+ $this->assertSame('This String Is Humanized', $this->inflector->humanize('this_string_is_humanized', 'all'));
//$this->assertSame('This String Is Humanized', $this->inflector->humanize('this-string-is-humanized'), 'all');
}
public function testVariablize()
{
- $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('This String Is Variablized'));
- $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('ThisStringIsVariablized'));
- $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('This_String_Is_Variablized'));
- $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('this string is variablized'));
- $this->assertSame('gravSPrettyCoolMy1', $this->inflector->variablize("Grav's Pretty Cool. My #1!"));
+ $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('This String Is Variablized'));
+ $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('ThisStringIsVariablized'));
+ $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('This_String_Is_Variablized'));
+ $this->assertSame('thisStringIsVariablized', $this->inflector->variablize('this string is variablized'));
+ $this->assertSame('gravSPrettyCoolMy1', $this->inflector->variablize("Grav's Pretty Cool. My #1!"));
}
public function testTableize()
{
- $this->assertSame('people', $this->inflector->tableize('Person'));
- $this->assertSame('pages', $this->inflector->tableize('Page'));
- $this->assertSame('blog_pages', $this->inflector->tableize('BlogPage'));
- $this->assertSame('admin_dependencies', $this->inflector->tableize('adminDependency'));
- $this->assertSame('admin_dependencies', $this->inflector->tableize('admin-dependency'));
- $this->assertSame('admin_dependencies', $this->inflector->tableize('admin_dependency'));
+ $this->assertSame('people', $this->inflector->tableize('Person'));
+ $this->assertSame('pages', $this->inflector->tableize('Page'));
+ $this->assertSame('blog_pages', $this->inflector->tableize('BlogPage'));
+ $this->assertSame('admin_dependencies', $this->inflector->tableize('adminDependency'));
+ $this->assertSame('admin_dependencies', $this->inflector->tableize('admin-dependency'));
+ $this->assertSame('admin_dependencies', $this->inflector->tableize('admin_dependency'));
}
public function testClassify()
{
- $this->assertSame('Person', $this->inflector->classify('people'));
- $this->assertSame('Page', $this->inflector->classify('pages'));
- $this->assertSame('BlogPage', $this->inflector->classify('blog_pages'));
- $this->assertSame('AdminDependency', $this->inflector->classify('admin_dependencies'));
+ $this->assertSame('Person', $this->inflector->classify('people'));
+ $this->assertSame('Page', $this->inflector->classify('pages'));
+ $this->assertSame('BlogPage', $this->inflector->classify('blog_pages'));
+ $this->assertSame('AdminDependency', $this->inflector->classify('admin_dependencies'));
}
public function testOrdinalize()
{
- $this->assertSame('1st', $this->inflector->ordinalize(1));
- $this->assertSame('2nd', $this->inflector->ordinalize(2));
- $this->assertSame('3rd', $this->inflector->ordinalize(3));
- $this->assertSame('4th', $this->inflector->ordinalize(4));
- $this->assertSame('5th', $this->inflector->ordinalize(5));
- $this->assertSame('16th', $this->inflector->ordinalize(16));
- $this->assertSame('51st', $this->inflector->ordinalize(51));
- $this->assertSame('111th', $this->inflector->ordinalize(111));
- $this->assertSame('123rd', $this->inflector->ordinalize(123));
+ $this->assertSame('1st', $this->inflector->ordinalize(1));
+ $this->assertSame('2nd', $this->inflector->ordinalize(2));
+ $this->assertSame('3rd', $this->inflector->ordinalize(3));
+ $this->assertSame('4th', $this->inflector->ordinalize(4));
+ $this->assertSame('5th', $this->inflector->ordinalize(5));
+ $this->assertSame('16th', $this->inflector->ordinalize(16));
+ $this->assertSame('51st', $this->inflector->ordinalize(51));
+ $this->assertSame('111th', $this->inflector->ordinalize(111));
+ $this->assertSame('123rd', $this->inflector->ordinalize(123));
}
public function testMonthize()
{
- $this->assertSame(0, $this->inflector->monthize(10));
- $this->assertSame(1, $this->inflector->monthize(33));
- $this->assertSame(1, $this->inflector->monthize(41));
- $this->assertSame(11, $this->inflector->monthize(364));
+ $this->assertSame(0, $this->inflector->monthize(10));
+ $this->assertSame(1, $this->inflector->monthize(33));
+ $this->assertSame(1, $this->inflector->monthize(41));
+ $this->assertSame(11, $this->inflector->monthize(364));
}
}
-
-
diff --git a/tests/unit/Grav/Common/Language/LanguageCodesTest.php b/tests/unit/Grav/Common/Language/LanguageCodesTest.php
index ef6cabc6d..3fbc69eb0 100644
--- a/tests/unit/Grav/Common/Language/LanguageCodesTest.php
+++ b/tests/unit/Grav/Common/Language/LanguageCodesTest.php
@@ -2,7 +2,6 @@
use Grav\Common\Language\LanguageCodes;
-
/**
* Class ParsedownTest
*/
@@ -10,15 +9,19 @@ class LanguageCodesTest extends \Codeception\TestCase\Test
{
public function testRtl()
{
- $this->assertSame('ltr',
- LanguageCodes::getOrientation('en'));
- $this->assertSame('rtl',
- LanguageCodes::getOrientation('ar'));
- $this->assertSame('rtl',
- LanguageCodes::getOrientation('he'));
+ $this->assertSame(
+ 'ltr',
+ LanguageCodes::getOrientation('en')
+ );
+ $this->assertSame(
+ 'rtl',
+ LanguageCodes::getOrientation('ar')
+ );
+ $this->assertSame(
+ 'rtl',
+ LanguageCodes::getOrientation('he')
+ );
$this->assertTrue(LanguageCodes::isRtl('ar'));
$this->assertFalse(LanguageCodes::isRtl('fr'));
-
}
-
}
diff --git a/tests/unit/Grav/Common/Markdown/ParsedownTest.php b/tests/unit/Grav/Common/Markdown/ParsedownTest.php
index 2293bb749..8f534ecfe 100644
--- a/tests/unit/Grav/Common/Markdown/ParsedownTest.php
+++ b/tests/unit/Grav/Common/Markdown/ParsedownTest.php
@@ -10,7 +10,6 @@ use Grav\Common\Markdown\Parsedown;
use Grav\Common\Language\Language;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
-
/**
* Class ParsedownTest
*/
@@ -85,45 +84,71 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->grav['language'] = new Language($this->grav);
$this->uri->initializeWithURL('http://testing.dev/fr/item2/item2-2')->init();
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertRegexp('| <\/p>|',
- $this->parsedown->text(''));
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '| <\/p>|',
+ $this->parsedown->text('')
+ );
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertRegexp('| <\/p>|',
- $this->parsedown->text(''));
- $this->assertRegexp('|
<\/p>|',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
-
- }
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '| <\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '|
<\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ }
public function testImagesSubDir()
{
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertRegexp('| <\/p>|',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertRegexp('| <\/p>|',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
-
+ $this->assertRegexp(
+ '| <\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '| <\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
}
public function testImagesAbsoluteUrls()
@@ -131,16 +156,26 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertRegexp('| <\/p>|',
- $this->parsedown->text(''));
- $this->assertRegexp('|
<\/p>|',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '| <\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '|
<\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
}
public function testImagesSubDirAbsoluteUrls()
@@ -148,36 +183,60 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertRegexp('| <\/p>|',
- $this->parsedown->text(''));
- $this->assertRegexp('|
<\/p>|',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '| <\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '|
<\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
}
public function testImagesAttributes()
{
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
}
@@ -199,24 +258,32 @@ class ParsedownTest extends \Codeception\TestCase\Test
$excerpts = new Excerpts($page, $defaults);
$this->parsedown = new Parsedown($excerpts);
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertRegexp('| <\/p>|',
- $this->parsedown->text(''));
- $this->assertRegexp('|
<\/p>|',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '| <\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '|
<\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
$this->config->set('system.languages.supported', ['fr','en']);
unset($this->grav['language']);
$this->grav['language'] = new Language($this->grav);
$this->uri->initializeWithURL('http://testing.dev/fr/item2/item2-2')->init();
- $this->assertSame('
',
- $this->parsedown->text(''));
-
-
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
}
public function testRootImagesSubDirAbsoluteUrls()
@@ -224,16 +291,26 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertRegexp('| <\/p>|',
- $this->parsedown->text(''));
- $this->assertRegexp('|
<\/p>|',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
- $this->assertSame('
',
- $this->parsedown->text(''));
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '| <\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertRegexp(
+ '|
<\/p>|',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
+ $this->assertSame(
+ '
',
+ $this->parsedown->text('')
+ );
}
public function testRootAbsoluteLinks()
@@ -254,34 +331,54 @@ class ParsedownTest extends \Codeception\TestCase\Test
$excerpts = new Excerpts($page, $defaults);
$this->parsedown = new Parsedown($excerpts);
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](item1-3)'));
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](item1-3)')
+ );
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](../item2)'));
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](../item2)')
+ );
- $this->assertSame('With Query
',
- $this->parsedown->text('[With Query](?foo=bar)'));
- $this->assertSame('With Param
',
- $this->parsedown->text('[With Param](/foo:bar)'));
- $this->assertSame('With Anchor
',
- $this->parsedown->text('[With Anchor](#foo)'));
+ $this->assertSame(
+ 'With Query
',
+ $this->parsedown->text('[With Query](?foo=bar)')
+ );
+ $this->assertSame(
+ 'With Param
',
+ $this->parsedown->text('[With Param](/foo:bar)')
+ );
+ $this->assertSame(
+ 'With Anchor
',
+ $this->parsedown->text('[With Anchor](#foo)')
+ );
$this->config->set('system.languages.supported', ['fr','en']);
unset($this->grav['language']);
$this->grav['language'] = new Language($this->grav);
$this->uri->initializeWithURL('http://testing.dev/fr/item2/item2-2')->init();
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](../item2)'));
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](item1-3)'));
- $this->assertSame('With Query
',
- $this->parsedown->text('[With Query](?foo=bar)'));
- $this->assertSame('With Param
',
- $this->parsedown->text('[With Param](/foo:bar)'));
- $this->assertSame('With Anchor
',
- $this->parsedown->text('[With Anchor](#foo)'));
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](../item2)')
+ );
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](item1-3)')
+ );
+ $this->assertSame(
+ 'With Query
',
+ $this->parsedown->text('[With Query](?foo=bar)')
+ );
+ $this->assertSame(
+ 'With Param
',
+ $this->parsedown->text('[With Param](/foo:bar)')
+ );
+ $this->assertSame(
+ 'With Anchor
',
+ $this->parsedown->text('[With Anchor](#foo)')
+ );
}
@@ -292,15 +389,22 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->grav['language'] = new Language($this->grav);
$this->uri->initializeWithURL('http://testing.dev/fr/item2/item2-2')->init();
- $this->assertSame('Current Anchor
',
- $this->parsedown->text('[Current Anchor](#foo)'));
- $this->assertSame('Root Anchor
',
- $this->parsedown->text('[Root Anchor](/#foo)'));
- $this->assertSame('Peer Anchor
',
- $this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
- $this->assertSame('Peer Anchor 2
',
- $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
-
+ $this->assertSame(
+ 'Current Anchor
',
+ $this->parsedown->text('[Current Anchor](#foo)')
+ );
+ $this->assertSame(
+ 'Root Anchor
',
+ $this->parsedown->text('[Root Anchor](/#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor
',
+ $this->parsedown->text('[Peer Anchor](../item2-1#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor 2
',
+ $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)')
+ );
}
public function testAnchorLinksLangAbsoluteUrls()
@@ -311,36 +415,53 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->grav['language'] = new Language($this->grav);
$this->uri->initializeWithURL('http://testing.dev/fr/item2/item2-2')->init();
- $this->assertSame('Current Anchor
',
- $this->parsedown->text('[Current Anchor](#foo)'));
- $this->assertSame('Peer Anchor
',
- $this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
- $this->assertSame('Peer Anchor 2
',
- $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
- $this->assertSame('Root Anchor
',
- $this->parsedown->text('[Root Anchor](/#foo)'));
-
+ $this->assertSame(
+ 'Current Anchor
',
+ $this->parsedown->text('[Current Anchor](#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor
',
+ $this->parsedown->text('[Peer Anchor](../item2-1#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor 2
',
+ $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)')
+ );
+ $this->assertSame(
+ 'Root Anchor
',
+ $this->parsedown->text('[Root Anchor](/#foo)')
+ );
}
public function testExternalLinks()
{
- $this->assertSame('cnn.com
',
- $this->parsedown->text('[cnn.com](http://www.cnn.com)'));
- $this->assertSame('google.com
',
- $this->parsedown->text('[google.com](https://www.google.com)'));
- $this->assertSame('complex url
',
- $this->parsedown->text('[complex url](https://github.com/getgrav/grav/issues/new?title=[add-resource]%20New%20Plugin/Theme&body=Hello%20**There**)'));
+ $this->assertSame(
+ 'cnn.com
',
+ $this->parsedown->text('[cnn.com](http://www.cnn.com)')
+ );
+ $this->assertSame(
+ 'google.com
',
+ $this->parsedown->text('[google.com](https://www.google.com)')
+ );
+ $this->assertSame(
+ 'complex url
',
+ $this->parsedown->text('[complex url](https://github.com/getgrav/grav/issues/new?title=[add-resource]%20New%20Plugin/Theme&body=Hello%20**There**)')
+ );
}
public function testExternalLinksSubDir()
{
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('cnn.com
',
- $this->parsedown->text('[cnn.com](http://www.cnn.com)'));
- $this->assertSame('google.com
',
- $this->parsedown->text('[google.com](https://www.google.com)'));
+ $this->assertSame(
+ 'cnn.com
',
+ $this->parsedown->text('[cnn.com](http://www.cnn.com)')
+ );
+ $this->assertSame(
+ 'google.com
',
+ $this->parsedown->text('[google.com](https://www.google.com)')
+ );
}
public function testExternalLinksSubDirAbsoluteUrls()
@@ -348,24 +469,36 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('cnn.com
',
- $this->parsedown->text('[cnn.com](http://www.cnn.com)'));
- $this->assertSame('google.com
',
- $this->parsedown->text('[google.com](https://www.google.com)'));
+ $this->assertSame(
+ 'cnn.com
',
+ $this->parsedown->text('[cnn.com](http://www.cnn.com)')
+ );
+ $this->assertSame(
+ 'google.com
',
+ $this->parsedown->text('[google.com](https://www.google.com)')
+ );
}
public function testAnchorLinksRelativeUrls()
{
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('Current Anchor
',
- $this->parsedown->text('[Current Anchor](#foo)'));
- $this->assertSame('Root Anchor
',
- $this->parsedown->text('[Root Anchor](/#foo)'));
- $this->assertSame('Peer Anchor
',
- $this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
- $this->assertSame('Peer Anchor 2
',
- $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
+ $this->assertSame(
+ 'Current Anchor
',
+ $this->parsedown->text('[Current Anchor](#foo)')
+ );
+ $this->assertSame(
+ 'Root Anchor
',
+ $this->parsedown->text('[Root Anchor](/#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor
',
+ $this->parsedown->text('[Peer Anchor](../item2-1#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor 2
',
+ $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)')
+ );
}
public function testAnchorLinksAbsoluteUrls()
@@ -373,14 +506,22 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('Current Anchor
',
- $this->parsedown->text('[Current Anchor](#foo)'));
- $this->assertSame('Peer Anchor
',
- $this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
- $this->assertSame('Peer Anchor 2
',
- $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
- $this->assertSame('Root Anchor
',
- $this->parsedown->text('[Root Anchor](/#foo)'));
+ $this->assertSame(
+ 'Current Anchor
',
+ $this->parsedown->text('[Current Anchor](#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor
',
+ $this->parsedown->text('[Peer Anchor](../item2-1#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor 2
',
+ $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)')
+ );
+ $this->assertSame(
+ 'Root Anchor
',
+ $this->parsedown->text('[Root Anchor](/#foo)')
+ );
}
public function testAnchorLinksWithPortAbsoluteUrls()
@@ -388,28 +529,44 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithURL('http://testing.dev:8080/item2/item2-2')->init();
- $this->assertSame('Peer Anchor
',
- $this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
- $this->assertSame('Peer Anchor 2
',
- $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
- $this->assertSame('Current Anchor
',
- $this->parsedown->text('[Current Anchor](#foo)'));
- $this->assertSame('Root Anchor
',
- $this->parsedown->text('[Root Anchor](/#foo)'));
+ $this->assertSame(
+ 'Peer Anchor
',
+ $this->parsedown->text('[Peer Anchor](../item2-1#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor 2
',
+ $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)')
+ );
+ $this->assertSame(
+ 'Current Anchor
',
+ $this->parsedown->text('[Current Anchor](#foo)')
+ );
+ $this->assertSame(
+ 'Root Anchor
',
+ $this->parsedown->text('[Root Anchor](/#foo)')
+ );
}
public function testAnchorLinksSubDirRelativeUrls()
{
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('Peer Anchor
',
- $this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
- $this->assertSame('Peer Anchor 2
',
- $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
- $this->assertSame('Current Anchor
',
- $this->parsedown->text('[Current Anchor](#foo)'));
- $this->assertSame('Root Anchor
',
- $this->parsedown->text('[Root Anchor](/#foo)'));
+ $this->assertSame(
+ 'Peer Anchor
',
+ $this->parsedown->text('[Peer Anchor](../item2-1#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor 2
',
+ $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)')
+ );
+ $this->assertSame(
+ 'Current Anchor
',
+ $this->parsedown->text('[Current Anchor](#foo)')
+ );
+ $this->assertSame(
+ 'Root Anchor
',
+ $this->parsedown->text('[Root Anchor](/#foo)')
+ );
}
public function testAnchorLinksSubDirAbsoluteUrls()
@@ -417,40 +574,68 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('Peer Anchor
',
- $this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
- $this->assertSame('Peer Anchor 2
',
- $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
- $this->assertSame('Current Anchor
',
- $this->parsedown->text('[Current Anchor](#foo)'));
- $this->assertSame('Root Anchor
',
- $this->parsedown->text('[Root Anchor](/#foo)'));
+ $this->assertSame(
+ 'Peer Anchor
',
+ $this->parsedown->text('[Peer Anchor](../item2-1#foo)')
+ );
+ $this->assertSame(
+ 'Peer Anchor 2
',
+ $this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)')
+ );
+ $this->assertSame(
+ 'Current Anchor
',
+ $this->parsedown->text('[Current Anchor](#foo)')
+ );
+ $this->assertSame(
+ 'Root Anchor
',
+ $this->parsedown->text('[Root Anchor](/#foo)')
+ );
}
public function testSlugRelativeLinks()
{
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('Up to Root Level
',
- $this->parsedown->text('[Up to Root Level](../..)'));
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](../item2-1)'));
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](item2-2-1)'));
- $this->assertSame('Up a Level
',
- $this->parsedown->text('[Up a Level](..)'));
- $this->assertSame('Up and Down
',
- $this->parsedown->text('[Up and Down](../../item3/item3-3)'));
- $this->assertSame('Down a Level with Query
',
- $this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)'));
- $this->assertSame('Up a Level with Query
',
- $this->parsedown->text('[Up a Level with Query](../?foo=bar)'));
- $this->assertSame('Up and Down with Query
',
- $this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)'));
- $this->assertSame('Up and Down with Param
',
- $this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)'));
- $this->assertSame('Up and Down with Anchor
',
- $this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)'));
+ $this->assertSame(
+ 'Up to Root Level
',
+ $this->parsedown->text('[Up to Root Level](../..)')
+ );
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](../item2-1)')
+ );
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](item2-2-1)')
+ );
+ $this->assertSame(
+ 'Up a Level
',
+ $this->parsedown->text('[Up a Level](..)')
+ );
+ $this->assertSame(
+ 'Up and Down
',
+ $this->parsedown->text('[Up and Down](../../item3/item3-3)')
+ );
+ $this->assertSame(
+ 'Down a Level with Query
',
+ $this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up a Level with Query
',
+ $this->parsedown->text('[Up a Level with Query](../?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Query
',
+ $this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Param
',
+ $this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Anchor
',
+ $this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)')
+ );
}
public function testSlugRelativeLinksAbsoluteUrls()
@@ -458,52 +643,92 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](../item2-1)'));
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](item2-2-1)'));
- $this->assertSame('Up a Level
',
- $this->parsedown->text('[Up a Level](..)'));
- $this->assertSame('Up to Root Level
',
- $this->parsedown->text('[Up to Root Level](../..)'));
- $this->assertSame('Up and Down
',
- $this->parsedown->text('[Up and Down](../../item3/item3-3)'));
- $this->assertSame('Down a Level with Query
',
- $this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)'));
- $this->assertSame('Up a Level with Query
',
- $this->parsedown->text('[Up a Level with Query](../?foo=bar)'));
- $this->assertSame('Up and Down with Query
',
- $this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)'));
- $this->assertSame('Up and Down with Param
',
- $this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)'));
- $this->assertSame('Up and Down with Anchor
',
- $this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)'));
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](../item2-1)')
+ );
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](item2-2-1)')
+ );
+ $this->assertSame(
+ 'Up a Level
',
+ $this->parsedown->text('[Up a Level](..)')
+ );
+ $this->assertSame(
+ 'Up to Root Level
',
+ $this->parsedown->text('[Up to Root Level](../..)')
+ );
+ $this->assertSame(
+ 'Up and Down
',
+ $this->parsedown->text('[Up and Down](../../item3/item3-3)')
+ );
+ $this->assertSame(
+ 'Down a Level with Query
',
+ $this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up a Level with Query
',
+ $this->parsedown->text('[Up a Level with Query](../?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Query
',
+ $this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Param
',
+ $this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Anchor
',
+ $this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)')
+ );
}
public function testSlugRelativeLinksSubDir()
{
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](../item2-1)'));
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](item2-2-1)'));
- $this->assertSame('Up a Level
',
- $this->parsedown->text('[Up a Level](..)'));
- $this->assertSame('Up to Root Level
',
- $this->parsedown->text('[Up to Root Level](../..)'));
- $this->assertSame('Up and Down
',
- $this->parsedown->text('[Up and Down](../../item3/item3-3)'));
- $this->assertSame('Down a Level with Query
',
- $this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)'));
- $this->assertSame('Up a Level with Query
',
- $this->parsedown->text('[Up a Level with Query](../?foo=bar)'));
- $this->assertSame('Up and Down with Query
',
- $this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)'));
- $this->assertSame('Up and Down with Param
',
- $this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)'));
- $this->assertSame('Up and Down with Anchor
',
- $this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)'));
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](../item2-1)')
+ );
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](item2-2-1)')
+ );
+ $this->assertSame(
+ 'Up a Level
',
+ $this->parsedown->text('[Up a Level](..)')
+ );
+ $this->assertSame(
+ 'Up to Root Level
',
+ $this->parsedown->text('[Up to Root Level](../..)')
+ );
+ $this->assertSame(
+ 'Up and Down
',
+ $this->parsedown->text('[Up and Down](../../item3/item3-3)')
+ );
+ $this->assertSame(
+ 'Down a Level with Query
',
+ $this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up a Level with Query
',
+ $this->parsedown->text('[Up a Level with Query](../?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Query
',
+ $this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Param
',
+ $this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Anchor
',
+ $this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)')
+ );
}
public function testSlugRelativeLinksSubDirAbsoluteUrls()
@@ -511,26 +736,46 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](../item2-1)'));
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](item2-2-1)'));
- $this->assertSame('Up a Level
',
- $this->parsedown->text('[Up a Level](..)'));
- $this->assertSame('Up to Root Level
',
- $this->parsedown->text('[Up to Root Level](../..)'));
- $this->assertSame('Up and Down
',
- $this->parsedown->text('[Up and Down](../../item3/item3-3)'));
- $this->assertSame('Down a Level with Query
',
- $this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)'));
- $this->assertSame('Up a Level with Query
',
- $this->parsedown->text('[Up a Level with Query](../?foo=bar)'));
- $this->assertSame('Up and Down with Query
',
- $this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)'));
- $this->assertSame('Up and Down with Param
',
- $this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)'));
- $this->assertSame('Up and Down with Anchor
',
- $this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)'));
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](../item2-1)')
+ );
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](item2-2-1)')
+ );
+ $this->assertSame(
+ 'Up a Level
',
+ $this->parsedown->text('[Up a Level](..)')
+ );
+ $this->assertSame(
+ 'Up to Root Level
',
+ $this->parsedown->text('[Up to Root Level](../..)')
+ );
+ $this->assertSame(
+ 'Up and Down
',
+ $this->parsedown->text('[Up and Down](../../item3/item3-3)')
+ );
+ $this->assertSame(
+ 'Down a Level with Query
',
+ $this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up a Level with Query
',
+ $this->parsedown->text('[Up a Level with Query](../?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Query
',
+ $this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Param
',
+ $this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Anchor
',
+ $this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)')
+ );
}
@@ -538,20 +783,34 @@ class ParsedownTest extends \Codeception\TestCase\Test
{
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('Up and Down with Param
',
- $this->parsedown->text('[Up and Down with Param](../../03.item3/03.item3-3/foo:bar)'));
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](../01.item2-1)'));
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](01.item2-2-1)'));
- $this->assertSame('Up and Down
',
- $this->parsedown->text('[Up and Down](../../03.item3/03.item3-3)'));
- $this->assertSame('Down a Level with Query
',
- $this->parsedown->text('[Down a Level with Query](01.item2-2-1?foo=bar)'));
- $this->assertSame('Up and Down with Query
',
- $this->parsedown->text('[Up and Down with Query](../../03.item3/03.item3-3?foo=bar)'));
- $this->assertSame('Up and Down with Anchor
',
- $this->parsedown->text('[Up and Down with Anchor](../../03.item3/03.item3-3#foo)'));
+ $this->assertSame(
+ 'Up and Down with Param
',
+ $this->parsedown->text('[Up and Down with Param](../../03.item3/03.item3-3/foo:bar)')
+ );
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](../01.item2-1)')
+ );
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](01.item2-2-1)')
+ );
+ $this->assertSame(
+ 'Up and Down
',
+ $this->parsedown->text('[Up and Down](../../03.item3/03.item3-3)')
+ );
+ $this->assertSame(
+ 'Down a Level with Query
',
+ $this->parsedown->text('[Down a Level with Query](01.item2-2-1?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Query
',
+ $this->parsedown->text('[Up and Down with Query](../../03.item3/03.item3-3?foo=bar)')
+ );
+ $this->assertSame(
+ 'Up and Down with Anchor
',
+ $this->parsedown->text('[Up and Down with Anchor](../../03.item3/03.item3-3#foo)')
+ );
}
@@ -559,40 +818,68 @@ class ParsedownTest extends \Codeception\TestCase\Test
{
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('Root
',
- $this->parsedown->text('[Root](/)'));
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](/item2/item2-1)'));
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](/item2/item2-2/item2-2-1)'));
- $this->assertSame('Up a Level
',
- $this->parsedown->text('[Up a Level](/item2)'));
- $this->assertSame('With Query
',
- $this->parsedown->text('[With Query](/item2?foo=bar)'));
- $this->assertSame('With Param
',
- $this->parsedown->text('[With Param](/item2/foo:bar)'));
- $this->assertSame('With Anchor
',
- $this->parsedown->text('[With Anchor](/item2#foo)'));
+ $this->assertSame(
+ 'Root
',
+ $this->parsedown->text('[Root](/)')
+ );
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](/item2/item2-1)')
+ );
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](/item2/item2-2/item2-2-1)')
+ );
+ $this->assertSame(
+ 'Up a Level
',
+ $this->parsedown->text('[Up a Level](/item2)')
+ );
+ $this->assertSame(
+ 'With Query
',
+ $this->parsedown->text('[With Query](/item2?foo=bar)')
+ );
+ $this->assertSame(
+ 'With Param
',
+ $this->parsedown->text('[With Param](/item2/foo:bar)')
+ );
+ $this->assertSame(
+ 'With Anchor
',
+ $this->parsedown->text('[With Anchor](/item2#foo)')
+ );
}
public function testDirectoryAbsoluteLinksSubDir()
{
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('Root
',
- $this->parsedown->text('[Root](/)'));
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](/item2/item2-1)'));
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](/item2/item2-2/item2-2-1)'));
- $this->assertSame('Up a Level
',
- $this->parsedown->text('[Up a Level](/item2)'));
- $this->assertSame('With Query
',
- $this->parsedown->text('[With Query](/item2?foo=bar)'));
- $this->assertSame('With Param
',
- $this->parsedown->text('[With Param](/item2/foo:bar)'));
- $this->assertSame('With Anchor
',
- $this->parsedown->text('[With Anchor](/item2#foo)'));
+ $this->assertSame(
+ 'Root
',
+ $this->parsedown->text('[Root](/)')
+ );
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](/item2/item2-1)')
+ );
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](/item2/item2-2/item2-2-1)')
+ );
+ $this->assertSame(
+ 'Up a Level
',
+ $this->parsedown->text('[Up a Level](/item2)')
+ );
+ $this->assertSame(
+ 'With Query
',
+ $this->parsedown->text('[With Query](/item2?foo=bar)')
+ );
+ $this->assertSame(
+ 'With Param
',
+ $this->parsedown->text('[With Param](/item2/foo:bar)')
+ );
+ $this->assertSame(
+ 'With Anchor
',
+ $this->parsedown->text('[With Anchor](/item2#foo)')
+ );
}
public function testDirectoryAbsoluteLinksSubDirAbsoluteUrl()
@@ -600,52 +887,86 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('Root
',
- $this->parsedown->text('[Root](/)'));
- $this->assertSame('Peer Page
',
- $this->parsedown->text('[Peer Page](/item2/item2-1)'));
- $this->assertSame('Down a Level
',
- $this->parsedown->text('[Down a Level](/item2/item2-2/item2-2-1)'));
- $this->assertSame('Up a Level
',
- $this->parsedown->text('[Up a Level](/item2)'));
- $this->assertSame('With Query
',
- $this->parsedown->text('[With Query](/item2?foo=bar)'));
- $this->assertSame('With Param
',
- $this->parsedown->text('[With Param](/item2/foo:bar)'));
- $this->assertSame('With Anchor
',
- $this->parsedown->text('[With Anchor](/item2#foo)'));
+ $this->assertSame(
+ 'Root
',
+ $this->parsedown->text('[Root](/)')
+ );
+ $this->assertSame(
+ 'Peer Page
',
+ $this->parsedown->text('[Peer Page](/item2/item2-1)')
+ );
+ $this->assertSame(
+ 'Down a Level
',
+ $this->parsedown->text('[Down a Level](/item2/item2-2/item2-2-1)')
+ );
+ $this->assertSame(
+ 'Up a Level
',
+ $this->parsedown->text('[Up a Level](/item2)')
+ );
+ $this->assertSame(
+ 'With Query
',
+ $this->parsedown->text('[With Query](/item2?foo=bar)')
+ );
+ $this->assertSame(
+ 'With Param
',
+ $this->parsedown->text('[With Param](/item2/foo:bar)')
+ );
+ $this->assertSame(
+ 'With Anchor
',
+ $this->parsedown->text('[With Anchor](/item2#foo)')
+ );
}
public function testSpecialProtocols()
{
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('mailto
',
- $this->parsedown->text('[mailto](mailto:user@domain.com)'));
- $this->assertSame('xmpp
',
- $this->parsedown->text('[xmpp](xmpp:xyx@domain.com)'));
- $this->assertSame('tel
',
- $this->parsedown->text('[tel](tel:123-555-12345)'));
- $this->assertSame('sms
',
- $this->parsedown->text('[sms](sms:123-555-12345)'));
- $this->assertSame('ts.example.com
',
- $this->parsedown->text('[ts.example.com](rdp://ts.example.com)'));
+ $this->assertSame(
+ 'mailto
',
+ $this->parsedown->text('[mailto](mailto:user@domain.com)')
+ );
+ $this->assertSame(
+ 'xmpp
',
+ $this->parsedown->text('[xmpp](xmpp:xyx@domain.com)')
+ );
+ $this->assertSame(
+ 'tel
',
+ $this->parsedown->text('[tel](tel:123-555-12345)')
+ );
+ $this->assertSame(
+ 'sms
',
+ $this->parsedown->text('[sms](sms:123-555-12345)')
+ );
+ $this->assertSame(
+ 'ts.example.com
',
+ $this->parsedown->text('[ts.example.com](rdp://ts.example.com)')
+ );
}
public function testSpecialProtocolsSubDir()
{
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('mailto
',
- $this->parsedown->text('[mailto](mailto:user@domain.com)'));
- $this->assertSame('xmpp
',
- $this->parsedown->text('[xmpp](xmpp:xyx@domain.com)'));
- $this->assertSame('tel
',
- $this->parsedown->text('[tel](tel:123-555-12345)'));
- $this->assertSame('sms
',
- $this->parsedown->text('[sms](sms:123-555-12345)'));
- $this->assertSame('ts.example.com
',
- $this->parsedown->text('[ts.example.com](rdp://ts.example.com)'));
+ $this->assertSame(
+ 'mailto
',
+ $this->parsedown->text('[mailto](mailto:user@domain.com)')
+ );
+ $this->assertSame(
+ 'xmpp
',
+ $this->parsedown->text('[xmpp](xmpp:xyx@domain.com)')
+ );
+ $this->assertSame(
+ 'tel
',
+ $this->parsedown->text('[tel](tel:123-555-12345)')
+ );
+ $this->assertSame(
+ 'sms
',
+ $this->parsedown->text('[sms](sms:123-555-12345)')
+ );
+ $this->assertSame(
+ 'ts.example.com
',
+ $this->parsedown->text('[ts.example.com](rdp://ts.example.com)')
+ );
}
public function testSpecialProtocolsSubDirAbsoluteUrl()
@@ -653,16 +974,26 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('mailto
',
- $this->parsedown->text('[mailto](mailto:user@domain.com)'));
- $this->assertSame('xmpp
',
- $this->parsedown->text('[xmpp](xmpp:xyx@domain.com)'));
- $this->assertSame('tel
',
- $this->parsedown->text('[tel](tel:123-555-12345)'));
- $this->assertSame('sms
',
- $this->parsedown->text('[sms](sms:123-555-12345)'));
- $this->assertSame('ts.example.com
',
- $this->parsedown->text('[ts.example.com](rdp://ts.example.com)'));
+ $this->assertSame(
+ 'mailto
',
+ $this->parsedown->text('[mailto](mailto:user@domain.com)')
+ );
+ $this->assertSame(
+ 'xmpp
',
+ $this->parsedown->text('[xmpp](xmpp:xyx@domain.com)')
+ );
+ $this->assertSame(
+ 'tel
',
+ $this->parsedown->text('[tel](tel:123-555-12345)')
+ );
+ $this->assertSame(
+ 'sms
',
+ $this->parsedown->text('[sms](sms:123-555-12345)')
+ );
+ $this->assertSame(
+ 'ts.example.com
',
+ $this->parsedown->text('[ts.example.com](rdp://ts.example.com)')
+ );
}
public function testReferenceLinks()
@@ -671,64 +1002,98 @@ class ParsedownTest extends \Codeception\TestCase\Test
$sample = '[relative link][r_relative]
[r_relative]: ../item2-3#blah';
- $this->assertSame('relative link
',
- $this->parsedown->text($sample));
+ $this->assertSame(
+ 'relative link
',
+ $this->parsedown->text($sample)
+ );
$sample = '[absolute link][r_absolute]
[r_absolute]: /item3#blah';
- $this->assertSame('absolute link
',
- $this->parsedown->text($sample));
+ $this->assertSame(
+ 'absolute link
',
+ $this->parsedown->text($sample)
+ );
$sample = '[external link][r_external]
[r_external]: http://www.cnn.com';
- $this->assertSame('external link
',
- $this->parsedown->text($sample));
+ $this->assertSame(
+ 'external link
',
+ $this->parsedown->text($sample)
+ );
}
public function testAttributeLinks()
{
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('Anchor Class
',
- $this->parsedown->text('[Anchor Class](?classes=button#something)'));
- $this->assertSame('Relative Class
',
- $this->parsedown->text('[Relative Class](../item2-3?classes=button)'));
- $this->assertSame('Relative ID
',
- $this->parsedown->text('[Relative ID](../item2-3?id=unique)'));
- $this->assertSame('External
',
- $this->parsedown->text('[External](https://github.com/getgrav/grav?classes=button,big)'));
- $this->assertSame('Relative Noprocess
',
- $this->parsedown->text('[Relative Noprocess](../item2-3?id=unique&noprocess)'));
- $this->assertSame('Relative Target
',
- $this->parsedown->text('[Relative Target](../item2-3?target=_blank)'));
- $this->assertSame('Relative Rel
',
- $this->parsedown->text('[Relative Rel](../item2-3?rel=nofollow)'));
- $this->assertSame('Relative Mixed
',
- $this->parsedown->text('[Relative Mixed](../item2-3?foo=bar&baz=qux&rel=nofollow&class=button)'));
+ $this->assertSame(
+ 'Anchor Class
',
+ $this->parsedown->text('[Anchor Class](?classes=button#something)')
+ );
+ $this->assertSame(
+ 'Relative Class
',
+ $this->parsedown->text('[Relative Class](../item2-3?classes=button)')
+ );
+ $this->assertSame(
+ 'Relative ID
',
+ $this->parsedown->text('[Relative ID](../item2-3?id=unique)')
+ );
+ $this->assertSame(
+ 'External
',
+ $this->parsedown->text('[External](https://github.com/getgrav/grav?classes=button,big)')
+ );
+ $this->assertSame(
+ 'Relative Noprocess
',
+ $this->parsedown->text('[Relative Noprocess](../item2-3?id=unique&noprocess)')
+ );
+ $this->assertSame(
+ 'Relative Target
',
+ $this->parsedown->text('[Relative Target](../item2-3?target=_blank)')
+ );
+ $this->assertSame(
+ 'Relative Rel
',
+ $this->parsedown->text('[Relative Rel](../item2-3?rel=nofollow)')
+ );
+ $this->assertSame(
+ 'Relative Mixed
',
+ $this->parsedown->text('[Relative Mixed](../item2-3?foo=bar&baz=qux&rel=nofollow&class=button)')
+ );
}
public function testInvalidLinks()
{
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
- $this->assertSame('Non Existent Page
',
- $this->parsedown->text('[Non Existent Page](no-page)'));
- $this->assertSame('Existent File
',
- $this->parsedown->text('[Existent File](existing-file.zip)'));
- $this->assertSame('Non Existent File
',
- $this->parsedown->text('[Non Existent File](missing-file.zip)'));
+ $this->assertSame(
+ 'Non Existent Page
',
+ $this->parsedown->text('[Non Existent Page](no-page)')
+ );
+ $this->assertSame(
+ 'Existent File
',
+ $this->parsedown->text('[Existent File](existing-file.zip)')
+ );
+ $this->assertSame(
+ 'Non Existent File
',
+ $this->parsedown->text('[Non Existent File](missing-file.zip)')
+ );
}
public function testInvalidLinksSubDir()
{
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('Non Existent Page
',
- $this->parsedown->text('[Non Existent Page](no-page)'));
- $this->assertSame('Existent File
',
- $this->parsedown->text('[Existent File](existing-file.zip)'));
- $this->assertSame('Non Existent File
',
- $this->parsedown->text('[Non Existent File](missing-file.zip)'));
+ $this->assertSame(
+ 'Non Existent Page
',
+ $this->parsedown->text('[Non Existent Page](no-page)')
+ );
+ $this->assertSame(
+ 'Existent File
',
+ $this->parsedown->text('[Existent File](existing-file.zip)')
+ );
+ $this->assertSame(
+ 'Non Existent File
',
+ $this->parsedown->text('[Non Existent File](missing-file.zip)')
+ );
}
public function testInvalidLinksSubDirAbsoluteUrl()
@@ -736,12 +1101,18 @@ class ParsedownTest extends \Codeception\TestCase\Test
$this->config->set('system.absolute_urls', true);
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
- $this->assertSame('Non Existent Page
',
- $this->parsedown->text('[Non Existent Page](no-page)'));
- $this->assertSame('Existent File
',
- $this->parsedown->text('[Existent File](existing-file.zip)'));
- $this->assertSame('Non Existent File
',
- $this->parsedown->text('[Non Existent File](missing-file.zip)'));
+ $this->assertSame(
+ 'Non Existent Page
',
+ $this->parsedown->text('[Non Existent Page](no-page)')
+ );
+ $this->assertSame(
+ 'Existent File
',
+ $this->parsedown->text('[Existent File](existing-file.zip)')
+ );
+ $this->assertSame(
+ 'Non Existent File
',
+ $this->parsedown->text('[Non Existent File](missing-file.zip)')
+ );
}
@@ -754,5 +1125,4 @@ class ParsedownTest extends \Codeception\TestCase\Test
{
return preg_replace('/^\s*(.*)/', '', $string);
}
-
}
diff --git a/tests/unit/Grav/Common/Page/PagesTest.php b/tests/unit/Grav/Common/Page/PagesTest.php
index 4de75fb42..b03a04a37 100644
--- a/tests/unit/Grav/Common/Page/PagesTest.php
+++ b/tests/unit/Grav/Common/Page/PagesTest.php
@@ -54,7 +54,7 @@ class PagesTest extends \Codeception\TestCase\Test
public function testInstances()
{
$this->assertInternalType('array', $this->pages->instances());
- foreach($this->pages->instances() as $instance) {
+ foreach ($this->pages->instances() as $instance) {
$this->assertInstanceOf(PageInterface::class, $instance);
}
}
@@ -219,14 +219,13 @@ class PagesTest extends \Codeception\TestCase\Test
public function testBlueprints()
{
-
}
public function testAll()
{
$this->assertInternalType('object', $this->pages->all());
$this->assertInternalType('array', $this->pages->all()->toArray());
- foreach($this->pages->all() as $page) {
+ foreach ($this->pages->all() as $page) {
$this->assertInstanceOf(PageInterface::class, $page);
}
}
@@ -241,47 +240,37 @@ class PagesTest extends \Codeception\TestCase\Test
public function testGetTypes()
{
-
}
public function testTypes()
{
-
}
public function testModularTypes()
{
-
}
public function testPageTypes()
{
-
}
public function testAccessLevels()
{
-
}
public function testParents()
{
-
}
public function testParentsRawRoutes()
{
-
}
public function testGetHomeRoute()
{
-
}
public function testResetPages()
{
-
}
-
}
diff --git a/tests/unit/Grav/Common/Twig/TwigExtensionTest.php b/tests/unit/Grav/Common/Twig/TwigExtensionTest.php
index 56181f994..9777fd91e 100644
--- a/tests/unit/Grav/Common/Twig/TwigExtensionTest.php
+++ b/tests/unit/Grav/Common/Twig/TwigExtensionTest.php
@@ -23,21 +23,21 @@ class TwigExtensionTest extends \Codeception\TestCase\Test
public function testInflectorFilter()
{
- $this->assertSame('people', $this->twig_ext->inflectorFilter('plural', 'person'));
- $this->assertSame('shoe', $this->twig_ext->inflectorFilter('singular', 'shoes'));
- $this->assertSame('Welcome Page', $this->twig_ext->inflectorFilter('title', 'welcome page'));
- $this->assertSame('SendEmail', $this->twig_ext->inflectorFilter('camel', 'send_email'));
- $this->assertSame('camel_cased', $this->twig_ext->inflectorFilter('underscor', 'CamelCased'));
- $this->assertSame('something-text', $this->twig_ext->inflectorFilter('hyphen', 'Something Text'));
- $this->assertSame('Something text to read', $this->twig_ext->inflectorFilter('human', 'something_text_to_read'));
- $this->assertSame(5, $this->twig_ext->inflectorFilter('month', 175));
- $this->assertSame('10th', $this->twig_ext->inflectorFilter('ordinal', 10));
+ $this->assertSame('people', $this->twig_ext->inflectorFilter('plural', 'person'));
+ $this->assertSame('shoe', $this->twig_ext->inflectorFilter('singular', 'shoes'));
+ $this->assertSame('Welcome Page', $this->twig_ext->inflectorFilter('title', 'welcome page'));
+ $this->assertSame('SendEmail', $this->twig_ext->inflectorFilter('camel', 'send_email'));
+ $this->assertSame('camel_cased', $this->twig_ext->inflectorFilter('underscor', 'CamelCased'));
+ $this->assertSame('something-text', $this->twig_ext->inflectorFilter('hyphen', 'Something Text'));
+ $this->assertSame('Something text to read', $this->twig_ext->inflectorFilter('human', 'something_text_to_read'));
+ $this->assertSame(5, $this->twig_ext->inflectorFilter('month', 175));
+ $this->assertSame('10th', $this->twig_ext->inflectorFilter('ordinal', 10));
}
public function testMd5Filter()
{
- $this->assertSame(md5('grav'), $this->twig_ext->md5Filter('grav'));
- $this->assertSame(md5('devs@getgrav.org'), $this->twig_ext->md5Filter('devs@getgrav.org'));
+ $this->assertSame(md5('grav'), $this->twig_ext->md5Filter('grav'));
+ $this->assertSame(md5('devs@getgrav.org'), $this->twig_ext->md5Filter('devs@getgrav.org'));
}
public function testKsortFilter()
@@ -48,8 +48,8 @@ class TwigExtensionTest extends \Codeception\TestCase\Test
public function testContainsFilter()
{
- $this->assertTrue($this->twig_ext->containsFilter('grav','grav'));
- $this->assertTrue($this->twig_ext->containsFilter('So, I found this new cms, called grav, and it\'s pretty awesome guys','grav'));
+ $this->assertTrue($this->twig_ext->containsFilter('grav', 'grav'));
+ $this->assertTrue($this->twig_ext->containsFilter('So, I found this new cms, called grav, and it\'s pretty awesome guys', 'grav'));
}
public function testNicetimeFilter()
@@ -73,121 +73,115 @@ class TwigExtensionTest extends \Codeception\TestCase\Test
public function testRandomizeFilter()
{
$array = [1,2,3,4,5];
- $this->assertContains(2, $this->twig_ext->randomizeFilter($array));
- $this->assertSame($array, $this->twig_ext->randomizeFilter($array, 5));
- $this->assertSame($array[0], $this->twig_ext->randomizeFilter($array, 1)[0]);
- $this->assertSame($array[3], $this->twig_ext->randomizeFilter($array, 4)[3]);
- $this->assertSame($array[1], $this->twig_ext->randomizeFilter($array, 4)[1]);
+ $this->assertContains(2, $this->twig_ext->randomizeFilter($array));
+ $this->assertSame($array, $this->twig_ext->randomizeFilter($array, 5));
+ $this->assertSame($array[0], $this->twig_ext->randomizeFilter($array, 1)[0]);
+ $this->assertSame($array[3], $this->twig_ext->randomizeFilter($array, 4)[3]);
+ $this->assertSame($array[1], $this->twig_ext->randomizeFilter($array, 4)[1]);
}
public function testModulusFilter()
{
- $this->assertSame(3, $this->twig_ext->modulusFilter(3,4));
- $this->assertSame(1, $this->twig_ext->modulusFilter(11,2));
- $this->assertSame(0, $this->twig_ext->modulusFilter(10,2));
- $this->assertSame(2, $this->twig_ext->modulusFilter(10,4));
+ $this->assertSame(3, $this->twig_ext->modulusFilter(3, 4));
+ $this->assertSame(1, $this->twig_ext->modulusFilter(11, 2));
+ $this->assertSame(0, $this->twig_ext->modulusFilter(10, 2));
+ $this->assertSame(2, $this->twig_ext->modulusFilter(10, 4));
}
public function testAbsoluteUrlFilter()
{
-
}
public function testMarkdownFilter()
{
-
}
public function testStartsWithFilter()
{
-
}
public function testEndsWithFilter()
{
-
}
public function testDefinedDefaultFilter()
{
-
}
public function testRtrimFilter()
{
-
}
public function testLtrimFilter()
{
-
}
public function testRepeatFunc()
{
-
}
public function testRegexReplace()
{
-
}
public function testUrlFunc()
{
-
}
public function testEvaluateFunc()
{
-
}
public function testDump()
{
-
}
public function testGistFunc()
{
-
}
public function testRandomStringFunc()
{
-
}
public function testPadFilter()
{
-
}
public function testArrayFunc()
{
- $this->assertSame('this is my text',
- $this->twig_ext->regexReplace('this is my text
', '(<\/?p>)', ''));
- $this->assertSame('this is my text ',
- $this->twig_ext->regexReplace('this is my text
', ['()','(<\/p>)'], ['',' ']));
+ $this->assertSame(
+ 'this is my text',
+ $this->twig_ext->regexReplace('
this is my text
', '(<\/?p>)', '')
+ );
+ $this->assertSame(
+ 'this is my text ',
+ $this->twig_ext->regexReplace('this is my text
', ['()','(<\/p>)'], ['',' '])
+ );
}
public function testArrayKeyValue()
{
- $this->assertSame(['meat' => 'steak'],
- $this->twig_ext->arrayKeyValueFunc('meat', 'steak'));
- $this->assertSame(['fruit' => 'apple', 'meat' => 'steak'],
- $this->twig_ext->arrayKeyValueFunc('meat', 'steak', ['fruit' => 'apple']));
+ $this->assertSame(
+ ['meat' => 'steak'],
+ $this->twig_ext->arrayKeyValueFunc('meat', 'steak')
+ );
+ $this->assertSame(
+ ['fruit' => 'apple', 'meat' => 'steak'],
+ $this->twig_ext->arrayKeyValueFunc('meat', 'steak', ['fruit' => 'apple'])
+ );
}
public function stringFunc()
{
-
}
public function testRangeFunc()
{
$hundred = [];
- for($i = 0; $i <= 100; $i++) { $hundred[] = $i; }
+ for ($i = 0; $i <= 100; $i++) {
+ $hundred[] = $i;
+ }
$this->assertSame([0], $this->twig_ext->rangeFunc(0, 0));
diff --git a/tests/unit/Grav/Common/UriTest.php b/tests/unit/Grav/Common/UriTest.php
index 9977d6732..a30c01da8 100644
--- a/tests/unit/Grav/Common/UriTest.php
+++ b/tests/unit/Grav/Common/UriTest.php
@@ -914,7 +914,7 @@ class UriTest extends \Codeception\TestCase\Test
$this->assertTrue($this->uri->validateHostname('goog.wine'));
$this->assertTrue($this->uri->validateHostname('goog.localhost'));
- $this->assertFalse($this->uri->validateHostname('localhost:80') );
+ $this->assertFalse($this->uri->validateHostname('localhost:80'));
$this->assertFalse($this->uri->validateHostname('http://localhost'));
$this->assertFalse($this->uri->validateHostname('localhost!'));
}
@@ -1143,7 +1143,6 @@ class UriTest extends \Codeception\TestCase\Test
public function testConvertUrl()
{
-
}
public function testAddNonce()
diff --git a/tests/unit/Grav/Common/UtilsTest.php b/tests/unit/Grav/Common/UtilsTest.php
index e7862427c..71ffb6f34 100644
--- a/tests/unit/Grav/Common/UtilsTest.php
+++ b/tests/unit/Grav/Common/UtilsTest.php
@@ -32,21 +32,27 @@ class UtilsTest extends \Codeception\TestCase\Test
$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'
+ ));
$this->assertTrue(Utils::startsWith('english', 'En', false));
$this->assertTrue(Utils::startsWith('English', 'EN', false));
$this->assertTrue(Utils::startsWith('ENGLISH', 'en', false));
- $this->assertTrue(Utils::startsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
- 'e', false));
-
+ $this->assertTrue(Utils::startsWith(
+ 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
+ 'e',
+ false
+ ));
}
public function testEndsWith()
@@ -54,20 +60,27 @@ 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'
+ ));
$this->assertTrue(Utils::endsWith('english', 'SH', false));
$this->assertTrue(Utils::endsWith('EngliSh', 'sH', false));
$this->assertTrue(Utils::endsWith('ENGLISH', 'sh', false));
- $this->assertTrue(Utils::endsWith('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
- 'english', false));
+ $this->assertTrue(Utils::endsWith(
+ 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
+ 'english',
+ false
+ ));
}
public function testContains()
@@ -75,20 +88,27 @@ 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', 'SCH'));
- $this->assertFalse(Utils::contains('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
- 'DEUSTCH'));
+ $this->assertFalse(Utils::contains(
+ 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
+ 'DEUSTCH'
+ ));
$this->assertTrue(Utils::contains('EngliSh', 'GLI', false));
$this->assertTrue(Utils::contains('EngliSh', 'ENGLISH', false));
$this->assertTrue(Utils::contains('ENGLISH', 'ish', false));
- $this->assertTrue(Utils::contains('ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
- 'english', false));
+ $this->assertTrue(Utils::contains(
+ 'ENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISHENGLISH',
+ 'english',
+ false
+ ));
}
public function testSubstrToString()
@@ -139,7 +159,6 @@ class UtilsTest extends \Codeception\TestCase\Test
$this->assertEquals('This is a string to truncate', Utils::truncate('This is a string to truncate'));
$this->assertEquals('This' . '…', Utils::truncate('This is a string to truncate', 3, true));
$this->assertEquals(' ', 6, true));
-
}
public function testSafeTruncate()
@@ -159,7 +178,7 @@ class UtilsTest extends \Codeception\TestCase\Test
$this->assertEquals('
This is a string to truncate
', Utils::truncateHtml('This is a string to truncate
', 100));
$this->assertEquals(' ', Utils::truncateHtml(' ', 6));
$this->assertEquals('item 1 so... ', Utils::truncateHtml('item 1 something item 2 bold ', 10));
- $this->assertEquals("This is a string.
\nIt splits two lines.
", Utils::truncateHtml("This is a string.
\nIt splits two lines.
", 100));
+ $this->assertEquals("This is a string.
\nIt splits two lines.
", Utils::truncateHtml("This is a string.
\nIt splits two lines.
", 100));
}
public function testSafeTruncateHtml()
@@ -182,7 +201,6 @@ class UtilsTest extends \Codeception\TestCase\Test
public function download()
{
-
}
public function testGetMimeByExtension()
@@ -340,7 +358,7 @@ class UtilsTest extends \Codeception\TestCase\Test
'test1' => 'test1Value'
];
- Utils::setDotNotation($array, 'test.test3.test4' , $new);
+ Utils::setDotNotation($array, 'test.test3.test4', $new);
$this->assertEquals('test1Value', $array['test']['test3']['test4']['test1']);
}
@@ -512,7 +530,6 @@ class UtilsTest extends \Codeception\TestCase\Test
public function testUrlWithStreams()
{
-
}
public function testUrlwithExternals()
diff --git a/tests/unit/Grav/Console/Gpm/InstallCommandTest.php b/tests/unit/Grav/Console/Gpm/InstallCommandTest.php
index e76843b35..da15594b1 100644
--- a/tests/unit/Grav/Console/Gpm/InstallCommandTest.php
+++ b/tests/unit/Grav/Console/Gpm/InstallCommandTest.php
@@ -19,10 +19,9 @@ class InstallCommandTest extends \Codeception\TestCase\Test
{
$this->grav = Fixtures::get('grav');
$this->installCommand = new InstallCommand();
-
}
protected function _after()
{
}
-}
\ No newline at end of file
+}
diff --git a/tests/unit/Grav/Framework/File/Formatter/CsvFormatterTest.php b/tests/unit/Grav/Framework/File/Formatter/CsvFormatterTest.php
index 70a8c9e41..c2b321f25 100644
--- a/tests/unit/Grav/Framework/File/Formatter/CsvFormatterTest.php
+++ b/tests/unit/Grav/Framework/File/Formatter/CsvFormatterTest.php
@@ -17,7 +17,6 @@ class CsvFormatterTest extends \Codeception\TestCase\Test
self::assertCount(3, $lines);
self::assertEquals('col1,col2,col3', $lines[0]);
-
}
/**
@@ -43,5 +42,4 @@ class CsvFormatterTest extends \Codeception\TestCase\Test
$encoded = (new CsvFormatter())->encode([]);
self::assertEquals('', $encoded);
}
-
}
diff --git a/tests/unit/_bootstrap.php b/tests/unit/_bootstrap.php
index f92ef0c09..5a76515f7 100644
--- a/tests/unit/_bootstrap.php
+++ b/tests/unit/_bootstrap.php
@@ -1,4 +1,3 @@