Commit 6a1a8aaba66d753e4a4bc8b255c767e375045d9b

Authored by root@webrtc-hub
1 parent e7830f703f
Exists in master

Reorganized web component autoloading and added controller action

- addded Fccn\Lib components
- moved Fccn\Webcomponents source folder
- added action for library loading URL
1 vendor/** 1 vendor/**
  2 +tests/_output/*
2 tests/_output/logs/** 3 tests/_output/logs/**
CONTRIBUTING.md
@@ -0,0 +1,92 @@ @@ -0,0 +1,92 @@
  1 +# Contributing
  2 +
  3 +When contributing to this repository, please first discuss the change you wish to make via issue,
  4 +email, or any other method with the owners of this repository before making a change.
  5 +
  6 +Please note we have a code of conduct, please follow it in all your interactions with the project.
  7 +
  8 +## Pull Request Process
  9 +
  10 +1. Ensure any install or build dependencies are removed before the end of the layer when doing a
  11 + build.
  12 +2. Update the README.md with details of changes to the interface, this includes new environment
  13 + variables, exposed ports, useful file locations and container parameters.
  14 +3. Increase the version numbers in any examples files and the README.md to the new version that this
  15 + Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
  16 +4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
  17 + do not have permission to do that, you may request the second reviewer to merge it for you.
  18 +
  19 +## Code of Conduct
  20 +
  21 +### Our Pledge
  22 +
  23 +In the interest of fostering an open and welcoming environment, we as
  24 +contributors and maintainers pledge to making participation in our project and
  25 +our community a harassment-free experience for everyone, regardless of age, body
  26 +size, disability, ethnicity, gender identity and expression, level of experience,
  27 +nationality, personal appearance, race, religion, or sexual identity and
  28 +orientation.
  29 +
  30 +### Our Standards
  31 +
  32 +Examples of behavior that contributes to creating a positive environment
  33 +include:
  34 +
  35 +* Using welcoming and inclusive language
  36 +* Being respectful of differing viewpoints and experiences
  37 +* Gracefully accepting constructive criticism
  38 +* Focusing on what is best for the community
  39 +* Showing empathy towards other community members
  40 +
  41 +Examples of unacceptable behavior by participants include:
  42 +
  43 +* The use of sexualized language or imagery and unwelcome sexual attention or
  44 +advances
  45 +* Trolling, insulting/derogatory comments, and personal or political attacks
  46 +* Public or private harassment
  47 +* Publishing others' private information, such as a physical or electronic
  48 + address, without explicit permission
  49 +* Other conduct which could reasonably be considered inappropriate in a
  50 + professional setting
  51 +
  52 +### Our Responsibilities
  53 +
  54 +Project maintainers are responsible for clarifying the standards of acceptable
  55 +behavior and are expected to take appropriate and fair corrective action in
  56 +response to any instances of unacceptable behavior.
  57 +
  58 +Project maintainers have the right and responsibility to remove, edit, or
  59 +reject comments, commits, code, wiki edits, issues, and other contributions
  60 +that are not aligned to this Code of Conduct, or to ban temporarily or
  61 +permanently any contributor for other behaviors that they deem inappropriate,
  62 +threatening, offensive, or harmful.
  63 +
  64 +### Scope
  65 +
  66 +This Code of Conduct applies both within project spaces and in public spaces
  67 +when an individual is representing the project or its community. Examples of
  68 +representing a project or community include using an official project e-mail
  69 +address, posting via an official social media account, or acting as an appointed
  70 +representative at an online or offline event. Representation of a project may be
  71 +further defined and clarified by project maintainers.
  72 +
  73 +### Enforcement
  74 +
  75 +Instances of abusive, harassing, or otherwise unacceptable behavior may be
  76 +reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
  77 +complaints will be reviewed and investigated and will result in a response that
  78 +is deemed necessary and appropriate to the circumstances. The project team is
  79 +obligated to maintain confidentiality with regard to the reporter of an incident.
  80 +Further details of specific enforcement policies may be posted separately.
  81 +
  82 +Project maintainers who do not follow or enforce the Code of Conduct in good
  83 +faith may face temporary or permanent repercussions as determined by other
  84 +members of the project's leadership.
  85 +
  86 +### Attribution
  87 +
  88 +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
  89 +available at [http://contributor-covenant.org/version/1/4][version]
  90 +
  91 +[homepage]: http://contributor-covenant.org
  92 +[version]: http://contributor-covenant.org/version/1/4/
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 This presents a collection of web components to integrate with the [FCCN's webapp skeleton](https://github.com/fccn/webapp-skeleton.git) project. The following components are provided: 3 This presents a collection of web components to integrate with the [FCCN's webapp skeleton](https://github.com/fccn/webapp-skeleton.git) project. The following components are provided:
4 4
5 - External libraries loader - loads external javascript libraries installed by composer and npm. 5 - External libraries loader - loads external javascript libraries installed by composer and npm.
  6 +- Language Switcher Action - Controller action for switching the site language
6 7
7 ## Installation 8 ## Installation
8 9
@@ -34,16 +35,61 @@ For cleaner paths it is advised to create variables for the node modules and ven @@ -34,16 +35,61 @@ For cleaner paths it is advised to create variables for the node modules and ven
34 35
35 ``` 36 ```
36 You can than add the following key-value pairs to the config file's *$c* array: 37 You can than add the following key-value pairs to the config file's *$c* array:
  38 +
37 ```php 39 ```php
38 //---- External libraries loader -------------------- 40 //---- External libraries loader --------------------
  41 +"ext_libs_loader_service_name" => 'loader', #name of the loader service in Slim container
39 "ext_libs" => array( 42 "ext_libs" => array(
40 //add libraries with the format name => path like for example: 43 //add libraries with the format name => path like for example:
41 "headjs" => $node_mods_path."/headjs/dist/1.0.0/head.min.js", 44 "headjs" => $node_mods_path."/headjs/dist/1.0.0/head.min.js",
42 45
43 ); 46 );
  47 +```
  48 +
  49 +The example below shows how to create a new Slim service for the external library loader
44 50
  51 +```php
  52 +
  53 +$app = new Slim\App();
  54 +$c = $app->container();
45 55
  56 +//setup ext libs loader
  57 +$cnt_name = \Fccn\Lib\SiteConfig::getInstance()->get('ext_libs_loader_service_name');
  58 +$c[$cnt_name] = function($cnt){
  59 + $loader = \Fccn\WebComponents\ExtLibsLoader::getInstance();
  60 + return $loader;
  61 +}
46 ``` 62 ```
47 63
  64 +You can associate a URL path for loading external libraries using the provided controller action - LoadExternalJSAction. The example below shows how to set the *<site-url>/script/lib/{libname}* path to the action controller:
  65 +
  66 +```php
  67 +
  68 +$app = new Slim\App();
  69 +
  70 +#set route for load library action
  71 +$app->get('/script/lib/{libname}', Fccn\WebComponents\LoadExternalJsAction::class);
  72 +
  73 +```
48 74
49 ## Usage 75 ## Usage
  76 +
  77 +### External libraries loader
  78 +
  79 +To load the external library just point to the URL you have configured in the Slim routes with the name of the library.
  80 +
  81 +## Testing
  82 +
  83 +This project uses codeception for testing. To run the tests call ``composer test`` on the root of the project folder.
  84 +
  85 +## Contributing
  86 +
  87 +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
  88 +
  89 +## Versioning
  90 +
  91 +We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/fccn/wt-translate/tags).
  92 +
  93 +## License
  94 +
  95 +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
app/ExtLibsLoader.php
@@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
1 -<?php  
2 -/*  
3 -* Singleton class to load external web resources located in vendor and node modules folders  
4 -*/  
5 -  
6 -namespace Fccn\WebComponents;  
7 -  
8 -class ExtLibsLoader  
9 -{  
10 - private static $instance;  
11 - private $libraries;  
12 -  
13 - public function __construct()  
14 - {  
15 - $config = \Fccn\Lib\SiteConfig::getInstance();  
16 - //load library paths from config file  
17 - $this->libraries = $config->get('ext_libs');  
18 - }  
19 -  
20 - public static function getInstance()  
21 - {  
22 - if (!ExtLibsLoader::$instance instanceof self) {  
23 - ExtLibsLoader::$instance = new self();  
24 - }  
25 -  
26 - return ExtLibsLoader::$instance;  
27 - }  
28 -  
29 - /*  
30 - * checks if library is registered and file exists  
31 - */  
32 - public function exists($lib_name)  
33 - {  
34 - if (isset($this->libraries[$lib_name])) {  
35 - $path = $this->libraries[$lib_name];  
36 - \Fccn\Lib\FileLogger::debug("ExtLibsLoader::exists there is a record for library [$lib_name], located in: $path");  
37 - return file_exists($path);  
38 - }  
39 - return false;  
40 - }  
41 -  
42 - public function load($lib_name)  
43 - {  
44 - if ($this->exists($lib_name)) {  
45 - return file_get_contents($this->libraries[$lib_name]);  
46 - }  
47 - return false;  
48 - }  
49 -  
50 - public function add($lib_name, $path)  
51 - {  
52 - if (!file_exists($path)) {  
53 - \Fccn\Lib\FileLogger::error("ExtLibsLoader::add - Could not find library - $lib_name - in path: $path");  
54 - }  
55 - $this->libraries[$lib_name] = $path;  
56 - }  
57 -}  
app/component/ExtLibsLoader.php
@@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
  1 +<?php
  2 +/*
  3 +* Singleton class to load external web resources located in vendor and node modules folders
  4 +*/
  5 +
  6 +namespace Fccn\WebComponents;
  7 +
  8 +class ExtLibsLoader
  9 +{
  10 + private static $instance;
  11 + private $libraries;
  12 +
  13 + public function __construct()
  14 + {
  15 + $config = \Fccn\Lib\SiteConfig::getInstance();
  16 + //load library paths from config file
  17 + $this->libraries = $config->get('ext_libs');
  18 + }
  19 +
  20 + public static function getInstance()
  21 + {
  22 + if (!ExtLibsLoader::$instance instanceof self) {
  23 + ExtLibsLoader::$instance = new self();
  24 + }
  25 +
  26 + return ExtLibsLoader::$instance;
  27 + }
  28 +
  29 + /*
  30 + * checks if library is registered and file exists
  31 + */
  32 + public function exists($lib_name)
  33 + {
  34 + if (isset($this->libraries[$lib_name])) {
  35 + $path = $this->libraries[$lib_name];
  36 + \Fccn\Lib\FileLogger::debug("ExtLibsLoader::exists there is a record for library [$lib_name], located in: $path");
  37 + return file_exists($path);
  38 + }
  39 + return false;
  40 + }
  41 +
  42 + public function load($lib_name)
  43 + {
  44 + if ($this->exists($lib_name)) {
  45 + return file_get_contents($this->libraries[$lib_name]);
  46 + }
  47 + return false;
  48 + }
  49 +
  50 + public function add($lib_name, $path)
  51 + {
  52 + if (!file_exists($path)) {
  53 + \Fccn\Lib\FileLogger::error("ExtLibsLoader::add - Could not find library - $lib_name - in path: $path");
  54 + }
  55 + $this->libraries[$lib_name] = $path;
  56 + }
  57 +}
