Commit 12bac7098d1b40130ab303d0294e6333b565eefd

Authored by Paulo Costa
1 parent 79012a4152
Exists in master

updated components

- add middleware loader
- updated composer libs
app/component/SlimMiddlewareLoader.php
... ... @@ -0,0 +1,50 @@
  1 +<?php
  2 +/*
  3 +* Helper class to load middlewares on your Slim3 application.
  4 +* The middlewares to load can be defined in the configuration file using the
  5 +* slim_middlewares property.
  6 +*/
  7 +
  8 +namespace Fccn\WebComponents;
  9 +
  10 +class SlimMiddlewareLoader
  11 +{
  12 + private $middlewares;
  13 + private $app;
  14 +
  15 + public function __construct($app)
  16 + {
  17 + $config = \Fccn\Lib\SiteConfig::getInstance();
  18 + //load middleware classes from config file
  19 + $this->middlewares = $config->get('slim_middlewares');
  20 + $this->app = $app;
  21 + }
  22 +
  23 + /*
  24 + * loads a specific middleware in the application
  25 + */
  26 + public function load($middleware_name)
  27 + {
  28 + if (isset($this->middlewares[$middleware_name])) {
  29 + $middleware = $this->middlewares[$middleware_name];
  30 + if (!empty($middleware)) {
  31 + $this->app->add($middleware);
  32 + return true;
  33 + }
  34 + \Fccn\Lib\FileLogger::debug("SlimMiddlewareLoader::load middleware [$middleware_name] is not valid");
  35 + } else {
  36 + \Fccn\Lib\FileLogger::debug("SlimMiddlewareLoader::load there is no record for middleware [$middleware_name]");
  37 + }
  38 + return false;
  39 + }
  40 +
  41 + /*
  42 + * loads all middlewares preset in the configuration file
  43 + */
  44 + public function loadAll()
  45 + {
  46 + foreach ($this->middlewares as $name => $middleware) {
  47 + $this->load($name);
  48 + }
  49 + }
  50 +}
