From 1c8298d2ec681b0d7f8f5cbd38d5f3763149a130 Mon Sep 17 00:00:00 2001
From: Alain Schlesser
Date: Fri, 4 Jan 2019 13:17:03 +0100
Subject: [PATCH] Switch to PHPUnit v6+ and add basic tests
---
.gitignore | 3 +-
composer.json | 8 +-
composer.lock | 1531 ------------------------
phpcs.xml | 13 -
phpunit.xml | 20 -
phpunit.xml.dist | 23 +
src/Shortcode.php | 7 +-
src/TemplatedShortcode.php | 7 +-
tests/BootstrapListener.php | 36 +
tests/bootstrap.php | 17 +
tests/fixtures/some_dynamic_view.php | 1 +
tests/fixtures/some_static_view.html | 1 +
tests/unit/ShortcodeAttsParserTest.php | 21 +
tests/unit/ShortcodeManagerTest.php | 23 +
tests/unit/ShortcodeTest.php | 36 +
tests/unit/ShortcodeUITest.php | 18 +
tests/unit/TemplatedShortcodeTest.php | 23 +
17 files changed, 212 insertions(+), 1576 deletions(-)
delete mode 100644 composer.lock
delete mode 100644 phpcs.xml
delete mode 100644 phpunit.xml
create mode 100644 phpunit.xml.dist
create mode 100644 tests/BootstrapListener.php
create mode 100644 tests/bootstrap.php
create mode 100644 tests/fixtures/some_dynamic_view.php
create mode 100644 tests/fixtures/some_static_view.html
create mode 100644 tests/unit/ShortcodeAttsParserTest.php
create mode 100644 tests/unit/ShortcodeManagerTest.php
create mode 100644 tests/unit/ShortcodeTest.php
create mode 100644 tests/unit/ShortcodeUITest.php
create mode 100644 tests/unit/TemplatedShortcodeTest.php
diff --git a/.gitignore b/.gitignore
index a725465..d1502b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-vendor/
\ No newline at end of file
+vendor/
+composer.lock
diff --git a/composer.json b/composer.json
index b26e5e8..da04638 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,6 @@
{
"name": "brightnucleus/shortcodes",
"description": "Config-driven WordPress shortcodes.",
- "require-dev": {
- "phpunit/phpunit": "~4",
- "squizlabs/php_codesniffer": "~2.5",
- "wp-coding-standards/wpcs": "dev-master"
- },
"license": "MIT",
"authors": [
{
@@ -21,6 +16,9 @@
"gamajo/template-loader": ">=1.2",
"brightnucleus/invoker": ">=0.2.0"
},
+ "require-dev": {
+ "phpunit/phpunit": "~6"
+ },
"autoload": {
"psr-4": {
"BrightNucleus\\Shortcode\\": "src/"
diff --git a/composer.lock b/composer.lock
deleted file mode 100644
index 7d339a6..0000000
--- a/composer.lock
+++ /dev/null
@@ -1,1531 +0,0 @@
-{
- "_readme": [
- "This file locks the dependencies of your project to a known state",
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
- "This file is @generated automatically"
- ],
- "hash": "317d00b6b7fa4a6196e31f0aeed538d3",
- "content-hash": "1da289f889be89dd81af7b0ca9008d5f",
- "packages": [
- {
- "name": "brightnucleus/config",
- "version": "v0.4.7",
- "source": {
- "type": "git",
- "url": "https://github.com/brightnucleus/config.git",
- "reference": "c15e27d302e4025e454252858462a1ba2a6ed5f6"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/brightnucleus/config/zipball/c15e27d302e4025e454252858462a1ba2a6ed5f6",
- "reference": "c15e27d302e4025e454252858462a1ba2a6ed5f6",
- "shasum": ""
- },
- "require": {
- "brightnucleus/exceptions": ">=0.2",
- "symfony/options-resolver": ">=2.8"
- },
- "require-dev": {
- "mikey179/vfsstream": "^1.6",
- "php-composter/php-composter-phpcs-psr2": "^0.2.0",
- "phpunit/phpunit": "~4"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "BrightNucleus\\Config\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Alain Schlesser",
- "email": "alain.schlesser@gmail.com"
- }
- ],
- "description": "Minimal, reusable Config component.",
- "time": "2016-07-22 13:10:05"
- },
- {
- "name": "brightnucleus/contracts",
- "version": "v0.1.1",
- "source": {
- "type": "git",
- "url": "https://github.com/brightnucleus/contracts.git",
- "reference": "dee397db41a602ab57c0829c05ecfdafb5460464"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/brightnucleus/contracts/zipball/dee397db41a602ab57c0829c05ecfdafb5460464",
- "reference": "dee397db41a602ab57c0829c05ecfdafb5460464",
- "shasum": ""
- },
- "require-dev": {
- "squizlabs/php_codesniffer": "~2.5"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "BrightNucleus\\Contract\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "GPL-2.0+"
- ],
- "authors": [
- {
- "name": "Alain Schlesser",
- "email": "alain.schlesser@gmail.com"
- }
- ],
- "description": "Set of segregated interfaces that are reused across different Bright Nucleus components.",
- "time": "2016-02-17 11:46:26"
- },
- {
- "name": "brightnucleus/dependencies",
- "version": "v0.3.1",
- "source": {
- "type": "git",
- "url": "https://github.com/brightnucleus/dependencies.git",
- "reference": "35fc1135d54f9e5b3234e45b5d41f8a7112fa3f1"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/brightnucleus/dependencies/zipball/35fc1135d54f9e5b3234e45b5d41f8a7112fa3f1",
- "reference": "35fc1135d54f9e5b3234e45b5d41f8a7112fa3f1",
- "shasum": ""
- },
- "require": {
- "brightnucleus/config": ">=0.2",
- "brightnucleus/contracts": ">=0.1",
- "brightnucleus/exceptions": ">=0.2",
- "brightnucleus/invoker": ">=0.1"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "BrightNucleus\\Dependency\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Alain Schlesser",
- "email": "alain.schlesser@gmail.com"
- }
- ],
- "description": "Config-driven WordPress dependencies.",
- "time": "2016-08-17 19:37:34"
- },
- {
- "name": "brightnucleus/exceptions",
- "version": "v0.2.5",
- "source": {
- "type": "git",
- "url": "https://github.com/brightnucleus/exceptions.git",
- "reference": "10baa93467fc7c9fed68cf98733222dd029afa5f"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/brightnucleus/exceptions/zipball/10baa93467fc7c9fed68cf98733222dd029afa5f",
- "reference": "10baa93467fc7c9fed68cf98733222dd029afa5f",
- "shasum": ""
- },
- "require-dev": {
- "phpunit/phpunit": "~4",
- "squizlabs/php_codesniffer": "~2.5"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "BrightNucleus\\Exception\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "GPL-2.0+"
- ],
- "authors": [
- {
- "name": "Alain Schlesser",
- "email": "alain.schlesser@gmail.com"
- }
- ],
- "description": "Exceptions shared across Bright Nucleus components.",
- "time": "2016-06-08 09:20:26"
- },
- {
- "name": "brightnucleus/invoker",
- "version": "v0.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/brightnucleus/invoker.git",
- "reference": "3434613153582395f7c10f54f692232fcdbff6c0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/brightnucleus/invoker/zipball/3434613153582395f7c10f54f692232fcdbff6c0",
- "reference": "3434613153582395f7c10f54f692232fcdbff6c0",
- "shasum": ""
- },
- "require": {
- "brightnucleus/exceptions": ">=0.2"
- },
- "require-dev": {
- "phpunit/phpunit": "~4",
- "squizlabs/php_codesniffer": "~2.5"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "BrightNucleus\\Invoker\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Alain Schlesser",
- "email": "alain.schlesser@gmail.com"
- }
- ],
- "description": "Function and method invoking traits that match named arguments in the right order.",
- "time": "2016-11-12 09:49:12"
- },
- {
- "name": "gamajo/template-loader",
- "version": "1.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/GaryJones/Gamajo-Template-Loader.git",
- "reference": "e53b4698670de81849e04c1d24a82e8466e59c99"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/GaryJones/Gamajo-Template-Loader/zipball/e53b4698670de81849e04c1d24a82e8466e59c99",
- "reference": "e53b4698670de81849e04c1d24a82e8466e59c99",
- "shasum": ""
- },
- "require": {
- "php": ">=5.2.4"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "class-gamajo-template-loader.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "GPL-2.0+"
- ],
- "authors": [
- {
- "name": "Gary Jones",
- "email": "gamajo@gamajo.com",
- "homepage": "http://gamajo.com",
- "role": "Developer"
- }
- ],
- "description": "A class for your WordPress plugin, to allow loading template parts with fallback through the child theme > parent theme > plugin",
- "homepage": "http://github.com/GaryJones/Gamajo-Template-Loader",
- "keywords": [
- "templates",
- "wordpress"
- ],
- "time": "2016-03-26 07:42:40"
- },
- {
- "name": "symfony/options-resolver",
- "version": "v3.1.6",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/options-resolver.git",
- "reference": "30605874d99af0cde6c41fd39e18546330c38100"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/options-resolver/zipball/30605874d99af0cde6c41fd39e18546330c38100",
- "reference": "30605874d99af0cde6c41fd39e18546330c38100",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5.9"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.1-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\OptionsResolver\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony OptionsResolver Component",
- "homepage": "https://symfony.com",
- "keywords": [
- "config",
- "configuration",
- "options"
- ],
- "time": "2016-05-12 15:59:27"
- }
- ],
- "packages-dev": [
- {
- "name": "doctrine/instantiator",
- "version": "1.0.5",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/instantiator.git",
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3,<8.0-DEV"
- },
- "require-dev": {
- "athletic/athletic": "~0.1.8",
- "ext-pdo": "*",
- "ext-phar": "*",
- "phpunit/phpunit": "~4.0",
- "squizlabs/php_codesniffer": "~2.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Marco Pivetta",
- "email": "ocramius@gmail.com",
- "homepage": "http://ocramius.github.com/"
- }
- ],
- "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
- "homepage": "https://github.com/doctrine/instantiator",
- "keywords": [
- "constructor",
- "instantiate"
- ],
- "time": "2015-06-14 21:17:01"
- },
- {
- "name": "phpdocumentor/reflection-common",
- "version": "1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
- "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
- "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.6"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "phpDocumentor\\Reflection\\": [
- "src"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jaap van Otterdijk",
- "email": "opensource@ijaap.nl"
- }
- ],
- "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
- "homepage": "http://www.phpdoc.org",
- "keywords": [
- "FQSEN",
- "phpDocumentor",
- "phpdoc",
- "reflection",
- "static analysis"
- ],
- "time": "2015-12-27 11:43:31"
- },
- {
- "name": "phpdocumentor/reflection-docblock",
- "version": "3.1.1",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
- "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e",
- "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5",
- "phpdocumentor/reflection-common": "^1.0@dev",
- "phpdocumentor/type-resolver": "^0.2.0",
- "webmozart/assert": "^1.0"
- },
- "require-dev": {
- "mockery/mockery": "^0.9.4",
- "phpunit/phpunit": "^4.4"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "phpDocumentor\\Reflection\\": [
- "src/"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Mike van Riel",
- "email": "me@mikevanriel.com"
- }
- ],
- "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
- "time": "2016-09-30 07:12:33"
- },
- {
- "name": "phpdocumentor/type-resolver",
- "version": "0.2",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/TypeResolver.git",
- "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443",
- "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5",
- "phpdocumentor/reflection-common": "^1.0"
- },
- "require-dev": {
- "mockery/mockery": "^0.9.4",
- "phpunit/phpunit": "^5.2||^4.8.24"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "phpDocumentor\\Reflection\\": [
- "src/"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Mike van Riel",
- "email": "me@mikevanriel.com"
- }
- ],
- "time": "2016-06-10 07:14:17"
- },
- {
- "name": "phpspec/prophecy",
- "version": "v1.6.1",
- "source": {
- "type": "git",
- "url": "https://github.com/phpspec/prophecy.git",
- "reference": "58a8137754bc24b25740d4281399a4a3596058e0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0",
- "reference": "58a8137754bc24b25740d4281399a4a3596058e0",
- "shasum": ""
- },
- "require": {
- "doctrine/instantiator": "^1.0.2",
- "php": "^5.3|^7.0",
- "phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
- "sebastian/comparator": "^1.1",
- "sebastian/recursion-context": "^1.0"
- },
- "require-dev": {
- "phpspec/phpspec": "^2.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.6.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Prophecy\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Konstantin Kudryashov",
- "email": "ever.zet@gmail.com",
- "homepage": "http://everzet.com"
- },
- {
- "name": "Marcello Duarte",
- "email": "marcello.duarte@gmail.com"
- }
- ],
- "description": "Highly opinionated mocking framework for PHP 5.3+",
- "homepage": "https://github.com/phpspec/prophecy",
- "keywords": [
- "Double",
- "Dummy",
- "fake",
- "mock",
- "spy",
- "stub"
- ],
- "time": "2016-06-07 08:13:47"
- },
- {
- "name": "phpunit/php-code-coverage",
- "version": "2.2.4",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
- "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "phpunit/php-file-iterator": "~1.3",
- "phpunit/php-text-template": "~1.2",
- "phpunit/php-token-stream": "~1.3",
- "sebastian/environment": "^1.3.2",
- "sebastian/version": "~1.0"
- },
- "require-dev": {
- "ext-xdebug": ">=2.1.4",
- "phpunit/phpunit": "~4"
- },
- "suggest": {
- "ext-dom": "*",
- "ext-xdebug": ">=2.2.1",
- "ext-xmlwriter": "*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.2.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
- "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
- "keywords": [
- "coverage",
- "testing",
- "xunit"
- ],
- "time": "2015-10-06 15:47:00"
- },
- {
- "name": "phpunit/php-file-iterator",
- "version": "1.4.1",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
- "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "FilterIterator implementation that filters files based on a list of suffixes.",
- "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
- "keywords": [
- "filesystem",
- "iterator"
- ],
- "time": "2015-06-21 13:08:43"
- },
- {
- "name": "phpunit/php-text-template",
- "version": "1.2.1",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-text-template.git",
- "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
- "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de",
- "role": "lead"
- }
- ],
- "description": "Simple template engine.",
- "homepage": "https://github.com/sebastianbergmann/php-text-template/",
- "keywords": [
- "template"
- ],
- "time": "2015-06-21 13:50:34"
- },
- {
- "name": "phpunit/php-timer",
- "version": "1.0.8",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-timer.git",
- "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
- "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4|~5"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Utility class for timing",
- "homepage": "https://github.com/sebastianbergmann/php-timer/",
- "keywords": [
- "timer"
- ],
- "time": "2016-05-12 18:03:57"
- },
- {
- "name": "phpunit/php-token-stream",
- "version": "1.4.8",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-token-stream.git",
- "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
- "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
- "shasum": ""
- },
- "require": {
- "ext-tokenizer": "*",
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Wrapper around PHP's tokenizer extension.",
- "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
- "keywords": [
- "tokenizer"
- ],
- "time": "2015-09-15 10:49:45"
- },
- {
- "name": "phpunit/phpunit",
- "version": "4.8.27",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c062dddcb68e44b563f66ee319ddae2b5a322a90",
- "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90",
- "shasum": ""
- },
- "require": {
- "ext-dom": "*",
- "ext-json": "*",
- "ext-pcre": "*",
- "ext-reflection": "*",
- "ext-spl": "*",
- "php": ">=5.3.3",
- "phpspec/prophecy": "^1.3.1",
- "phpunit/php-code-coverage": "~2.1",
- "phpunit/php-file-iterator": "~1.4",
- "phpunit/php-text-template": "~1.2",
- "phpunit/php-timer": "^1.0.6",
- "phpunit/phpunit-mock-objects": "~2.3",
- "sebastian/comparator": "~1.1",
- "sebastian/diff": "~1.2",
- "sebastian/environment": "~1.3",
- "sebastian/exporter": "~1.2",
- "sebastian/global-state": "~1.0",
- "sebastian/version": "~1.0",
- "symfony/yaml": "~2.1|~3.0"
- },
- "suggest": {
- "phpunit/php-invoker": "~1.1"
- },
- "bin": [
- "phpunit"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "4.8.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de",
- "role": "lead"
- }
- ],
- "description": "The PHP Unit Testing framework.",
- "homepage": "https://phpunit.de/",
- "keywords": [
- "phpunit",
- "testing",
- "xunit"
- ],
- "time": "2016-07-21 06:48:14"
- },
- {
- "name": "phpunit/phpunit-mock-objects",
- "version": "2.3.8",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
- "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
- "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
- "shasum": ""
- },
- "require": {
- "doctrine/instantiator": "^1.0.2",
- "php": ">=5.3.3",
- "phpunit/php-text-template": "~1.2",
- "sebastian/exporter": "~1.2"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.4"
- },
- "suggest": {
- "ext-soap": "*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.3.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Mock Object library for PHPUnit",
- "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
- "keywords": [
- "mock",
- "xunit"
- ],
- "time": "2015-10-02 06:51:40"
- },
- {
- "name": "sebastian/comparator",
- "version": "1.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/comparator.git",
- "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
- "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "sebastian/diff": "~1.2",
- "sebastian/exporter": "~1.2"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.4"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.2.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Jeff Welch",
- "email": "whatthejeff@gmail.com"
- },
- {
- "name": "Volker Dusch",
- "email": "github@wallbash.com"
- },
- {
- "name": "Bernhard Schussek",
- "email": "bschussek@2bepublished.at"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Provides the functionality to compare PHP values for equality",
- "homepage": "http://www.github.com/sebastianbergmann/comparator",
- "keywords": [
- "comparator",
- "compare",
- "equality"
- ],
- "time": "2015-07-26 15:48:44"
- },
- {
- "name": "sebastian/diff",
- "version": "1.4.1",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/diff.git",
- "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
- "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.8"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Kore Nordmann",
- "email": "mail@kore-nordmann.de"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Diff implementation",
- "homepage": "https://github.com/sebastianbergmann/diff",
- "keywords": [
- "diff"
- ],
- "time": "2015-12-08 07:14:41"
- },
- {
- "name": "sebastian/environment",
- "version": "1.3.8",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea",
- "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea",
- "shasum": ""
- },
- "require": {
- "php": "^5.3.3 || ^7.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.8 || ^5.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Provides functionality to handle HHVM/PHP environments",
- "homepage": "http://www.github.com/sebastianbergmann/environment",
- "keywords": [
- "Xdebug",
- "environment",
- "hhvm"
- ],
- "time": "2016-08-18 05:49:44"
- },
- {
- "name": "sebastian/exporter",
- "version": "1.2.2",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/exporter.git",
- "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
- "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "sebastian/recursion-context": "~1.0"
- },
- "require-dev": {
- "ext-mbstring": "*",
- "phpunit/phpunit": "~4.4"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Jeff Welch",
- "email": "whatthejeff@gmail.com"
- },
- {
- "name": "Volker Dusch",
- "email": "github@wallbash.com"
- },
- {
- "name": "Bernhard Schussek",
- "email": "bschussek@2bepublished.at"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- },
- {
- "name": "Adam Harvey",
- "email": "aharvey@php.net"
- }
- ],
- "description": "Provides the functionality to export PHP variables for visualization",
- "homepage": "http://www.github.com/sebastianbergmann/exporter",
- "keywords": [
- "export",
- "exporter"
- ],
- "time": "2016-06-17 09:04:28"
- },
- {
- "name": "sebastian/global-state",
- "version": "1.1.1",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/global-state.git",
- "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
- "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.2"
- },
- "suggest": {
- "ext-uopz": "*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Snapshotting of global state",
- "homepage": "http://www.github.com/sebastianbergmann/global-state",
- "keywords": [
- "global state"
- ],
- "time": "2015-10-12 03:26:01"
- },
- {
- "name": "sebastian/recursion-context",
- "version": "1.0.2",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/recursion-context.git",
- "reference": "913401df809e99e4f47b27cdd781f4a258d58791"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
- "reference": "913401df809e99e4f47b27cdd781f4a258d58791",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.4"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Jeff Welch",
- "email": "whatthejeff@gmail.com"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- },
- {
- "name": "Adam Harvey",
- "email": "aharvey@php.net"
- }
- ],
- "description": "Provides functionality to recursively process PHP variables",
- "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
- "time": "2015-11-11 19:50:13"
- },
- {
- "name": "sebastian/version",
- "version": "1.0.6",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/version.git",
- "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
- "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
- "shasum": ""
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de",
- "role": "lead"
- }
- ],
- "description": "Library that helps with managing the version number of Git-hosted PHP projects",
- "homepage": "https://github.com/sebastianbergmann/version",
- "time": "2015-06-21 13:59:46"
- },
- {
- "name": "squizlabs/php_codesniffer",
- "version": "2.7.0",
- "source": {
- "type": "git",
- "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
- "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/571e27b6348e5b3a637b2abc82ac0d01e6d7bbed",
- "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed",
- "shasum": ""
- },
- "require": {
- "ext-simplexml": "*",
- "ext-tokenizer": "*",
- "ext-xmlwriter": "*",
- "php": ">=5.1.2"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0"
- },
- "bin": [
- "scripts/phpcs",
- "scripts/phpcbf"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "CodeSniffer.php",
- "CodeSniffer/CLI.php",
- "CodeSniffer/Exception.php",
- "CodeSniffer/File.php",
- "CodeSniffer/Fixer.php",
- "CodeSniffer/Report.php",
- "CodeSniffer/Reporting.php",
- "CodeSniffer/Sniff.php",
- "CodeSniffer/Tokens.php",
- "CodeSniffer/Reports/",
- "CodeSniffer/Tokenizers/",
- "CodeSniffer/DocGenerators/",
- "CodeSniffer/Standards/AbstractPatternSniff.php",
- "CodeSniffer/Standards/AbstractScopeSniff.php",
- "CodeSniffer/Standards/AbstractVariableSniff.php",
- "CodeSniffer/Standards/IncorrectPatternException.php",
- "CodeSniffer/Standards/Generic/Sniffs/",
- "CodeSniffer/Standards/MySource/Sniffs/",
- "CodeSniffer/Standards/PEAR/Sniffs/",
- "CodeSniffer/Standards/PSR1/Sniffs/",
- "CodeSniffer/Standards/PSR2/Sniffs/",
- "CodeSniffer/Standards/Squiz/Sniffs/",
- "CodeSniffer/Standards/Zend/Sniffs/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Greg Sherwood",
- "role": "lead"
- }
- ],
- "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
- "homepage": "http://www.squizlabs.com/php-codesniffer",
- "keywords": [
- "phpcs",
- "standards"
- ],
- "time": "2016-09-01 23:53:02"
- },
- {
- "name": "symfony/yaml",
- "version": "v3.1.6",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/yaml.git",
- "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/7ff51b06c6c3d5cc6686df69004a42c69df09e27",
- "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5.9"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.1-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Yaml\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Yaml Component",
- "homepage": "https://symfony.com",
- "time": "2016-10-24 18:41:13"
- },
- {
- "name": "webmozart/assert",
- "version": "1.1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/webmozart/assert.git",
- "reference": "bb2d123231c095735130cc8f6d31385a44c7b308"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308",
- "reference": "bb2d123231c095735130cc8f6d31385a44c7b308",
- "shasum": ""
- },
- "require": {
- "php": "^5.3.3|^7.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.6",
- "sebastian/version": "^1.0.1"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.2-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Webmozart\\Assert\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Bernhard Schussek",
- "email": "bschussek@gmail.com"
- }
- ],
- "description": "Assertions to validate method input/output with nice error messages.",
- "keywords": [
- "assert",
- "check",
- "validate"
- ],
- "time": "2016-08-09 15:02:57"
- },
- {
- "name": "wp-coding-standards/wpcs",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
- "reference": "b39490465f6fd7375743a395019cd597e12119c9"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/b39490465f6fd7375743a395019cd597e12119c9",
- "reference": "b39490465f6fd7375743a395019cd597e12119c9",
- "shasum": ""
- },
- "require": {
- "squizlabs/php_codesniffer": "^2.6"
- },
- "type": "library",
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Contributors",
- "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
- }
- ],
- "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
- "keywords": [
- "phpcs",
- "standards",
- "wordpress"
- ],
- "time": "2016-08-29 20:04:47"
- }
- ],
- "aliases": [],
- "minimum-stability": "stable",
- "stability-flags": {
- "wp-coding-standards/wpcs": 20
- },
- "prefer-stable": false,
- "prefer-lowest": false,
- "platform": [],
- "platform-dev": []
-}
diff --git a/phpcs.xml b/phpcs.xml
deleted file mode 100644
index 7510353..0000000
--- a/phpcs.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- The code standard for Bright Nucleus Shortcodes component.
- .
-
- vendor/
-
-
-
-
-
-
-
diff --git a/phpunit.xml b/phpunit.xml
deleted file mode 100644
index d45a33b..0000000
--- a/phpunit.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- tests
-
-
-
-
- src
-
-
-
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..ad79c9f
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+ ./tests/integration/
+
+
+ ./tests/unit/
+
+
+
diff --git a/src/Shortcode.php b/src/Shortcode.php
index c055768..981d7b2 100644
--- a/src/Shortcode.php
+++ b/src/Shortcode.php
@@ -11,7 +11,8 @@
namespace BrightNucleus\Shortcode;
-use BrightNucleus\Config\ConfigInterface;
+use BrightNucleus\Config\ConfigInterface as Config;
+use BrightNucleus\Shortcode\ShortcodeAttsParserInterface as ShortcodeAttsParser;
use BrightNucleus\Config\ConfigTrait;
use BrightNucleus\Dependency\DependencyManagerInterface as DependencyManager;
use BrightNucleus\Exception\DomainException;
@@ -76,7 +77,7 @@ class Shortcode implements ShortcodeInterface {
*
* @param string $shortcode_tag Tag that identifies the
* shortcode.
- * @param ConfigInterface $config Configuration settings.
+ * @param Config $config Configuration settings.
* @param ShortcodeAttsParser $atts_parser Attributes parser and
* validator.
* @param DependencyManager|null $dependencies Optional. Dependencies of
@@ -85,7 +86,7 @@ class Shortcode implements ShortcodeInterface {
*/
public function __construct(
$shortcode_tag,
- ConfigInterface $config,
+ Config $config,
ShortcodeAttsParser $atts_parser,
DependencyManager $dependencies = null
) {
diff --git a/src/TemplatedShortcode.php b/src/TemplatedShortcode.php
index b641813..3f91786 100644
--- a/src/TemplatedShortcode.php
+++ b/src/TemplatedShortcode.php
@@ -11,7 +11,8 @@
namespace BrightNucleus\Shortcode;
-use BrightNucleus\Config\ConfigInterface;
+use BrightNucleus\Config\ConfigInterface as Config;
+use BrightNucleus\Shortcode\ShortcodeAttsParserInterface as ShortcodeAttsParser;
use BrightNucleus\Dependency\DependencyManagerInterface as DependencyManager;
use BrightNucleus\Exception\RuntimeException;
use Gamajo_Template_Loader;
@@ -42,7 +43,7 @@ class TemplatedShortcode extends Shortcode {
*
* @param string $shortcode_tag Tag that identifies the
* shortcode.
- * @param ConfigInterface $config Configuration settings.
+ * @param Config $config Configuration settings.
* @param ShortcodeAttsParser $atts_parser Attributes parser and
* validator.
* @param DependencyManager|null $dependencies Optional. Dependencies of
@@ -51,7 +52,7 @@ class TemplatedShortcode extends Shortcode {
*/
public function __construct(
$shortcode_tag,
- ConfigInterface $config,
+ Config $config,
ShortcodeAttsParser $atts_parser,
DependencyManager $dependencies = null
) {
diff --git a/tests/BootstrapListener.php b/tests/BootstrapListener.php
new file mode 100644
index 0000000..de983d8
--- /dev/null
+++ b/tests/BootstrapListener.php
@@ -0,0 +1,36 @@
+getName() ) {
+ case 'integration':
+ $_tests_dir = getenv( 'WP_TESTS_DIR' );
+
+ if ( ! $_tests_dir ) {
+ $_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
+ }
+
+ if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
+ echo "Could not find {$_tests_dir}/includes/functions.php, have you run bin/install-wp-tests.sh ?\n"; // WPCS: XSS ok.
+ exit( 1 );
+ }
+
+ // As we had already included the 'testcase.php' file, we need
+ // a quite hacky way of requiring the WordPress test suite
+ // without throwing errors. Blame WordPress!
+ $bootstrap = file_get_contents( $_tests_dir . '/includes/bootstrap.php' );
+ $bootstrap = preg_replace( '/^<\?php\s*?$/m', '', $bootstrap );
+ $bootstrap = preg_replace( '~^\s*?require\s*?dirname\( __FILE__ \) \. \'/testcase\.php\';\s*?$~m', '', $bootstrap );
+ $bootstrap = str_replace( '__FILE__', "'{$_tests_dir}/includes/bootstrap.php'", $bootstrap );
+ eval( $bootstrap );
+ break;
+ case 'unit':
+ default:
+ break;
+ }
+ }
+}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
new file mode 100644
index 0000000..e9854af
--- /dev/null
+++ b/tests/bootstrap.php
@@ -0,0 +1,17 @@
+This is a dynamic view with = 'PHP code' ?>
diff --git a/tests/fixtures/some_static_view.html b/tests/fixtures/some_static_view.html
new file mode 100644
index 0000000..398df51
--- /dev/null
+++ b/tests/fixtures/some_static_view.html
@@ -0,0 +1 @@
+This is a static view
diff --git a/tests/unit/ShortcodeAttsParserTest.php b/tests/unit/ShortcodeAttsParserTest.php
new file mode 100644
index 0000000..135c331
--- /dev/null
+++ b/tests/unit/ShortcodeAttsParserTest.php
@@ -0,0 +1,21 @@
+createMock( ConfigInterface::class );
+
+ $attsParser = new ShortcodeAttsParser( $config );
+
+ $this->assertInstanceOf( ShortcodeAttsParser::class, $attsParser );
+ $this->assertInstanceOf(
+ ShortcodeAttsParserInterface::class,
+ $attsParser
+ );
+ }
+}
diff --git a/tests/unit/ShortcodeManagerTest.php b/tests/unit/ShortcodeManagerTest.php
new file mode 100644
index 0000000..e008688
--- /dev/null
+++ b/tests/unit/ShortcodeManagerTest.php
@@ -0,0 +1,23 @@
+createMock( ConfigInterface::class );
+
+ $config->method( 'getKeys' )->willReturn( [] );
+
+ $shortcodeManager = new ShortcodeManager( $config );
+
+ $this->assertInstanceOf( ShortcodeManager::class, $shortcodeManager );
+ $this->assertInstanceOf(
+ ShortcodeManagerInterface::class,
+ $shortcodeManager
+ );
+ }
+}
diff --git a/tests/unit/ShortcodeTest.php b/tests/unit/ShortcodeTest.php
new file mode 100644
index 0000000..5756c87
--- /dev/null
+++ b/tests/unit/ShortcodeTest.php
@@ -0,0 +1,36 @@
+createMock( ConfigInterface::class );
+ $attsParser = $this->createMock( ShortcodeAttsParserInterface::class );
+
+ $shortcode = new Shortcode( 'some_tag', $config, $attsParser );
+
+ $this->assertInstanceOf( Shortcode::class, $shortcode );
+ $this->assertInstanceOf( ShortcodeInterface::class, $shortcode );
+ }
+
+ public function test_it_can_render_a_view_with_an_absolute_path() {
+ $config = ConfigFactory::createFromArray(
+ [ 'view' => __DIR__ . '/../fixtures/some_dynamic_view.php' ]
+ );
+ $attsParser = $this->createMock( ShortcodeAttsParser::class );
+
+ $shortcode = new Shortcode( 'some_tag', $config, $attsParser );
+
+ $output = $shortcode->render( [] );
+
+ $this->assertStringStartsWith(
+ 'This is a dynamic view with PHP code
',
+ $output
+ );
+ }
+}
diff --git a/tests/unit/ShortcodeUITest.php b/tests/unit/ShortcodeUITest.php
new file mode 100644
index 0000000..e6476f4
--- /dev/null
+++ b/tests/unit/ShortcodeUITest.php
@@ -0,0 +1,18 @@
+createMock( ConfigInterface::class );
+
+ $shortcodeUI = new ShortcodeUI( 'some_tag', $config );
+
+ $this->assertInstanceOf( ShortcodeUI::class, $shortcodeUI );
+ $this->assertInstanceOf( ShortcodeUIInterface::class, $shortcodeUI );
+ }
+}
diff --git a/tests/unit/TemplatedShortcodeTest.php b/tests/unit/TemplatedShortcodeTest.php
new file mode 100644
index 0000000..197b261
--- /dev/null
+++ b/tests/unit/TemplatedShortcodeTest.php
@@ -0,0 +1,23 @@
+createMock( ConfigInterface::class );
+ $attsParser = $this->createMock( ShortcodeAttsParserInterface::class );
+
+ $shortcode = new TemplatedShortcode(
+ 'some_tag',
+ $config,
+ $attsParser
+ );
+
+ $this->assertInstanceOf( TemplatedShortcode::class, $shortcode );
+ $this->assertInstanceOf( ShortcodeInterface::class, $shortcode );
+ }
+}