app/component/LoadExternalJsAction.php
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
  1 +<?php
  2 +/*
  3 +* Slim invokable controller to load external javascript files given a library name
  4 +* Requires Slim container to have an ExtLibsLoader service
  5 +*/
  6 +
  7 +namespace Fccn\WebComponents;
  8 +
  9 +use Psr\Container\ContainerInterface;
  10 +
  11 +use Psr\Http\Message\ServerRequestInterface as Request;
  12 +use Psr\Http\Message\ResponseInterface as Response;
  13 +
  14 +use Fccn\Lib\SiteConfig as SiteConfig;
  15 +use Fccn\Lib\FileLogger as FileLogger;
  16 +use Fccn\Lib\Locale as Locale;
  17 +
  18 +class LoadExternalJsAction
  19 +{
  20 + protected $container;
  21 +
  22 + public function __construct(ContainerInterface $container)
  23 + {
  24 + $this->container = $container;
  25 + \Fccn\Lib\FileLogger::debug("LoadExternalJsAction - initialization");
  26 + }
  27 +
  28 + #loads javascript given a name
  29 + public function __invoke(Request $request, Response $response, $args)
  30 + {
  31 + \Fccn\Lib\FileLogger::debug("application container: ".print_r($this->container, true));
  32 + $loader_srv_name = \Fccn\Lib\SiteConfig::getInstance()->get('ext_libs_loader_service_name');
  33 + if (empty($this->container[$loader_srv_name])) {
  34 + \Fccn\Lib\FileLogger::error("GET script/lib - no loader service found");
  35 + //send not found
  36 + return $response->withStatus(404);
  37 + }
  38 + $contents = $this->container[$loader_srv_name]->load($args['libname']);
  39 + $new_resp = $response->withHeader('Content-type', 'application/javascript');
  40 + $body = $new_resp->getBody();
  41 + if (!empty($contents)) {
  42 + #$this->logger->debug("GET script/lib - writing contents to response body");
  43 + $body->write($contents);
  44 + } else {
  45 + \Fccn\Lib\FileLogger::error("GET script/lib - library <$args[libname]> not found");
  46 + //send not found
  47 + return $new_resp->withStatus(404);
  48 + }
  49 + return $new_resp;
  50 + }
  51 +}