... ...
composer.json
... ... @@ -12,7 +12,9 @@
12 12 "require": {
13 13 "php": ">=5.5.0",
14 14 "fccn/webapp-tools-common": "^1.0",
15   - "fccn/webapp-tools-translate": "^1.0"
  15 + "fccn/webapp-tools-translate": "^1.0",
  16 + "jswhetstone/twig-extension": "dev-master",
  17 + "twig/extensions": "^1.5"
16 18 },
17 19 "autoload":{
18 20 "psr-4": {
... ...
composer.lock
... ... @@ -4,7 +4,7 @@
4 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5 "This file is @generated automatically"
6 6 ],
7   - "content-hash": "e0e57d0165de752dafb01df0ce671b7a",
  7 + "content-hash": "af14fa5939f102fc7b51ba30e13dfacf",
8 8 "packages": [
9 9 {
10 10 "name": "fccn/webapp-tools-common",
... ... @@ -54,30 +54,34 @@
54 54 },
55 55 {
56 56 "name": "fccn/webapp-tools-translate",
57   - "version": "1.0.1",
  57 + "version": "1.1",
58 58 "source": {
59 59 "type": "git",
60 60 "url": "https://github.com/fccn/wt-translate.git",
61   - "reference": "c8a264cd64edc8fd5902f01e3630a6bba665d499"
  61 + "reference": "fdde95f2090e7496c53473f7612b293cfe318e4f"
62 62 },
63 63 "dist": {
64 64 "type": "zip",
65   - "url": "https://api.github.com/repos/fccn/wt-translate/zipball/c8a264cd64edc8fd5902f01e3630a6bba665d499",
66   - "reference": "c8a264cd64edc8fd5902f01e3630a6bba665d499",
  65 + "url": "https://api.github.com/repos/fccn/wt-translate/zipball/fdde95f2090e7496c53473f7612b293cfe318e4f",
  66 + "reference": "fdde95f2090e7496c53473f7612b293cfe318e4f",
67 67 "shasum": ""
68 68 },
69 69 "require": {
70 70 "fccn/webapp-tools-common": "^1.0",
71   - "php": ">=5.5.0",
  71 + "php": ">=7.0",
72 72 "slim/twig-view": "^2.3"
73 73 },
74 74 "require-dev": {
75   - "codeception/codeception": "^2.3"
  75 + "codeception/codeception": "^2.3",
  76 + "herloct/codeception-slim-module": "^1.1",
  77 + "slim/slim": "^3.9",
  78 + "twig/extensions": "^1.5"
76 79 },
77 80 "type": "library",
78 81 "autoload": {
79 82 "psr-4": {
80   - "Fccn\\Lib\\": "src"
  83 + "Fccn\\Lib\\": "src",
  84 + "Fccn\\WebComponents\\": "src/web_components"
81 85 }
82 86 },
83 87 "notification-url": "https://packagist.org/downloads/",
... ... @@ -96,7 +100,7 @@
96 100 "gettex",
97 101 "webapp-tools"
98 102 ],
99   - "time": "2017-11-06T16:14:27+00:00"
  103 + "time": "2018-01-26T10:57:54+00:00"
100 104 },
101 105 {
102 106 "name": "ircmaxell/random-lib",
... ... @@ -200,6 +204,33 @@
200 204 "time": "2015-03-20T14:31:23+00:00"
201 205 },
202 206 {
  207 + "name": "jswhetstone/twig-extension",
  208 + "version": "dev-master",
  209 + "source": {
  210 + "type": "git",
  211 + "url": "https://github.com/jswhetstone/twig-extension.git",
  212 + "reference": "9a8b18d9a263b89a3639fd141d8a8f7f4bc4e303"
  213 + },
  214 + "dist": {
  215 + "type": "zip",
  216 + "url": "https://api.github.com/repos/jswhetstone/twig-extension/zipball/9a8b18d9a263b89a3639fd141d8a8f7f4bc4e303",
  217 + "reference": "9a8b18d9a263b89a3639fd141d8a8f7f4bc4e303",
  218 + "shasum": ""
  219 + },
  220 + "type": "library",
  221 + "autoload": {
  222 + "psr-0": {
  223 + "JSW\\Twig": "src"
  224 + }
  225 + },
  226 + "notification-url": "https://packagist.org/downloads/",
  227 + "license": [
  228 + "WTFPL"
  229 + ],
  230 + "description": "A Twig extension providing convenience methods for context-specific HTML classes.",
  231 + "time": "2014-06-18T19:03:05+00:00"
  232 + },
  233 + {
203 234 "name": "monolog/monolog",
204 235 "version": "1.23.0",
205 236 "source": {
... ... @@ -484,6 +515,62 @@
484 515 "time": "2017-10-11T12:05:26+00:00"
485 516 },
486 517 {
  518 + "name": "twig/extensions",
  519 + "version": "v1.5.1",
  520 + "source": {
  521 + "type": "git",
  522 + "url": "https://github.com/twigphp/Twig-extensions.git",
  523 + "reference": "d188c76168b853481cc75879ea045bf93d718e9c"
  524 + },
  525 + "dist": {
  526 + "type": "zip",
  527 + "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/d188c76168b853481cc75879ea045bf93d718e9c",
  528 + "reference": "d188c76168b853481cc75879ea045bf93d718e9c",
  529 + "shasum": ""
  530 + },
  531 + "require": {
  532 + "twig/twig": "~1.27|~2.0"
  533 + },
  534 + "require-dev": {
  535 + "symfony/phpunit-bridge": "~3.3@dev",
  536 + "symfony/translation": "~2.3|~3.0"
  537 + },
  538 + "suggest": {
  539 + "symfony/translation": "Allow the time_diff output to be translated"
  540 + },
  541 + "type": "library",
  542 + "extra": {
  543 + "branch-alias": {
  544 + "dev-master": "1.5-dev"
  545 + }
  546 + },
  547 + "autoload": {
  548 + "psr-0": {
  549 + "Twig_Extensions_": "lib/"
  550 + },
  551 + "psr-4": {
  552 + "Twig\\Extensions\\": "src/"
  553 + }
  554 + },
  555 + "notification-url": "https://packagist.org/downloads/",
  556 + "license": [
  557 + "MIT"
  558 + ],
  559 + "authors": [
  560 + {
  561 + "name": "Fabien Potencier",
  562 + "email": "fabien@symfony.com"
  563 + }
  564 + ],
  565 + "description": "Common additional features for Twig that do not directly belong in core",
  566 + "homepage": "http://twig.sensiolabs.org/doc/extensions/index.html",
  567 + "keywords": [
  568 + "i18n",
  569 + "text"
  570 + ],
  571 + "time": "2017-06-08T18:19:53+00:00"
  572 + },
  573 + {
487 574 "name": "twig/twig",
488 575 "version": "v2.4.4",
489 576 "source": {
... ... @@ -612,20 +699,21 @@
612 699 },
613 700 {
614 701 "name": "codeception/codeception",
615   - "version": "2.3.7",
  702 + "version": "2.3.8",
616 703 "source": {
617 704 "type": "git",
618 705 "url": "https://github.com/Codeception/Codeception.git",
619   - "reference": "151de88277878adc18784ef3eaddd87f4a2fdc14"
  706 + "reference": "43eade17a8cd68e9cde401e8585b09d11d41b12d"
620 707 },
621 708 "dist": {
622 709 "type": "zip",
623   - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/151de88277878adc18784ef3eaddd87f4a2fdc14",
624   - "reference": "151de88277878adc18784ef3eaddd87f4a2fdc14",
  710 + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/43eade17a8cd68e9cde401e8585b09d11d41b12d",
  711 + "reference": "43eade17a8cd68e9cde401e8585b09d11d41b12d",
625 712 "shasum": ""
626 713 },
627 714 "require": {
628 715 "behat/gherkin": "~4.4.0",
  716 + "codeception/stub": "^1.0",
629 717 "ext-json": "*",
630 718 "ext-mbstring": "*",
631 719 "facebook/webdriver": ">=1.1.3 <2.0",
... ... @@ -634,7 +722,6 @@
634 722 "php": ">=5.4.0 <8.0",
635 723 "phpunit/php-code-coverage": ">=2.2.4 <6.0",
636 724 "phpunit/phpunit": ">=4.8.28 <5.0.0 || >=5.6.3 <7.0",
637   - "phpunit/phpunit-mock-objects": ">2.3 <5.0",
638 725 "sebastian/comparator": ">1.1 <3.0",
639 726 "sebastian/diff": ">=1.4 <3.0",
640 727 "symfony/browser-kit": ">=2.7 <5.0",
... ... @@ -649,8 +736,6 @@
649 736 "codeception/specify": "~0.3",
650 737 "facebook/graph-sdk": "~5.3",
651 738 "flow/jsonpath": "~0.2",
652   - "league/factory-muffin": "^3.0",
653   - "league/factory-muffin-faker": "^1.0",
654 739 "monolog/monolog": "~1.8",
655 740 "pda/pheanstalk": "~3.0",
656 741 "php-amqplib/php-amqplib": "~2.4",
... ... @@ -704,7 +789,40 @@
704 789 "functional testing",
705 790 "unit testing"
706 791 ],
707   - "time": "2017-12-12T04:22:17+00:00"
  792 + "time": "2018-01-27T22:47:33+00:00"
  793 + },
  794 + {
  795 + "name": "codeception/stub",
  796 + "version": "1.0.1",
  797 + "source": {
  798 + "type": "git",
  799 + "url": "https://github.com/Codeception/Stub.git",
  800 + "reference": "673ea54cdd7141e0a5138ad78aaa60751912f573"
  801 + },
  802 + "dist": {
  803 + "type": "zip",
  804 + "url": "https://api.github.com/repos/Codeception/Stub/zipball/673ea54cdd7141e0a5138ad78aaa60751912f573",
  805 + "reference": "673ea54cdd7141e0a5138ad78aaa60751912f573",
  806 + "shasum": ""
  807 + },
  808 + "require": {
  809 + "phpunit/phpunit-mock-objects": "^2.3|^3.0|^4.0|^5.0"
  810 + },
  811 + "require-dev": {
  812 + "phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0"
  813 + },
  814 + "type": "library",
  815 + "autoload": {
  816 + "psr-4": {
  817 + "Codeception\\": "src/"
  818 + }
  819 + },
  820 + "notification-url": "https://packagist.org/downloads/",
  821 + "license": [
  822 + "MIT"
  823 + ],
  824 + "description": "Flexible Stub wrapper for PHPUnit's Mock Builder",
  825 + "time": "2018-01-27T00:37:17+00:00"
708 826 },
709 827 {
710 828 "name": "container-interop/container-interop",
... ... @@ -1314,16 +1432,16 @@
1314 1432 },
1315 1433 {
1316 1434 "name": "phpdocumentor/reflection-docblock",
1317   - "version": "4.2.0",
  1435 + "version": "4.3.0",
1318 1436 "source": {
1319 1437 "type": "git",
1320 1438 "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
1321   - "reference": "66465776cfc249844bde6d117abff1d22e06c2da"
  1439 + "reference": "94fd0001232e47129dd3504189fa1c7225010d08"
1322 1440 },
1323 1441 "dist": {
1324 1442 "type": "zip",
1325   - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da",
1326   - "reference": "66465776cfc249844bde6d117abff1d22e06c2da",
  1443 + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08",
  1444 + "reference": "94fd0001232e47129dd3504189fa1c7225010d08",
1327 1445 "shasum": ""
1328 1446 },
1329 1447 "require": {
... ... @@ -1361,7 +1479,7 @@
1361 1479 }
1362 1480 ],
1363 1481 "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
1364   - "time": "2017-11-27T17:38:31+00:00"
  1482 + "time": "2017-11-30T07:14:17+00:00"
1365 1483 },
1366 1484 {
1367 1485 "name": "phpdocumentor/type-resolver",
... ... @@ -1724,16 +1842,16 @@
1724 1842 },
1725 1843 {
1726 1844 "name": "phpunit/phpunit",
1727   - "version": "6.4.4",
  1845 + "version": "6.5.5",
1728 1846 "source": {
1729 1847 "type": "git",
1730 1848 "url": "https://github.com/sebastianbergmann/phpunit.git",
1731   - "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932"
  1849 + "reference": "83d27937a310f2984fd575686138597147bdc7df"
1732 1850 },
1733 1851 "dist": {
1734 1852 "type": "zip",
1735   - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/562f7dc75d46510a4ed5d16189ae57fbe45a9932",
1736   - "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932",
  1853 + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/83d27937a310f2984fd575686138597147bdc7df",
  1854 + "reference": "83d27937a310f2984fd575686138597147bdc7df",
1737 1855 "shasum": ""
1738 1856 },
1739 1857 "require": {
... ... @@ -1747,12 +1865,12 @@
1747 1865 "phar-io/version": "^1.0",
1748 1866 "php": "^7.0",
1749 1867 "phpspec/prophecy": "^1.7",
1750   - "phpunit/php-code-coverage": "^5.2.2",
1751   - "phpunit/php-file-iterator": "^1.4.2",
  1868 + "phpunit/php-code-coverage": "^5.3",
  1869 + "phpunit/php-file-iterator": "^1.4.3",
1752 1870 "phpunit/php-text-template": "^1.2.1",
1753 1871 "phpunit/php-timer": "^1.0.9",
1754   - "phpunit/phpunit-mock-objects": "^4.0.3",
1755   - "sebastian/comparator": "^2.0.2",
  1872 + "phpunit/phpunit-mock-objects": "^5.0.5",
  1873 + "sebastian/comparator": "^2.1",
1756 1874 "sebastian/diff": "^2.0",
1757 1875 "sebastian/environment": "^3.1",
1758 1876 "sebastian/exporter": "^3.1",
... ... @@ -1778,7 +1896,7 @@
1778 1896 "type": "library",
1779 1897 "extra": {
1780 1898 "branch-alias": {
1781   - "dev-master": "6.4.x-dev"
  1899 + "dev-master": "6.5.x-dev"
1782 1900 }
1783 1901 },
1784 1902 "autoload": {
... ... @@ -1804,33 +1922,33 @@
1804 1922 "testing",
1805 1923 "xunit"
1806 1924 ],
1807   - "time": "2017-11-08T11:26:09+00:00"
  1925 + "time": "2017-12-17T06:31:19+00:00"
1808 1926 },
1809 1927 {
1810 1928 "name": "phpunit/phpunit-mock-objects",
1811   - "version": "4.0.4",
  1929 + "version": "5.0.6",
1812 1930 "source": {
1813 1931 "type": "git",
1814 1932 "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
1815   - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0"
  1933 + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf"
1816 1934 },
1817 1935 "dist": {
1818 1936 "type": "zip",
1819   - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0",
1820   - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0",
  1937 + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf",
  1938 + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf",
1821 1939 "shasum": ""
1822 1940 },
1823 1941 "require": {
1824 1942 "doctrine/instantiator": "^1.0.5",
1825 1943 "php": "^7.0",
1826 1944 "phpunit/php-text-template": "^1.2.1",
1827   - "sebastian/exporter": "^3.0"
  1945 + "sebastian/exporter": "^3.1"
1828 1946 },
1829 1947 "conflict": {
1830 1948 "phpunit/phpunit": "<6.0"
1831 1949 },
1832 1950 "require-dev": {
1833   - "phpunit/phpunit": "^6.0"
  1951 + "phpunit/phpunit": "^6.5"
1834 1952 },
1835 1953 "suggest": {
1836 1954 "ext-soap": "*"
... ... @@ -1838,7 +1956,7 @@
1838 1956 "type": "library",
1839 1957 "extra": {
1840 1958 "branch-alias": {
1841   - "dev-master": "4.0.x-dev"
  1959 + "dev-master": "5.0.x-dev"
1842 1960 }
1843 1961 },
1844 1962 "autoload": {
... ... @@ -1853,7 +1971,7 @@
1853 1971 "authors": [
1854 1972 {
1855 1973 "name": "Sebastian Bergmann",
1856   - "email": "sb@sebastian-bergmann.de",
  1974 + "email": "sebastian@phpunit.de",
1857 1975 "role": "lead"
1858 1976 }
1859 1977 ],
... ... @@ -1863,7 +1981,7 @@
1863 1981 "mock",
1864 1982 "xunit"
1865 1983 ],
1866   - "time": "2017-08-03T14:08:16+00:00"
  1984 + "time": "2018-01-06T05:45:45+00:00"
1867 1985 },
1868 1986 {
1869 1987 "name": "pimple/pimple",
... ... @@ -3140,7 +3258,9 @@
3140 3258 ],
3141 3259 "aliases": [],
3142 3260 "minimum-stability": "stable",
3143   - "stability-flags": [],
  3261 + "stability-flags": {
  3262 + "jswhetstone/twig-extension": 20
  3263 + },
3144 3264 "prefer-stable": false,
3145 3265 "prefer-lowest": false,
3146 3266 "platform": {
... ...
tests/_data/config.php
... ... @@ -30,8 +30,15 @@ $c = array(
30 30  
31 31 #---- External libraries loader --------------------
32 32 "ext_libs_loader_service_name" => 'loader',
33   -
  33 +
34 34 "ext_libs" => array(
35 35 "my_lib" => __DIR__."/vendor/test/lib.js"
36 36 ),
  37 +
  38 +#---- Slim Middleware loader --------------------
  39 +
  40 + "slim_middlewares" => array(
  41 + "my_test_middleware" => new \Fccn\Tests\MyMiddleware(),
  42 + ),
  43 +
37 44 );
... ...
tests/_support/MyMiddleware.php
... ... @@ -0,0 +1,36 @@
  1 +<?php
  2 +
  3 +/*
  4 +* Sample middleware class to be used on tests
  5 +*/
  6 +
  7 +namespace Fccn\Tests;
  8 +
  9 +use Psr\Http\Message\ServerRequestInterface as Request;
  10 +use Psr\Http\Message\ResponseInterface as Response;
  11 +
  12 +class MyMiddleware
  13 +{
  14 + /*
  15 + * Middleware constructor
  16 + *
  17 + */
  18 + public function __construct()
  19 + {
  20 + }
  21 +
  22 + /**
  23 + * Locale middleware invokable class
  24 + *
  25 + * @param \Psr\Http\Message\ServerRequestInterface $request PSR7 request
  26 + * @param \Psr\Http\Message\ResponseInterface $response PSR7 response
  27 + * @param callable $next Next middleware
  28 + *
  29 + * @return \Psr\Http\Message\ResponseInterface
  30 + */
  31 + public function __invoke(Request $req, Response $resp, callable $next)
  32 + {
  33 + $response->getBody()->write('MY MIDDLEWARE INSERTION');
  34 + return $next($req, $resp);
  35 + }
  36 +}
... ...
tests/_support/_generated/AcceptanceTesterActions.php
1   -<?php //[STAMP] 0039bd0f73f4e8daa757ba67b319aa49
  1 +<?php //[STAMP] 359d6fae1f1f3c1ec599797e12b9016e
2 2 namespace _generated;
3 3  
4 4 // This class was automatically generated by build task
5 5 // You should not change it manually as it will be overwritten on next build
6 6 // @codingStandardsIgnoreFile
7 7  
8   -use Codeception\Module\PhpBrowser;
9   -use Helper\Acceptance;
10   -
11 8 trait AcceptanceTesterActions
12 9 {
13 10 /**
... ...
tests/_support/_generated/FunctionalTesterActions.php
1   -<?php //[STAMP] ae06983dfa6bdba4e227e9d1dda76a9e
  1 +<?php //[STAMP] 1cd7ceccc2583c1f869103f9abc01698
2 2 namespace _generated;
3 3  
4 4 // This class was automatically generated by build task
5 5 // You should not change it manually as it will be overwritten on next build
6 6 // @codingStandardsIgnoreFile
7 7  
8   -use Helper\Functional;
9   -use Herloct\Codeception\Module\Slim;
10   -use Codeception\Module\REST;
11   -
12 8 trait FunctionalTesterActions
13 9 {
14 10 /**
... ... @@ -2378,6 +2374,37 @@ trait FunctionalTesterActions
2378 2374 /**
2379 2375 * [!] Method is generated. Documentation taken from corresponding module.
2380 2376 *
  2377 + * Allows to send REST request using AWS Authorization
  2378 + * Only works with PhpBrowser
  2379 + * Example
  2380 + * Config -
  2381 + *
  2382 + * modules:
  2383 + * enabled:
  2384 + * - REST:
  2385 + * aws:
  2386 + * key: accessKey
  2387 + * secret: accessSecret
  2388 + * service: awsService
  2389 + * region: awsRegion
  2390 + *
  2391 + * ```php
  2392 + * <?php
  2393 + * $I->amAWSAuthenticated();
  2394 + * ?>
  2395 + * ```
  2396 + * @param array $additionalAWSConfig
  2397 + * @throws ModuleException
  2398 + * @see \Codeception\Module\REST::amAWSAuthenticated()
  2399 + */
  2400 + public function amAWSAuthenticated($additionalAWSConfig = null) {
  2401 + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amAWSAuthenticated', func_get_args()));
  2402 + }
  2403 +
  2404 +
  2405 + /**
  2406 + * [!] Method is generated. Documentation taken from corresponding module.
  2407 + *
2381 2408 * Sends a POST request to given uri. Parameters and files can be provided separately.
2382 2409 *
2383 2410 * Example:
... ...
tests/_support/_generated/UnitTesterActions.php
1   -<?php //[STAMP] 5648e2ecd2668319703f108f1329e8a8
  1 +<?php //[STAMP] 944b755085a310113b19d30e9d04d255
2 2 namespace _generated;
3 3  
4 4 // This class was automatically generated by build task
5 5 // You should not change it manually as it will be overwritten on next build
6 6 // @codingStandardsIgnoreFile
7 7  
8   -use Codeception\Module\Asserts;
9   -use Helper\Unit;
10   -
11 8 trait UnitTesterActions
12 9 {
13 10 /**
... ...
tests/unit/SlimMiddlewareLoaderTest.php
... ... @@ -0,0 +1,24 @@
  1 +<?php
  2 +
  3 +
  4 +class SlimMiddlewareLoaderTest extends \Codeception\Test\Unit
  5 +{
  6 + /**
  7 + * @var \UnitTester
  8 + */
  9 + protected $tester;
  10 + private $config;
  11 +
  12 + protected function _before()
  13 + {
  14 + $this->config = \Fccn\Lib\SiteConfig::getInstance();
  15 + $this->app = new Slim\App();
  16 + }
  17 +
  18 + // tests
  19 + public function testLoad()
  20 + {
  21 + $loader = new \Fccn\WebComponents\SlimMiddlewareLoader($this->app);
  22 + $this->assertTrue($loader->load('my_test_middleware'));
  23 + }
  24 +}
... ...