diff options
96 files changed, 1905 insertions, 292 deletions
@@ -1,3 +1,4 @@ vendor .php_cs.cache docu/phpdoc/ +.phpunit.result.cache diff --git a/composer.json b/composer.json index c530140..2343a3a 100644 --- a/composer.json +++ b/composer.json @@ -8,6 +8,11 @@ "kch42\\ste\\": "src/ste" } }, + "autoload-dev": { + "psr-4": { + "tests\\": "tests" + } + }, "license": "MIT", "authors": [ { @@ -22,6 +27,7 @@ "keywords": ["templating"], "homepage": "http://github.com/silvasur/ste", "require-dev": { - "phpdocumentor/phpdocumentor": "^2.9" + "phpdocumentor/phpdocumentor": "^2.9", + "phpunit/phpunit": "^9" } } diff --git a/composer.lock b/composer.lock index b14f168..f80a2e3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f45ad110a19695736796a2738838799d", + "content-hash": "d111ba56552bbf0ebff137ddcdda7571", "packages": [], "packages-dev": [ { @@ -704,6 +704,60 @@ "time": "2019-12-20T14:15:16+00:00" }, { + "name": "myclabs/deep-copy", + "version": "1.10.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-06-29T13:22:24+00:00" + }, + { "name": "nikic/php-parser", "version": "v1.4.1", "source": { @@ -867,9 +921,112 @@ "self-update", "update" ], + "abandoned": true, "time": "2018-03-30T12:52:15+00:00" }, { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "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": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { "name": "phpcollection/phpcollection", "version": "0.5.0", "source": { @@ -1250,6 +1407,518 @@ "time": "2020-03-21T18:07:53+00:00" }, { + "name": "phpspec/prophecy", + "version": "v1.10.3", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "451c3cd1418cf640de218914901e51b064abb093" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5 || ^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "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": "2020-03-05T15:02:03+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "8.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca6647ffddd2add025ab3f21644a441d7c146cdc", + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.3", + "phpunit/php-file-iterator": "^3.0", + "phpunit/php-text-template": "^2.0", + "phpunit/php-token-stream": "^4.0", + "sebastian/code-unit-reverse-lookup": "^2.0", + "sebastian/environment": "^5.0", + "sebastian/version": "^3.0", + "theseer/tokenizer": "^1.1.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.0-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": "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" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-23T08:02:54+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/25fefc5b19835ca653877fe081644a3f8c1d915e", + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-11T05:18:21+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/7a85b66acc48cacffdf87dadd3694e7123674298", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-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": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-06T07:04:15+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-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": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T11:55:37+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/cc49734779cbb302bf51a44297dab8c4bbf941e7", + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-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": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T11:58:13+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-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" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2020-08-04T08:28:15+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.2.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "ad7cc5ec3ab2597b329880e30442d9054526023b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ad7cc5ec3ab2597b329880e30442d9054526023b", + "reference": "ad7cc5ec3ab2597b329880e30442d9054526023b", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2.0", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.1", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.3", + "phpspec/prophecy": "^1.8.1", + "phpunit/php-code-coverage": "^8.0.1", + "phpunit/php-file-iterator": "^3.0", + "phpunit/php-invoker": "^3.0", + "phpunit/php-text-template": "^2.0", + "phpunit/php-timer": "^5.0", + "sebastian/code-unit": "^1.0.2", + "sebastian/comparator": "^4.0", + "sebastian/diff": "^4.0", + "sebastian/environment": "^5.0.1", + "sebastian/exporter": "^4.0", + "sebastian/global-state": "^4.0", + "sebastian/object-enumerator": "^4.0", + "sebastian/resource-operations": "^3.0", + "sebastian/type": "^2.1", + "sebastian/version": "^3.0" + }, + "require-dev": { + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" + ] + }, + "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" + ], + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-22T07:10:55+00:00" + }, + { "name": "pimple/pimple", "version": "v1.1.1", "source": { @@ -1486,6 +2155,742 @@ "time": "2017-10-23T01:57:42+00:00" }, { + "name": "sebastian/code-unit", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/c1e2df332c905079980b119c4db103117e5e5c90", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "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", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:50:45+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ee51f9bb0c6d8a43337055db3120829fa14da819", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:04:00+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:05:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-30T04:46:02+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-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" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:07:24+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "571d721db4aec847a0e59690b954af33ebf9f023" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/571d721db4aec847a0e59690b954af33ebf9f023", + "reference": "571d721db4aec847a0e59690b954af33ebf9f023", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:08:55+00:00" + }, + { + "name": "sebastian/global-state", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bdb1e7c79e592b8c82cb1699be3c8743119b8a72", + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72", + "shasum": "" + }, + "require": { + "php": "^7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.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": "2020-02-07T06:11:37+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:11:32+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "127a46f6b057441b201253526f81d5406d6c7840" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/127a46f6b057441b201253526f81d5406d6c7840", + "reference": "127a46f6b057441b201253526f81d5406d6c7840", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:12:55+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:14:17+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0653718a5a629b065e91f774595267f8dc32e213" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0653718a5a629b065e91f774595267f8dc32e213", + "reference": "0653718a5a629b065e91f774595267f8dc32e213", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:16:22+00:00" + }, + { + "name": "sebastian/type", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-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": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-05T08:31:53+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/626586115d0ed31cb71483be55beb759b5af5a3c", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:18:43+00:00" + }, + { "name": "symfony/config", "version": "v2.8.52", "source": { @@ -2200,6 +3605,52 @@ "time": "2018-11-14T14:06:48+00:00" }, { + "name": "theseer/tokenizer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "75a63c33a8577608444246075ea0af0d052e452a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2020-07-12T23:59:07+00:00" + }, + { "name": "twig/twig", "version": "v1.42.5", "source": { diff --git a/tests/dump_ast.php b/tests/dump_ast.php deleted file mode 100644 index 70a15af..0000000 --- a/tests/dump_ast.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -require(dirname(__FILE__) . "/../ste.php"); - -ini_set("xdebug.var_display_max_depth", 1000); -var_dump(\ste\Parser::parse(file_get_contents("php://stdin"), "-")); diff --git a/tests/functional/.gitignore b/tests/functional/.gitignore new file mode 100644 index 0000000..448d02b --- /dev/null +++ b/tests/functional/.gitignore @@ -0,0 +1 @@ +*.transc.php
\ No newline at end of file diff --git a/tests/functional/BaseTest.php b/tests/functional/BaseTest.php new file mode 100644 index 0000000..ce045fb --- /dev/null +++ b/tests/functional/BaseTest.php @@ -0,0 +1,55 @@ +<?php + + +namespace tests\functional; + +use PHPUnit\Framework\TestCase; +use kch42\ste\STECore; + +abstract class BaseTest extends TestCase +{ + /** @var STECore */ + protected $ste; + + private static function normalize(string $string): string + { + $lines = explode("\n", $string); + + $lines = array_map(static function ($line) { + return preg_replace('/\s{2,}/', " ", $line); + }, $lines); + $lines = array_map('trim', $lines); + $lines = array_filter($lines); + + return implode("\n", $lines); + } + + public function setUp(): void + { + $this->ste = new STECore(new TestStorage($this->getDirectory())); + $this->ste->mute_runtime_errors = false; + + $this->setUpSte($this->ste); + } + + protected function setUpSte(STECore $ste): void + { + } + + public function testTemplate(): void + { + $have = $this->ste->exectemplate("test.tpl"); + $want = file_get_contents($this->getDirectory() . DIRECTORY_SEPARATOR . "want"); + + $normalizedHave = self::normalize($have); + $normalizedWant = self::normalize($want); + + self::assertSame($normalizedWant, $normalizedHave); + } + + /** + * Get the directory of the test. + * @return string + */ + abstract protected function getDirectory(): string; +} diff --git a/tests/functional/TestStorage.php b/tests/functional/TestStorage.php new file mode 100644 index 0000000..2403668 --- /dev/null +++ b/tests/functional/TestStorage.php @@ -0,0 +1,32 @@ +<?php + + +namespace tests\functional; + +use kch42\ste\StorageAccess; + +class TestStorage implements StorageAccess +{ + /** @var string */ + private $dir; + + public function __construct(string $dir) + { + $this->dir = $dir; + } + + public function load($tpl, &$mode) + { + $mode = StorageAccess::MODE_SOURCE; + return file_get_contents($this->dir . DIRECTORY_SEPARATOR . $tpl); + } + + public function save($tpl, $data, $mode) + { + if ($mode != StorageAccess::MODE_TRANSCOMPILED) { + return; + } + + file_put_contents($this->dir . DIRECTORY_SEPARATOR . "$tpl.transc.php", $data); + } +} diff --git a/tests/functional/test_array/Test.php b/tests/functional/test_array/Test.php new file mode 100644 index 0000000..58f0cb8 --- /dev/null +++ b/tests/functional/test_array/Test.php @@ -0,0 +1,27 @@ +<?php + +namespace tests\functional\test_array; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $ste->vars["foo"] = array( + "a" => array( + "blabla" => "OK" + ), + "b" => "bla" + ); + $ste->vars["bar"] = array( + "baz" => "a" + ); + } +} diff --git a/tests/test_array/test.tpl b/tests/functional/test_array/test.tpl index 050045d..050045d 100644 --- a/tests/test_array/test.tpl +++ b/tests/functional/test_array/test.tpl diff --git a/tests/test_array/want b/tests/functional/test_array/want index d86bac9..d86bac9 100644 --- a/tests/test_array/want +++ b/tests/functional/test_array/want diff --git a/tests/functional/test_blocks/Test.php b/tests/functional/test_blocks/Test.php new file mode 100644 index 0000000..05e8e09 --- /dev/null +++ b/tests/functional/test_blocks/Test.php @@ -0,0 +1,18 @@ +<?php + +namespace tests\functional\test_blocks; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + } +} diff --git a/tests/test_blocks/master.tpl b/tests/functional/test_blocks/main.tpl index a9608bd..a9608bd 100644 --- a/tests/test_blocks/master.tpl +++ b/tests/functional/test_blocks/main.tpl diff --git a/tests/test_blocks/test.tpl b/tests/functional/test_blocks/test.tpl index 44c6891..3d14e46 100644 --- a/tests/test_blocks/test.tpl +++ b/tests/functional/test_blocks/test.tpl @@ -1,2 +1,2 @@ -<ste:load name="master.tpl" /> +<ste:load name="main.tpl" /> <ste:block name="blk1">Replaced</ste:block>
\ No newline at end of file diff --git a/tests/test_blocks/want b/tests/functional/test_blocks/want index 640cfef..640cfef 100644 --- a/tests/test_blocks/want +++ b/tests/functional/test_blocks/want diff --git a/tests/functional/test_closure/Test.php b/tests/functional/test_closure/Test.php new file mode 100644 index 0000000..012e4c6 --- /dev/null +++ b/tests/functional/test_closure/Test.php @@ -0,0 +1,18 @@ +<?php + +namespace tests\functional\test_closure; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + } +} diff --git a/tests/test_closure/test.tpl b/tests/functional/test_closure/test.tpl index c84ed0a..c84ed0a 100644 --- a/tests/test_closure/test.tpl +++ b/tests/functional/test_closure/test.tpl diff --git a/tests/test_closure/want b/tests/functional/test_closure/want index 98d2f20..98d2f20 100644 --- a/tests/test_closure/want +++ b/tests/functional/test_closure/want diff --git a/tests/functional/test_escapes/Test.php b/tests/functional/test_escapes/Test.php new file mode 100644 index 0000000..5c2a2ab --- /dev/null +++ b/tests/functional/test_escapes/Test.php @@ -0,0 +1,21 @@ +<?php + +namespace tests\functional\test_escapes; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $ste->register_tag("my_echo", function ($ste, $params, $sub) { + return $params["text"]; + }); + } +} diff --git a/tests/test_escapes/test.tpl b/tests/functional/test_escapes/test.tpl index 5458fde..5458fde 100644 --- a/tests/test_escapes/test.tpl +++ b/tests/functional/test_escapes/test.tpl diff --git a/tests/test_escapes/want b/tests/functional/test_escapes/want index 3278c4d..3278c4d 100644 --- a/tests/test_escapes/want +++ b/tests/functional/test_escapes/want diff --git a/tests/functional/test_foreach/Test.php b/tests/functional/test_foreach/Test.php new file mode 100644 index 0000000..3f8cc73 --- /dev/null +++ b/tests/functional/test_foreach/Test.php @@ -0,0 +1,23 @@ +<?php + +namespace tests\functional\test_foreach; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $ste->vars["foo"] = array( + "a" => array("a" => 100, "b" => 200), + "b" => array("a" => 1, "b" => 2), + "c" => array("a" => 42, "b" => 1337) + ); + } +} diff --git a/tests/test_foreach/test.tpl b/tests/functional/test_foreach/test.tpl index 1aec8b4..1aec8b4 100644 --- a/tests/test_foreach/test.tpl +++ b/tests/functional/test_foreach/test.tpl diff --git a/tests/test_foreach/want b/tests/functional/test_foreach/want index 5710bf7..5710bf7 100644 --- a/tests/test_foreach/want +++ b/tests/functional/test_foreach/want diff --git a/tests/functional/test_getset/Test.php b/tests/functional/test_getset/Test.php new file mode 100644 index 0000000..6f34500 --- /dev/null +++ b/tests/functional/test_getset/Test.php @@ -0,0 +1,19 @@ +<?php + +namespace tests\functional\test_getset; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $ste->vars["foo"] = "bar"; + } +} diff --git a/tests/test_getset/test.tpl b/tests/functional/test_getset/test.tpl index 06f865a..06f865a 100644 --- a/tests/test_getset/test.tpl +++ b/tests/functional/test_getset/test.tpl diff --git a/tests/test_getset/want b/tests/functional/test_getset/want index 567c753..567c753 100644 --- a/tests/test_getset/want +++ b/tests/functional/test_getset/want diff --git a/tests/functional/test_loop/Test.php b/tests/functional/test_loop/Test.php new file mode 100644 index 0000000..05a76d7 --- /dev/null +++ b/tests/functional/test_loop/Test.php @@ -0,0 +1,18 @@ +<?php + +namespace tests\functional\test_loop; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + } +} diff --git a/tests/test_loop/test.tpl b/tests/functional/test_loop/test.tpl index 399f05a..399f05a 100644 --- a/tests/test_loop/test.tpl +++ b/tests/functional/test_loop/test.tpl diff --git a/tests/test_loop/want b/tests/functional/test_loop/want index 30b148d..30b148d 100644 --- a/tests/test_loop/want +++ b/tests/functional/test_loop/want diff --git a/tests/functional/test_mktag/Test.php b/tests/functional/test_mktag/Test.php new file mode 100644 index 0000000..c850509 --- /dev/null +++ b/tests/functional/test_mktag/Test.php @@ -0,0 +1,18 @@ +<?php + +namespace tests\functional\test_mktag; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + } +} diff --git a/tests/test_mktag/test.tpl b/tests/functional/test_mktag/test.tpl index c446206..c446206 100644 --- a/tests/test_mktag/test.tpl +++ b/tests/functional/test_mktag/test.tpl diff --git a/tests/test_mktag/want b/tests/functional/test_mktag/want index 3e2351c..3e2351c 100644 --- a/tests/test_mktag/want +++ b/tests/functional/test_mktag/want diff --git a/tests/functional/test_pseudotags/Test.php b/tests/functional/test_pseudotags/Test.php new file mode 100644 index 0000000..f64ff5f --- /dev/null +++ b/tests/functional/test_pseudotags/Test.php @@ -0,0 +1,18 @@ +<?php + +namespace tests\functional\test_pseudotags; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + } +} diff --git a/tests/test_pseudotags/test.tpl b/tests/functional/test_pseudotags/test.tpl index 756be8a..756be8a 100644 --- a/tests/test_pseudotags/test.tpl +++ b/tests/functional/test_pseudotags/test.tpl diff --git a/tests/test_pseudotags/want b/tests/functional/test_pseudotags/want index 3aaffdc..3aaffdc 100644 --- a/tests/test_pseudotags/want +++ b/tests/functional/test_pseudotags/want diff --git a/tests/functional/test_recursive/Test.php b/tests/functional/test_recursive/Test.php new file mode 100644 index 0000000..d393791 --- /dev/null +++ b/tests/functional/test_recursive/Test.php @@ -0,0 +1,19 @@ +<?php + +namespace tests\functional\test_recursive; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $ste->mute_runtime_errors = false; + } +} diff --git a/tests/test_recursive/test.tpl b/tests/functional/test_recursive/test.tpl index bea3934..bea3934 100644 --- a/tests/test_recursive/test.tpl +++ b/tests/functional/test_recursive/test.tpl diff --git a/tests/test_recursive/want b/tests/functional/test_recursive/want index 3fbd4a8..3fbd4a8 100644 --- a/tests/test_recursive/want +++ b/tests/functional/test_recursive/want diff --git a/tests/functional/test_scoping/Test.php b/tests/functional/test_scoping/Test.php new file mode 100644 index 0000000..b15f911 --- /dev/null +++ b/tests/functional/test_scoping/Test.php @@ -0,0 +1,18 @@ +<?php + +namespace tests\functional\test_scoping; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + } +} diff --git a/tests/test_scoping/test.tpl b/tests/functional/test_scoping/test.tpl index e8a5cf2..e8a5cf2 100644 --- a/tests/test_scoping/test.tpl +++ b/tests/functional/test_scoping/test.tpl diff --git a/tests/test_scoping/want b/tests/functional/test_scoping/want index 6e7a154..6e7a154 100644 --- a/tests/test_scoping/want +++ b/tests/functional/test_scoping/want diff --git a/tests/functional/test_short/Test.php b/tests/functional/test_short/Test.php new file mode 100644 index 0000000..2b138f5 --- /dev/null +++ b/tests/functional/test_short/Test.php @@ -0,0 +1,18 @@ +<?php + +namespace tests\functional\test_short; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + } +} diff --git a/tests/test_short/test.tpl b/tests/functional/test_short/test.tpl index 42d498b..42d498b 100644 --- a/tests/test_short/test.tpl +++ b/tests/functional/test_short/test.tpl diff --git a/tests/test_short/want b/tests/functional/test_short/want index d86bac9..d86bac9 100644 --- a/tests/test_short/want +++ b/tests/functional/test_short/want diff --git a/tests/functional/test_short_for_additional_attribs/Test.php b/tests/functional/test_short_for_additional_attribs/Test.php new file mode 100644 index 0000000..8099869 --- /dev/null +++ b/tests/functional/test_short_for_additional_attribs/Test.php @@ -0,0 +1,23 @@ +<?php + +namespace tests\functional\test_short_for_additional_attribs; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $ste->set_var_by_name("data", array( + array('content' => 'foo', 'foo' => true), + array('content' => 'bar', 'foo' => false), + array('content' => 'baz', 'foo' => false), + )); + } +} diff --git a/tests/test_short_for_additional_attribs/test.tpl b/tests/functional/test_short_for_additional_attribs/test.tpl index e6b30e4..e6b30e4 100644 --- a/tests/test_short_for_additional_attribs/test.tpl +++ b/tests/functional/test_short_for_additional_attribs/test.tpl diff --git a/tests/test_short_for_additional_attribs/want b/tests/functional/test_short_for_additional_attribs/want index c46d63f..c46d63f 100644 --- a/tests/test_short_for_additional_attribs/want +++ b/tests/functional/test_short_for_additional_attribs/want diff --git a/tests/functional/test_simple/Test.php b/tests/functional/test_simple/Test.php new file mode 100644 index 0000000..e2b58d9 --- /dev/null +++ b/tests/functional/test_simple/Test.php @@ -0,0 +1,19 @@ +<?php + +namespace tests\functional\test_simple; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $ste->vars["foo"] = "World"; + } +} diff --git a/tests/test_simple/test.tpl b/tests/functional/test_simple/test.tpl index 30a4f22..30a4f22 100644 --- a/tests/test_simple/test.tpl +++ b/tests/functional/test_simple/test.tpl diff --git a/tests/test_simple/want b/tests/functional/test_simple/want index 980a0d5..980a0d5 100644 --- a/tests/test_simple/want +++ b/tests/functional/test_simple/want diff --git a/tests/functional/test_static_numeric_array_access/Test.php b/tests/functional/test_static_numeric_array_access/Test.php new file mode 100644 index 0000000..0c6a853 --- /dev/null +++ b/tests/functional/test_static_numeric_array_access/Test.php @@ -0,0 +1,23 @@ +<?php + +namespace tests\functional\test_static_numeric_array_access; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $ste->set_var_by_name("foo", array( + "foo", + "bar", + "baz", + )); + } +} diff --git a/tests/test_static_numeric_array_access/test.tpl b/tests/functional/test_static_numeric_array_access/test.tpl index a313c6b..a313c6b 100644 --- a/tests/test_static_numeric_array_access/test.tpl +++ b/tests/functional/test_static_numeric_array_access/test.tpl diff --git a/tests/test_static_numeric_array_access/want b/tests/functional/test_static_numeric_array_access/want index 86e041d..86e041d 100644 --- a/tests/test_static_numeric_array_access/want +++ b/tests/functional/test_static_numeric_array_access/want diff --git a/tests/functional/test_tagname/Test.php b/tests/functional/test_tagname/Test.php new file mode 100644 index 0000000..8e3d8f6 --- /dev/null +++ b/tests/functional/test_tagname/Test.php @@ -0,0 +1,33 @@ +<?php + +namespace tests\functional\test_tagname; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $names = array( + "foo", + "ab_cd", + "foo123baz", + "x0123", + ); + + foreach ($names as $name) { + $ste->register_tag( + $name, + function ($ste, $params, $sub) use ($name) { + return $name; + } + ); + } + } +} diff --git a/tests/test_tagname/test.tpl b/tests/functional/test_tagname/test.tpl index 30ca889..30ca889 100644 --- a/tests/test_tagname/test.tpl +++ b/tests/functional/test_tagname/test.tpl diff --git a/tests/test_tagname/want b/tests/functional/test_tagname/want index 3233294..3233294 100644 --- a/tests/test_tagname/want +++ b/tests/functional/test_tagname/want diff --git a/tests/functional/test_trailing_closing_array_bracket/Test.php b/tests/functional/test_trailing_closing_array_bracket/Test.php new file mode 100644 index 0000000..9e6ff2c --- /dev/null +++ b/tests/functional/test_trailing_closing_array_bracket/Test.php @@ -0,0 +1,23 @@ +<?php + +namespace tests\functional\test_trailing_closing_array_bracket; + +use kch42\ste\STECore; +use tests\functional\BaseTest; + +class Test extends BaseTest +{ + protected function getDirectory(): string + { + return __DIR__; + } + + protected function setUpSte(STECore $ste): void + { + $ste->set_var_by_name("foo", array( + "foo", + "bar", + "baz", + )); + } +} diff --git a/tests/test_trailing_closing_array_bracket/test.tpl b/tests/functional/test_trailing_closing_array_bracket/test.tpl index 68f6caa..68f6caa 100644 --- a/tests/test_trailing_closing_array_bracket/test.tpl +++ b/tests/functional/test_trailing_closing_array_bracket/test.tpl diff --git a/tests/test_trailing_closing_array_bracket/want b/tests/functional/test_trailing_closing_array_bracket/want index 86e041d..86e041d 100644 --- a/tests/test_trailing_closing_array_bracket/want +++ b/tests/functional/test_trailing_closing_array_bracket/want diff --git a/tests/mktest.sh b/tests/mktest.sh deleted file mode 100755 index 126aebc..0000000 --- a/tests/mktest.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -mkdir "$1" -touch "$1/test.tpl" -touch "$1/want" - -echo '<?php - -use kch42\ste\STECore; - -function test_func(STECore $ste) -{ - -}' > "$1/code.php" - -echo 'have -*.ast -*.transc.php' > "$1/.gitignore" diff --git a/tests/run_tests.sh b/tests/run_tests.sh deleted file mode 100755 index 4e46977..0000000 --- a/tests/run_tests.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -set -e - -run() { - ( # So we don't have to cd .. - cd "$1" || return 1 - - php ../test.php > have - - printf '\e[1m%s\e[0m: ' "$1" - if sed 's/\s*//' < have | grep -v '^$' | cmp -s want; then - echo "OK" - rm ./*.transc.php - else - echo "FAILED" - for tpl in *.tpl; do - php ../dump_ast.php < "$tpl" > "$tpl.ast" - done - return 1 - fi - ) -} - -run_many() { - retval=0 - while [ $# -gt 0 ]; do - if ! run "$1"; then - retval=1 - fi - - shift - done - - return $retval -} - -if [ $# -eq 0 ]; then - run_many test_* -else - run_many "$@" -fi diff --git a/tests/test.php b/tests/test.php deleted file mode 100644 index 15453b0..0000000 --- a/tests/test.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -require(dirname(__FILE__) . "/../steloader.php"); -require("code.php"); - -use \kch42\ste; - -class TestStorage implements ste\StorageAccess -{ - public function load($tpl, &$mode) - { - $mode = ste\StorageAccess::MODE_SOURCE; - return file_get_contents($tpl); - } - - public function save($tpl, $data, $mode) - { - if ($mode != ste\StorageAccess::MODE_TRANSCOMPILED) { - return; - } - - file_put_contents("$tpl.transc.php", $data); - } -} - -$ste = new ste\STECore(new TestStorage()); -$ste->mute_runtime_errors = false; -test_func($ste); -echo $ste->exectemplate("test.tpl"); diff --git a/tests/test_array/.gitignore b/tests/test_array/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_array/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_array/code.php b/tests/test_array/code.php deleted file mode 100644 index b524c15..0000000 --- a/tests/test_array/code.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -function test_func($ste) -{ - $ste->vars["foo"] = array( - "a" => array( - "blabla" => "OK" - ), - "b" => "bla" - ); - $ste->vars["bar"] = array( - "baz" => "a" - ); -} diff --git a/tests/test_blocks/.gitignore b/tests/test_blocks/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_blocks/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_blocks/code.php b/tests/test_blocks/code.php deleted file mode 100644 index 25e7f00..0000000 --- a/tests/test_blocks/code.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -function test_func($ste) -{ -} diff --git a/tests/test_closure/.gitignore b/tests/test_closure/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_closure/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_closure/code.php b/tests/test_closure/code.php deleted file mode 100644 index 25e7f00..0000000 --- a/tests/test_closure/code.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -function test_func($ste) -{ -} diff --git a/tests/test_escapes/.gitignore b/tests/test_escapes/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_escapes/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_escapes/code.php b/tests/test_escapes/code.php deleted file mode 100644 index a1904c8..0000000 --- a/tests/test_escapes/code.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -function test_func($ste) -{ - $ste->register_tag("my_echo", function ($ste, $params, $sub) { - return $params["text"]; - }); -} diff --git a/tests/test_foreach/.gitignore b/tests/test_foreach/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_foreach/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_foreach/code.php b/tests/test_foreach/code.php deleted file mode 100644 index 60ad311..0000000 --- a/tests/test_foreach/code.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -function test_func($ste) -{ - $ste->vars["foo"] = array( - "a" => array("a" => 100, "b" => 200), - "b" => array("a" => 1, "b" => 2), - "c" => array("a" => 42, "b" => 1337) - ); -} diff --git a/tests/test_getset/.gitignore b/tests/test_getset/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_getset/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_getset/code.php b/tests/test_getset/code.php deleted file mode 100644 index 722af1e..0000000 --- a/tests/test_getset/code.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -function test_func($ste) -{ - $ste->vars["foo"] = "bar"; -} diff --git a/tests/test_loop/.gitignore b/tests/test_loop/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_loop/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_loop/code.php b/tests/test_loop/code.php deleted file mode 100644 index 25e7f00..0000000 --- a/tests/test_loop/code.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -function test_func($ste) -{ -} diff --git a/tests/test_mktag/.gitignore b/tests/test_mktag/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_mktag/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_mktag/code.php b/tests/test_mktag/code.php deleted file mode 100644 index 25e7f00..0000000 --- a/tests/test_mktag/code.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -function test_func($ste) -{ -} diff --git a/tests/test_pseudotags/.gitignore b/tests/test_pseudotags/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_pseudotags/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_pseudotags/code.php b/tests/test_pseudotags/code.php deleted file mode 100644 index 25e7f00..0000000 --- a/tests/test_pseudotags/code.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -function test_func($ste) -{ -} diff --git a/tests/test_recursive/.gitignore b/tests/test_recursive/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_recursive/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_recursive/code.php b/tests/test_recursive/code.php deleted file mode 100644 index 96b967b..0000000 --- a/tests/test_recursive/code.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -function test_func($ste) -{ - $ste->mute_runtime_errors = false; -} diff --git a/tests/test_scoping/.gitignore b/tests/test_scoping/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_scoping/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_scoping/code.php b/tests/test_scoping/code.php deleted file mode 100644 index 25e7f00..0000000 --- a/tests/test_scoping/code.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -function test_func($ste) -{ -} diff --git a/tests/test_short/.gitignore b/tests/test_short/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_short/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_short/code.php b/tests/test_short/code.php deleted file mode 100644 index 25e7f00..0000000 --- a/tests/test_short/code.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -function test_func($ste) -{ -} diff --git a/tests/test_short_for_additional_attribs/.gitignore b/tests/test_short_for_additional_attribs/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_short_for_additional_attribs/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_short_for_additional_attribs/code.php b/tests/test_short_for_additional_attribs/code.php deleted file mode 100644 index 5d75d34..0000000 --- a/tests/test_short_for_additional_attribs/code.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -use kch42\ste\STECore; - -function test_func(STECore $ste) -{ - $ste->set_var_by_name("data", array( - array('content' => 'foo', 'foo' => true), - array('content' => 'bar', 'foo' => false), - array('content' => 'baz', 'foo' => false), - )); -} diff --git a/tests/test_simple/.gitignore b/tests/test_simple/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_simple/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_simple/code.php b/tests/test_simple/code.php deleted file mode 100644 index 2712e2b..0000000 --- a/tests/test_simple/code.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -function test_func($ste) -{ - $ste->vars["foo"] = "World"; -} diff --git a/tests/test_static_numeric_array_access/.gitignore b/tests/test_static_numeric_array_access/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_static_numeric_array_access/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_static_numeric_array_access/code.php b/tests/test_static_numeric_array_access/code.php deleted file mode 100644 index 77f48be..0000000 --- a/tests/test_static_numeric_array_access/code.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -use kch42\ste\STECore; - -function test_func(STECore $ste) -{ - $ste->set_var_by_name("foo", array( - "foo", - "bar", - "baz", - )); -} diff --git a/tests/test_tagname/.gitignore b/tests/test_tagname/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_tagname/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_tagname/code.php b/tests/test_tagname/code.php deleted file mode 100644 index e934989..0000000 --- a/tests/test_tagname/code.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use kch42\ste\STECore; - -function test_func(STECore $ste) -{ - $names = array( - "foo", - "ab_cd", - "foo123baz", - "x0123", - ); - - foreach ($names as $name) { - $ste->register_tag( - $name, - function ($ste, $params, $sub) use ($name) { - return $name; - } - ); - } -} diff --git a/tests/test_trailing_closing_array_bracket/.gitignore b/tests/test_trailing_closing_array_bracket/.gitignore deleted file mode 100644 index de2a41b..0000000 --- a/tests/test_trailing_closing_array_bracket/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -have -*.ast -*.transc.php diff --git a/tests/test_trailing_closing_array_bracket/code.php b/tests/test_trailing_closing_array_bracket/code.php deleted file mode 100644 index 77f48be..0000000 --- a/tests/test_trailing_closing_array_bracket/code.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -use kch42\ste\STECore; - -function test_func(STECore $ste) -{ - $ste->set_var_by_name("foo", array( - "foo", - "bar", - "baz", - )); -} |