app/lib/ConfigLoader.php
@@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
  1 +<?php
  2 +/*
  3 +* Loads configurations to the web application
  4 +* Loaders are specified in static functions inside the ConfigLoader class
  5 +*/
  6 +
  7 +namespace Fccn\Lib;
  8 +
  9 +class ConfigLoader
  10 +{
  11 +
  12 + /*
  13 + * Loads additional twig filters and extensions
  14 + */
  15 + public static function loadTwigFiltersAndExtensions($twig){
  16 + //---additional extensions from http://twig-extensions.readthedocs.io/en/latest/
  17 + #load internationalization extensions and filters
  18 + TranslateConfigurationLoader::loadTwigConfigs($twig);
  19 +
  20 + #additional extensions TODO add this to a class in twig-utils project
  21 + $twig->addExtension(new \JSW\Twig\TwigExtension());
  22 + $twig->addExtension(new \Twig_Extension_Debug());
  23 + }
  24 +
  25 +
  26 + /*
  27 + * Loads variables to twig that are accessible from all templates
  28 + */
  29 + public static function loadTwigGlobals($twig){
  30 + $twig->addGlobal('config', SiteConfig::getInstance()->all());
  31 + $twig->addGlobal('current_year', date('Y'));
  32 + }
  33 +
  34 +}
@@ -11,15 +11,19 @@ @@ -11,15 +11,19 @@
11 ], 11 ],
12 "require": { 12 "require": {
13 "php": ">=5.5.0", 13 "php": ">=5.5.0",
14 - "fccn/webapp-tools-common": "^1.0" 14 + "fccn/webapp-tools-common": "^1.0",
  15 + "fccn/webapp-tools-translate": "^1.0"
15 }, 16 },
16 "autoload":{ 17 "autoload":{
17 "psr-4": { 18 "psr-4": {
18 - "Fccn\\WebComponents\\": "app" 19 + "Fccn\\Lib\\": "app/lib",
  20 + "Fccn\\WebComponents\\": "app/component"
19 } 21 }
20 }, 22 },
21 "require-dev": { 23 "require-dev": {
22 - "codeception/codeception": "^2.3" 24 + "codeception/codeception": "^2.3",
  25 + "slim/slim": "^3.9",
  26 + "herloct/codeception-slim-module": "^1.1"
23 }, 27 },
24 "autoload-dev": { 28 "autoload-dev": {
25 "psr-4": { 29 "psr-4": {
@@ -4,9 +4,92 @@ @@ -4,9 +4,92 @@
4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 "This file is @generated automatically" 5 "This file is @generated automatically"
6 ], 6 ],
7 - "content-hash": "f95a452e972744224eba1da330ca043f", 7 + "content-hash": "89e43ed24e5c506c4e86410aa3b65fd9",
8 "packages": [ 8 "packages": [
9 { 9 {
  10 + "name": "container-interop/container-interop",
  11 + "version": "1.2.0",
  12 + "source": {
  13 + "type": "git",
  14 + "url": "https://github.com/container-interop/container-interop.git",
  15 + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8"
  16 + },
  17 + "dist": {
  18 + "type": "zip",
  19 + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8",
  20 + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8",
  21 + "shasum": ""
  22 + },
  23 + "require": {
  24 + "psr/container": "^1.0"
  25 + },
  26 + "type": "library",
  27 + "autoload": {
  28 + "psr-4": {
  29 + "Interop\\Container\\": "src/Interop/Container/"
  30 + }
  31 + },
  32 + "notification-url": "https://packagist.org/downloads/",
  33 + "license": [
  34 + "MIT"
  35 + ],
  36 + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
  37 + "homepage": "https://github.com/container-interop/container-interop",
  38 + "time": "2017-02-14T19:40:03+00:00"
  39 + },
  40 + {
  41 + "name": "dflydev/fig-cookies",
  42 + "version": "v1.0.2",
  43 + "source": {
  44 + "type": "git",
  45 + "url": "https://github.com/dflydev/dflydev-fig-cookies.git",
  46 + "reference": "883233c159d00d39e940bd12cfe42c0d23420c1c"
  47 + },
  48 + "dist": {
  49 + "type": "zip",
  50 + "url": "https://api.github.com/repos/dflydev/dflydev-fig-cookies/zipball/883233c159d00d39e940bd12cfe42c0d23420c1c",
  51 + "reference": "883233c159d00d39e940bd12cfe42c0d23420c1c",
  52 + "shasum": ""
  53 + },
  54 + "require": {
  55 + "php": ">=5.4",
  56 + "psr/http-message": "~1.0"
  57 + },
  58 + "require-dev": {
  59 + "codeclimate/php-test-reporter": "~0.1@dev",
  60 + "phpunit/phpunit": "~4.5",
  61 + "squizlabs/php_codesniffer": "~2.3"
  62 + },
  63 + "type": "library",
  64 + "extra": {
  65 + "branch-alias": {
  66 + "dev-master": "1.0.x-dev"
  67 + }
  68 + },
  69 + "autoload": {
  70 + "psr-4": {
  71 + "Dflydev\\FigCookies\\": "src/Dflydev/FigCookies"
  72 + }
  73 + },
  74 + "notification-url": "https://packagist.org/downloads/",
  75 + "license": [
  76 + "MIT"
  77 + ],
  78 + "authors": [
  79 + {
  80 + "name": "Beau Simensen",
  81 + "email": "beau@dflydev.com"
  82 + }
  83 + ],
  84 + "description": "Cookies for PSR-7 HTTP Message Interface.",
  85 + "keywords": [
  86 + "cookies",
  87 + "psr-7",
  88 + "psr7"
  89 + ],
  90 + "time": "2016-03-28T09:10:18+00:00"
  91 + },
  92 + {
10 "name": "fccn/webapp-tools-common", 93 "name": "fccn/webapp-tools-common",
11 "version": "1.0.1", 94 "version": "1.0.1",
12 "source": { 95 "source": {
@@ -53,6 +136,52 @@ @@ -53,6 +136,52 @@
53 "time": "2017-11-06T15:15:26+00:00" 136 "time": "2017-11-06T15:15:26+00:00"
54 }, 137 },
55 { 138 {
  139 + "name": "fccn/webapp-tools-translate",
  140 + "version": "1.0.1",
  141 + "source": {
  142 + "type": "git",
  143 + "url": "https://github.com/fccn/wt-translate.git",
  144 + "reference": "c8a264cd64edc8fd5902f01e3630a6bba665d499"
  145 + },
  146 + "dist": {
  147 + "type": "zip",
  148 + "url": "https://api.github.com/repos/fccn/wt-translate/zipball/c8a264cd64edc8fd5902f01e3630a6bba665d499",
  149 + "reference": "c8a264cd64edc8fd5902f01e3630a6bba665d499",
  150 + "shasum": ""
  151 + },
  152 + "require": {
  153 + "fccn/webapp-tools-common": "^1.0",
  154 + "php": ">=5.5.0",
  155 + "slim/twig-view": "^2.3"
  156 + },
  157 + "require-dev": {
  158 + "codeception/codeception": "^2.3"
  159 + },
  160 + "type": "library",
  161 + "autoload": {
  162 + "psr-4": {
  163 + "Fccn\\Lib\\": "src"
  164 + }
  165 + },
  166 + "notification-url": "https://packagist.org/downloads/",
  167 + "license": [
  168 + "MIT"
  169 + ],
  170 + "authors": [
  171 + {
  172 + "name": "Paulo Costa",
  173 + "email": "paulo.costa@fccn.pt"
  174 + }
  175 + ],
  176 + "description": "Set of tools to enable translation on web applications",
  177 + "keywords": [
  178 + "fccn",
  179 + "gettex",
  180 + "webapp-tools"
  181 + ],
  182 + "time": "2017-11-06T16:14:27+00:00"
  183 + },
  184 + {
56 "name": "ircmaxell/random-lib", 185 "name": "ircmaxell/random-lib",
57 "version": "v1.2.0", 186 "version": "v1.2.0",
58 "source": { 187 "source": {
@@ -232,6 +361,198 @@ @@ -232,6 +361,198 @@
232 "time": "2017-06-19T01:22:40+00:00" 361 "time": "2017-06-19T01:22:40+00:00"
233 }, 362 },
234 { 363 {
  364 + "name": "nikic/fast-route",
  365 + "version": "v1.2.0",
  366 + "source": {
  367 + "type": "git",
  368 + "url": "https://github.com/nikic/FastRoute.git",
  369 + "reference": "b5f95749071c82a8e0f58586987627054400cdf6"
  370 + },
  371 + "dist": {
  372 + "type": "zip",
  373 + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/b5f95749071c82a8e0f58586987627054400cdf6",
  374 + "reference": "b5f95749071c82a8e0f58586987627054400cdf6",
  375 + "shasum": ""
  376 + },
  377 + "require": {
  378 + "php": ">=5.4.0"
  379 + },
  380 + "type": "library",
  381 + "autoload": {
  382 + "psr-4": {
  383 + "FastRoute\\": "src/"
  384 + },
  385 + "files": [
  386 + "src/functions.php"
  387 + ]
  388 + },
  389 + "notification-url": "https://packagist.org/downloads/",
  390 + "license": [
  391 + "BSD-3-Clause"
  392 + ],
  393 + "authors": [
  394 + {
  395 + "name": "Nikita Popov",
  396 + "email": "nikic@php.net"
  397 + }
  398 + ],
  399 + "description": "Fast request router for PHP",
  400 + "keywords": [
  401 + "router",
  402 + "routing"
  403 + ],
  404 + "time": "2017-01-19T11:35:12+00:00"
  405 + },
  406 + {
  407 + "name": "pimple/pimple",
  408 + "version": "v3.2.2",
  409 + "source": {
  410 + "type": "git",
  411 + "url": "https://github.com/silexphp/Pimple.git",
  412 + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a"
  413 + },
  414 + "dist": {
  415 + "type": "zip",
  416 + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a",
  417 + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a",
  418 + "shasum": ""
  419 + },
  420 + "require": {
  421 + "php": ">=5.3.0",
  422 + "psr/container": "^1.0"
  423 + },
  424 + "require-dev": {
  425 + "symfony/phpunit-bridge": "^3.2"
  426 + },
  427 + "type": "library",
  428 + "extra": {
  429 + "branch-alias": {
  430 + "dev-master": "3.2.x-dev"
  431 + }
  432 + },
  433 + "autoload": {
  434 + "psr-0": {
  435 + "Pimple": "src/"
  436 + }
  437 + },
  438 + "notification-url": "https://packagist.org/downloads/",
  439 + "license": [
  440 + "MIT"
  441 + ],
  442 + "authors": [
  443 + {
  444 + "name": "Fabien Potencier",
  445 + "email": "fabien@symfony.com"
  446 + }
  447 + ],
  448 + "description": "Pimple, a simple Dependency Injection Container",
  449 + "homepage": "http://pimple.sensiolabs.org",
  450 + "keywords": [
  451 + "container",
  452 + "dependency injection"
  453 + ],
  454 + "time": "2017-07-23T07:32:15+00:00"
  455 + },
  456 + {
  457 + "name": "psr/container",
  458 + "version": "1.0.0",
  459 + "source": {
  460 + "type": "git",
  461 + "url": "https://github.com/php-fig/container.git",
  462 + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
  463 + },
  464 + "dist": {
  465 + "type": "zip",
  466 + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
  467 + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
  468 + "shasum": ""
  469 + },
  470 + "require": {
  471 + "php": ">=5.3.0"
  472 + },
  473 + "type": "library",
  474 + "extra": {
  475 + "branch-alias": {
  476 + "dev-master": "1.0.x-dev"
  477 + }
  478 + },
  479 + "autoload": {
  480 + "psr-4": {
  481 + "Psr\\Container\\": "src/"
  482 + }
  483 + },
  484 + "notification-url": "https://packagist.org/downloads/",
  485 + "license": [
  486 + "MIT"
  487 + ],
  488 + "authors": [
  489 + {
  490 + "name": "PHP-FIG",
  491 + "homepage": "http://www.php-fig.org/"
  492 + }
  493 + ],
  494 + "description": "Common Container Interface (PHP FIG PSR-11)",
  495 + "homepage": "https://github.com/php-fig/container",
  496 + "keywords": [
  497 + "PSR-11",
  498 + "container",
  499 + "container-interface",
  500 + "container-interop",
  501 + "psr"
  502 + ],
  503 + "time": "2017-02-14T16:28:37+00:00"
  504 + },
  505 + {
  506 + "name": "psr/http-message",
  507 + "version": "1.0.1",
  508 + "source": {
  509 + "type": "git",
  510 + "url": "https://github.com/php-fig/http-message.git",
  511 + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
  512 + },
  513 + "dist": {
  514 + "type": "zip",
  515 + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
  516 + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
  517 + "shasum": ""
  518 + },
  519 + "require": {
  520 + "php": ">=5.3.0"
  521 + },
  522 + "type": "library",
  523 + "extra": {
  524 + "branch-alias": {
  525 + "dev-master": "1.0.x-dev"
  526 + }
  527 + },
  528 + "autoload": {
  529 + "psr-4": {
  530 + "Psr\\Http\\Message\\": "src/"
  531 + }
  532 + },
  533 + "notification-url": "https://packagist.org/downloads/",
  534 + "license": [
  535 + "MIT"
  536 + ],
  537 + "authors": [
  538 + {
  539 + "name": "PHP-FIG",
  540 + "homepage": "http://www.php-fig.org/"
  541 + }
  542 + ],
  543 + "description": "Common interface for HTTP messages",
  544 + "homepage": "https://github.com/php-fig/http-message",
  545 + "keywords": [
  546 + "http",
  547 + "http-message",
  548 + "psr",
  549 + "psr-7",
  550 + "request",
  551 + "response"
  552 + ],
  553 + "time": "2016-08-06T14:39:51+00:00"
  554 + },
  555 + {
235 "name": "psr/log", 556 "name": "psr/log",
236 "version": "1.0.2", 557 "version": "1.0.2",
237 "source": { 558 "source": {
@@ -277,6 +598,192 @@ @@ -277,6 +598,192 @@
277 "psr-3" 598 "psr-3"
278 ], 599 ],
279 "time": "2016-10-10T12:19:37+00:00" 600 "time": "2016-10-10T12:19:37+00:00"
  601 + },
  602 + {
  603 + "name": "slim/slim",
  604 + "version": "3.9.0",
  605 + "source": {
  606 + "type": "git",
  607 + "url": "https://github.com/slimphp/Slim.git",
  608 + "reference": "575a8b53a0a489447915029c69680156cd355304"
  609 + },
  610 + "dist": {
  611 + "type": "zip",
  612 + "url": "https://api.github.com/repos/slimphp/Slim/zipball/575a8b53a0a489447915029c69680156cd355304",
  613 + "reference": "575a8b53a0a489447915029c69680156cd355304",
  614 + "shasum": ""
  615 + },
  616 + "require": {
  617 + "container-interop/container-interop": "^1.2",
  618 + "nikic/fast-route": "^1.0",
  619 + "php": ">=5.5.0",
  620 + "pimple/pimple": "^3.0",
  621 + "psr/container": "^1.0",
  622 + "psr/http-message": "^1.0"
  623 + },
  624 + "provide": {
  625 + "psr/http-message-implementation": "1.0"
  626 + },
  627 + "require-dev": {
  628 + "phpunit/phpunit": "^4.0",
  629 + "squizlabs/php_codesniffer": "^2.5"
  630 + },
  631 + "type": "library",
  632 + "autoload": {
  633 + "psr-4": {
  634 + "Slim\\": "Slim"
  635 + }
  636 + },
  637 + "notification-url": "https://packagist.org/downloads/",
  638 + "license": [
  639 + "MIT"
  640 + ],
  641 + "authors": [
  642 + {
  643 + "name": "Rob Allen",
  644 + "email": "rob@akrabat.com",
  645 + "homepage": "http://akrabat.com"
  646 + },
  647 + {
  648 + "name": "Josh Lockhart",
  649 + "email": "hello@joshlockhart.com",
  650 + "homepage": "https://joshlockhart.com"
  651 + },
  652 + {
  653 + "name": "Gabriel Manricks",
  654 + "email": "gmanricks@me.com",
  655 + "homepage": "http://gabrielmanricks.com"
  656 + },
  657 + {
  658 + "name": "Andrew Smith",
  659 + "email": "a.smith@silentworks.co.uk",
  660 + "homepage": "http://silentworks.co.uk"
  661 + }
  662 + ],
  663 + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
  664 + "homepage": "https://slimframework.com",
  665 + "keywords": [
  666 + "api",
  667 + "framework",
  668 + "micro",
  669 + "router"
  670 + ],
  671 + "time": "2017-11-04T08:46:46+00:00"
  672 + },
  673 + {
  674 + "name": "slim/twig-view",
  675 + "version": "2.3.0",
  676 + "source": {
  677 + "type": "git",
  678 + "url": "https://github.com/slimphp/Twig-View.git",
  679 + "reference": "f6ff5ec3a24e11866376b8ffa235fbbb7e1d1301"
  680 + },
  681 + "dist": {
  682 + "type": "zip",
  683 + "url": "https://api.github.com/repos/slimphp/Twig-View/zipball/f6ff5ec3a24e11866376b8ffa235fbbb7e1d1301",
  684 + "reference": "f6ff5ec3a24e11866376b8ffa235fbbb7e1d1301",
  685 + "shasum": ""
  686 + },
  687 + "require": {
  688 + "php": ">=5.5.0",
  689 + "psr/http-message": "^1.0",
  690 + "twig/twig": "^1.18|^2.0"
  691 + },
  692 + "require-dev": {
  693 + "phpunit/phpunit": "^4.8|^5.7"
  694 + },
  695 + "type": "library",
  696 + "autoload": {
  697 + "psr-4": {
  698 + "Slim\\Views\\": "src"
  699 + }
  700 + },
  701 + "notification-url": "https://packagist.org/downloads/",
  702 + "license": [
  703 + "MIT"
  704 + ],
  705 + "authors": [
  706 + {
  707 + "name": "Josh Lockhart",
  708 + "email": "hello@joshlockhart.com",
  709 + "homepage": "http://joshlockhart.com"
  710 + }
  711 + ],
  712 + "description": "Slim Framework 3 view helper built on top of the Twig 2 templating component",
  713 + "homepage": "http://slimframework.com",
  714 + "keywords": [
  715 + "framework",
  716 + "slim",
  717 + "template",
  718 + "twig",
  719 + "view"
  720 + ],
  721 + "time": "2017-09-20T19:47:37+00:00"
  722 + },
  723 + {
  724 + "name": "twig/twig",
  725 + "version": "v1.35.0",
  726 + "source": {
  727 + "type": "git",
  728 + "url": "https://github.com/twigphp/Twig.git",
  729 + "reference": "daa657073e55b0a78cce8fdd22682fddecc6385f"
  730 + },
  731 + "dist": {
  732 + "type": "zip",
  733 + "url": "https://api.github.com/repos/twigphp/Twig/zipball/daa657073e55b0a78cce8fdd22682fddecc6385f",
  734 + "reference": "daa657073e55b0a78cce8fdd22682fddecc6385f",
  735 + "shasum": ""
  736 + },
  737 + "require": {
  738 + "php": ">=5.3.3"
  739 + },
  740 + "require-dev": {
  741 + "psr/container": "^1.0",
  742 + "symfony/debug": "~2.7",
  743 + "symfony/phpunit-bridge": "~3.3@dev"
  744 + },
  745 + "type": "library",
  746 + "extra": {
  747 + "branch-alias": {
  748 + "dev-master": "1.35-dev"
  749 + }
  750 + },
  751 + "autoload": {
  752 + "psr-0": {
  753 + "Twig_": "lib/"
  754 + },
  755 + "psr-4": {
  756 + "Twig\\": "src/"
  757 + }
  758 + },
  759 + "notification-url": "https://packagist.org/downloads/",
  760 + "license": [
  761 + "BSD-3-Clause"
  762 + ],
  763 + "authors": [
  764 + {
  765 + "name": "Fabien Potencier",
  766 + "email": "fabien@symfony.com",
  767 + "homepage": "http://fabien.potencier.org",
  768 + "role": "Lead Developer"
  769 + },
  770 + {
  771 + "name": "Armin Ronacher",
  772 + "email": "armin.ronacher@active-4.com",
  773 + "role": "Project Founder"
  774 + },
  775 + {
  776 + "name": "Twig Team",
  777 + "homepage": "http://twig.sensiolabs.org/contributors",
  778 + "role": "Contributors"
  779 + }
  780 + ],
  781 + "description": "Twig, the flexible, fast, and secure template language for PHP",
  782 + "homepage": "http://twig.sensiolabs.org",
  783 + "keywords": [
  784 + "templating"
  785 + ],
  786 + "time": "2017-09-27T18:06:46+00:00"
280 } 787 }
281 ], 788 ],
282 "packages-dev": [ 789 "packages-dev": [
@@ -721,6 +1228,53 @@ @@ -721,6 +1228,53 @@
721 "time": "2017-03-20T17:10:46+00:00" 1228 "time": "2017-03-20T17:10:46+00:00"
722 }, 1229 },
723 { 1230 {
  1231 + "name": "herloct/codeception-slim-module",
  1232 + "version": "1.1.0",
  1233 + "source": {
  1234 + "type": "git",
  1235 + "url": "https://github.com/herloct/codeception-slim-module.git",
  1236 + "reference": "8767207016d77a147e6ad9b2f75eb7f3fdab17ba"
  1237 + },
  1238 + "dist": {
  1239 + "type": "zip",
  1240 + "url": "https://api.github.com/repos/herloct/codeception-slim-module/zipball/8767207016d77a147e6ad9b2f75eb7f3fdab17ba",
  1241 + "reference": "8767207016d77a147e6ad9b2f75eb7f3fdab17ba",
  1242 + "shasum": ""
  1243 + },
  1244 + "require": {
  1245 + "php": "^5.6 || ^7.0"
  1246 + },
  1247 + "require-dev": {
  1248 + "codeception/codeception": "^2.2",
  1249 + "php": "^5.6 || ^7.0",
  1250 + "slim/slim": "^3.5"
  1251 + },
  1252 + "type": "library",
  1253 + "autoload": {
  1254 + "psr-4": {
  1255 + "Herloct\\Codeception\\": "src"
  1256 + }
  1257 + },
  1258 + "notification-url": "https://packagist.org/downloads/",
  1259 + "license": [
  1260 + "MIT"
  1261 + ],
  1262 + "authors": [
  1263 + {
  1264 + "name": "Herloct",
  1265 + "email": "herloct@gmail.com"
  1266 + }
  1267 + ],
  1268 + "description": "Codeception Module for Slim 3 Microframework.",
  1269 + "homepage": "https://github.com/herloct/codeception-slim-module",
  1270 + "keywords": [
  1271 + "codeception",
  1272 + "module",
  1273 + "slim"
  1274 + ],
  1275 + "time": "2017-03-04T20:30:56+00:00"
  1276 + },
  1277 + {
724 "name": "myclabs/deep-copy", 1278 "name": "myclabs/deep-copy",
725 "version": "1.7.0", 1279 "version": "1.7.0",
726 "source": { 1280 "source": {
@@ -1365,56 +1919,6 @@ @@ -1365,56 +1919,6 @@
1365 "time": "2017-06-30T09:13:00+00:00" 1919 "time": "2017-06-30T09:13:00+00:00"
1366 }, 1920 },
1367 { 1921 {
1368 - "name": "psr/http-message",  
1369 - "version": "1.0.1",  
1370 - "source": {  
1371 - "type": "git",  
1372 - "url": "https://github.com/php-fig/http-message.git",  
1373 - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"  
1374 - },  
1375 - "dist": {  
1376 - "type": "zip",  
1377 - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",  
1378 - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",  
1379 - "shasum": ""  
1380 - },  
1381 - "require": {  
1382 - "php": ">=5.3.0"  
1383 - },  
1384 - "type": "library",  
1385 - "extra": {  
1386 - "branch-alias": {  
1387 - "dev-master": "1.0.x-dev"  
1388 - }  
1389 - },  
1390 - "autoload": {  
1391 - "psr-4": {  
1392 - "Psr\\Http\\Message\\": "src/"  
1393 - }  
1394 - },  
1395 - "notification-url": "https://packagist.org/downloads/",  
1396 - "license": [  
1397 - "MIT"  
1398 - ],  
1399 - "authors": [  
1400 - {  
1401 - "name": "PHP-FIG",  
1402 - "homepage": "http://www.php-fig.org/"  
1403 - }  
1404 - ],  
1405 - "description": "Common interface for HTTP messages",  
1406 - "homepage": "https://github.com/php-fig/http-message",  
1407 - "keywords": [  
1408 - "http",  
1409 - "http-message",  
1410 - "psr",  
1411 - "psr-7",  
1412 - "request",  
1413 - "response"  
1414 - ],  
1415 - "time": "2016-08-06T14:39:51+00:00"  
1416 - },  
1417 - {  
1418 "name": "sebastian/code-unit-reverse-lookup", 1922 "name": "sebastian/code-unit-reverse-lookup",
1419 "version": "1.0.1", 1923 "version": "1.0.1",
1420 "source": { 1924 "source": {
tests/_data/config.php
@@ -6,11 +6,31 @@ $fs_root = __DIR__; //point to the project root folder @@ -6,11 +6,31 @@ $fs_root = __DIR__; //point to the project root folder
6 //the configuration array - make sure it is called $c 6 //the configuration array - make sure it is called $c
7 $c = array( 7 $c = array(
8 "install_path" => $fs_root, 8 "install_path" => $fs_root,
  9 + "base_path" => "",
9 #------ logfile configuration 10 #------ logfile configuration
10 'logfile_path' => __DIR__."/../_output/logs/test.log", 11 'logfile_path' => __DIR__."/../_output/logs/test.log",
11 'logfile_level' => "DEBUG", 12 'logfile_level' => "DEBUG",
12 13
  14 +#----- locale configuration
  15 + "defaultLocale" => "pt_PT",
  16 + "defaultLocaleLabel" => "PT",
  17 +
  18 + "locales" => array(
  19 + array("label" => "GB", "locale" => "en_GB", "flag_alt" => "English flag", "language" => "English"),
  20 + array("label" => "PT", "locale" => "pt_PT", "flag_alt" => "Portuguese flag", "language" => "Português"),
  21 + # add other languages here....
  22 + ),
  23 +
  24 + "locale_textdomain" => "messages",
  25 + "locale_path" => __DIR__."/locale",
  26 + "locale_cookie_name" => "locale",
  27 + #twig parser locations
  28 + "twig_parser_templates_path" => __DIR__."/templates",
  29 + "twig_parser_cache_path" => __DIR__."/cache",
  30 +
13 #---- External libraries loader -------------------- 31 #---- External libraries loader --------------------
  32 + "ext_libs_loader_service_name" => 'loader',
  33 +
14 "ext_libs" => array( 34 "ext_libs" => array(
15 "my_lib" => __DIR__."/vendor/test/lib.js" 35 "my_lib" => __DIR__."/vendor/test/lib.js"
16 ), 36 ),
tests/_data/locale/en_EN/html/homepage.html
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +<div>Hello world</div>
tests/_data/locale/pt_PT/files/sample_file.txt
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Este é um exemplo de conteúdo em ficheiro de texto.
tests/_data/locale/pt_PT/files/sample_w_fields.txt
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +Este é um exemplo de conteúdo em ficheiro de texto com {field} editáveis.
  2 +Segunda linha.
tests/_data/locale/pt_PT/files/sample_w_fields_filled.txt
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +Este é um exemplo de conteúdo em ficheiro de texto com campos editáveis.
  2 +Segunda linha.
tests/_data/locale/pt_PT/html/homepage.html
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +<div>Olá mundo</div>
tests/_data/templates/index.html.twig
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +<html>
  2 +<body>
  3 + <h1>{% trans "Title" %}</h1>
  4 + <p>
  5 + {% trans "This is a sample text" %}
  6 + </p>
  7 +</body>
  8 +</html>
tests/_support/AppContainer.php
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
  1 +<?php
  2 +use Psr\Container\ContainerInterface;
  3 +use Slim\App;
  4 +use Slim\Container;
  5 +
  6 +/*
  7 +* Container to use on tests
  8 +*/
  9 +
  10 +$container = new Container([
  11 + App::class => function (ContainerInterface $c) {
  12 + $app = new App($c);
  13 +
  14 + //setup slim logs with file logger
  15 + $c['logger'] = function ($cnt) {
  16 + $logger = \Fccn\Lib\FileLogger::getInstance();
  17 + $logger->pushProcessor(new Monolog\Processor\UidProcessor());
  18 + $logger->pushHandler(new Monolog\Handler\StreamHandler(\Fccn\Lib\SiteConfig::getInstance()->get('logfile_path'), \Fccn\Lib\SiteConfig::getInstance()->get('logfile_level')));
  19 + return $logger;
  20 + };
  21 +
  22 + //setup ext libs loader
  23 + $cnt_name = \Fccn\Lib\SiteConfig::getInstance()->get('ext_libs_loader_service_name');
  24 + $c[$cnt_name] = function ($cnt) {
  25 + $loader = \Fccn\WebComponents\ExtLibsLoader::getInstance();
  26 + return $loader;
  27 + };
  28 +
  29 + // routes and middlewares here
  30 +
  31 + #load library action
  32 + $app->get('/script/lib/{libname}', Fccn\WebComponents\LoadExternalJsAction::class)->setName('ext_libs');
  33 +
  34 + return $app;
  35 + }
  36 +]);
  37 +
  38 +return $container;
tests/_support/_generated/FunctionalTesterActions.php
1 -<?php //[STAMP] fabaf9e86b7c52e7adba698beecc7fc5 1 +<?php //[STAMP] ae06983dfa6bdba4e227e9d1dda76a9e
2 namespace _generated; 2 namespace _generated;
3 3
4 // This class was automatically generated by build task 4 // This class was automatically generated by build task
@@ -6,6 +6,8 @@ namespace _generated; @@ -6,6 +6,8 @@ namespace _generated;
6 // @codingStandardsIgnoreFile 6 // @codingStandardsIgnoreFile
7 7
8 use Helper\Functional; 8 use Helper\Functional;
  9 +use Herloct\Codeception\Module\Slim;
  10 +use Codeception\Module\REST;
9 11
10 trait FunctionalTesterActions 12 trait FunctionalTesterActions
11 { 13 {
@@ -15,4 +17,3720 @@ trait FunctionalTesterActions @@ -15,4 +17,3720 @@ trait FunctionalTesterActions
15 abstract protected function getScenario(); 17 abstract protected function getScenario();
16 18
17 19
  20 + /**
  21 + * [!] Method is generated. Documentation taken from corresponding module.
  22 + *
  23 + * Adds HTTP authentication via username/password.
  24 + *
  25 + * @param $username
  26 + * @param $password
  27 + * @part json
  28 + * @part xml
  29 + * @see \Codeception\Module\REST::amHttpAuthenticated()
  30 + */
  31 + public function amHttpAuthenticated($username, $password) {
  32 + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
  33 + }
  34 +
  35 +
  36 + /**
  37 + * [!] Method is generated. Documentation taken from corresponding module.
  38 + *
  39 + * Sets HTTP header valid for all next requests. Use `deleteHeader` to unset it
  40 + *
  41 + * ```php
  42 + * <?php
  43 + * $I->haveHttpHeader('Content-Type', 'application/json');
  44 + * // all next requests will contain this header
  45 + * ?>
  46 + * ```
  47 + *
  48 + * @param $name
  49 + * @param $value
  50 + * @part json
  51 + * @part xml
  52 + * @see \Codeception\Module\REST::haveHttpHeader()
  53 + */
  54 + public function haveHttpHeader($name, $value) {
  55 + return $this->getScenario()->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args()));
  56 + }
  57 +
  58 +
  59 + /**
  60 + * [!] Method is generated. Documentation taken from corresponding module.
  61 + *
  62 + * Deletes the header with the passed name. Subsequent requests
  63 + * will not have the deleted header in its request.
  64 + *
  65 + * Example:
  66 + * ```php
  67 + * <?php
  68 + * $I->haveHttpHeader('X-Requested-With', 'Codeception');
  69 + * $I->sendGET('test-headers.php');
  70 + * // ...
  71 + * $I->deleteHeader('X-Requested-With');
  72 + * $I->sendPOST('some-other-page.php');
  73 + * ?>
  74 + * ```
  75 + *
  76 + * @param string $name the name of the header to delete.
  77 + * @part json
  78 + * @part xml
  79 + * @see \Codeception\Module\REST::deleteHeader()
  80 + */
  81 + public function deleteHeader($name) {
  82 + return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args()));
  83 + }
  84 +
  85 +
  86 + /**
  87 + * [!] Method is generated. Documentation taken from corresponding module.
  88 + *
  89 + * Opens the page for the given relative URI.
  90 + *
  91 + * ``` php
  92 + * <?php
  93 + * // opens front page
  94 + * $I->amOnPage('/');
  95 + * // opens /register page
  96 + * $I->amOnPage('/register');
  97 + * ```
  98 + *
  99 + * @param string $page
  100 + * @see \Codeception\Lib\InnerBrowser::amOnPage()
  101 + */
  102 + public function amOnPage($page) {
  103 + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
  104 + }
  105 +
  106 +
  107 + /**
  108 + * [!] Method is generated. Documentation taken from corresponding module.
  109 + *
  110 + * Perform a click on a link or a button, given by a locator.
  111 + * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
  112 + * For buttons, the "value" attribute, "name" attribute, and inner text are searched.
  113 + * For links, the link text is searched.
  114 + * For images, the "alt" attribute and inner text of any parent links are searched.
  115 + *
  116 + * The second parameter is a context (CSS or XPath locator) to narrow the search.