Skip to content

Commit

Permalink
Merge pull request #3075 from ec-europa/release-2.6.21
Browse files Browse the repository at this point in the history
Release 2.6.21
  • Loading branch information
julien- authored Aug 4, 2022
2 parents 1e97fde + cf5a5cf commit 6d6384c
Show file tree
Hide file tree
Showing 45 changed files with 1,217 additions and 2,631 deletions.
197 changes: 134 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Requirements

* Composer
* Composer 1
* PHP Phar extension
* PhantomJS (in order to run JavaScript during Behat tests)
* PHP 7.3 or higher
Expand All @@ -13,17 +13,17 @@ Before we can build the NextEuropa platform we need to install the build system
itself. This can be done using [composer](https://getcomposer.org/):


```
$ composer install
```bash
composer install
```

## Customize build properties

Create a new file in the root of the project named `build.properties.local`
using your favourite text editor:

```
$ vim build.properties.local
```bash
vim build.properties.local
```

This file will contain configuration which is unique to your development
Expand All @@ -35,64 +35,104 @@ Because these settings are personal they should not be shared with the rest of
the team. Make sure you never commit this file!

All options you can use can be found in the `build.properties.dist` file. Just
copy the lines you want to override and change their values. For example:
copy the lines you want to override and change their values.
<details style="padding-left: 3em;"><summary style="margin-left: -3em;">Example of `build.properties.local`</summary>
<p>

```
# The location of the Composer binary.
myLocalIP = __TO_BE_DEFINED
project.folder = platform-dev
composer.bin = /usr/bin/composer
drush.bin = /usr/local/bin/drush
# The install profile to use.
platform.profile.name = multisite_drupal_standard
platform.site.theme_default = ec_resp
behat.base_url = http://${myLocalIP}:8080/${project.folder}/build
behat.wd_host.url = http://${myLocalIP}:4444/wd/hub
behat.screenshots.path = ${project.basedir}/tests/screenshots
behat.browser.name = chrome
# Drush Context configuration
# ---------------------------
drush.db.dump = ${platform.build.dir}/dump.sql
# Database settings.
drupal.db.name = my_database
drupal.db.name = platform_dev
drupal.db.user = root
drupal.db.password = hunter2
drupal.db.password =
# Configuration to append to the settings.php file of the build.
drupal.settings.append.text = ${line.separator}$conf['field_sql_storage_skip_writing_unchanged_fields'] = FALSE;${line.separator}$conf['multisite_toolbox_cs_whitelist'] = array('*.europa.eu', 'europa.eu');${line.separator}$conf['poetry_mock_base_url'] = "${mock.poetry.base_url}";${line.separator}$conf['ecas_whitelisted_user_roles'] = array();${line.separator}$conf['dev_credentials'] = "pass";${line.separator}define('FPFIS_ECAS_URL', 'ecas.ec.europa.eu');${line.separator}define('FPFIS_ECAS_PORT', 443);${line.separator}define('FPFIS_ECAS_URI', '/cas');${line.separator}
# Admin user.
drupal.admin.username = admin
drupal.admin.password = admin
# The base URL to use in Behat tests.
behat.base_url = http://nexteuropa.local
# Flickr configuration
# --------------------
# A valid API key & secret used by the behat tests
flickr.key = foobar
flickr.secret = bas
# Integration configuration
# -------------------------
# Port on which the mocked integration server used by the behat tests will listen.
integration.server.port = 8888
# Development variables
# -------------------------
devel.vars.autologout_timeout = 172800
```
<p>
</details>

## Listing the available build commands

You can get a list of all the available Phing build commands ("targets") with a
short description of each target with the following command:

```
$ ./bin/phing
```bash
./bin/phing
```

## Building a local development environment

```bash
./bin/phing build-platform-dev install-platform
```
$ ./bin/phing build-platform-dev
$ ./bin/phing install-platform
```

### From the release 2.4.x following configuration variables are available:

- The default theme to enable, set to either "ec_resp" (default) or "ec_europa".
<details style="padding-left: 3em;"><summary style="margin-left: -3em;">Some configuraion variables</summary>
<p>
- The default theme to enable, set to either "ec_resp" (default) or "ec_europa".

> platform.site.theme_default = ec_resp
```
platform.site.theme_default = ec_resp
```

- The default Europa Component Library release which is used to build the EC Europa theme.

> ecl.version = v0.10.0
```
ecl.version = v0.10.0
```

- The default EC Europa theme release version.

> ec_europa.version = 0.0.2
```
ec_europa.version = 0.0.2
```

- The default Atomium theme build properties. Used only if default theme is set to "ec_europa".
You can find default values of those variables below.

>platform.theme.atomium.repo.url = https://github.com/ec-europa/atomium.git
>platform.theme.atomium.repo.branch = 7.x-1.x
```
platform.theme.atomium.repo.url = https://github.com/ec-europa/atomium.git
platform.theme.atomium.repo.branch = 7.x-1.x
```

</p>
</details>

## Building a local development environment for the EC Europa theme

Expand All @@ -108,16 +148,16 @@ section above. The most important is to set the `platform.site.theme_default` va
to `ec_europa`.

You can use this Phing target in the following way:
```
$ ./bin/phing build-europa-dev
```bash
./bin/phing build-europa-dev
```
This Phing target is meant to be used only for the local development purposes.

## Generic users.
After install, generic users are created. Login using drush user-login command.
```
$ cd ./build
$ drush uli
```bash
cd ./build
drush uli
```
And setup a new password for these users.

Expand All @@ -132,17 +172,17 @@ If you are not using the development build but one of the other builds
(`build-platform-dist` or `build-multisite-dist`) and you want to run the tests
then you'll need to set up the Behat configuration manually:

```
$ ./bin/phing setup-behat
```bash
./bin/phing setup-behat
```

In order to run JavaScript in your Behat tests, you must launch a PhantomJS
instance before. Use the `--debug` parameter to get more information. Please
be sure that the webdriver's port you specify corresponds to the one in your
Behat configuration (`behat.wd_host.url: "http://localhost:8643/wd/hub"`).

```
$ phantomjs --debug=true --webdriver=8643
```bash
phantomjs --debug=true --webdriver=8643
```

If you prefer to use an actual browser with Selenium instead of PhantomJS, you
Expand All @@ -159,43 +199,74 @@ by calling the behat executable directly and specifying the location of the

Behat tests can be executed from the repository root by running:

```
$ ./bin/behat -c tests/behat.yml
```bash
./bin/behat -c tests/behat.yml
```

The platform can run 4 different behat profiles:
* default: it runs behat tests against a multisite_drupal_standard build using
the "Europa" theme;
* communities: it runs behat tests against a multisite_drupal_communities build
using the "Europa" theme;
* standard_ec_resp: it runs behat tests against a multisite_drupal_standard build using
the "ec_resp" theme;
* communities_ec_resp: it runs behat tests against a multisite_drupal_communities build
using the "ec_resp" theme;

The behat execution command mentioned above runs the tests only with the default profile. <br />
The tests will fail with it if the platform is built with the "ec_resp" theme.
<table>
<thead>
<tr>
<th style="border-bottom: none !important;">Profile name <span style="display: block; font-weight: 400; font-size: 0.8rem;">to call in your behat command<span></th>
<th rowspan=2></th>
<th rowspan=2>called build</th>
<th rowspan=2>used theme</th>
</tr>
</thead>
<tbody>
<tr>
<td>default</td>
<td rowspan=4>runs behat tests against a</td>
<td><span style="background-color: #054e9f; color: white;">multisite_drupal_standard</span></td>
<td><span style="background-color: #054e9f; color: gold;">ec_europa</span></td>
</tr>
<tr>
<td>communities</td>
<td><span style="background-color: #668eba; color: white;">multisite_drupal_communities</span></td>
<td><span style="background-color: #054e9f; color: gold;">ec_europa</span></td>
</tr>
<tr>
<td>standard_ec_resp</td>
<td><span style="background-color: #054e9f; color: white;">multisite_drupal_standard</span></td>
<td><span style="background-color: white; color: darkblue; border: 1px solid darkblue; padding : 2px 5px;">ec_resp</span></td>
</tr>
<tr>
<td>communities_ec_resp</td>
<td><span style="background-color: #668eba; color: white;">multisite_drupal_communities</span></td>
<td><span style="background-color: white; color: darkblue; border: 1px solid darkblue; padding : 2px 5px;">ec_resp</span></td>
</tr>
</tbody>
</table>

The behat execution command mentioned above runs the tests only with the `default` profile. <br />
The tests will fail with it if the platform is built with the `ec_resp` theme.

To run a profile other than the default one , the following command must be executed:

```
$ ./bin/behat -c tests/behat.yml -p [profile]
```bash
./bin/behat -c tests/behat.yml -p [profile]
```

`[profile]` stands for the profile name as written in the list above; I.E: communities,
standard_ec_resp, communities_ec_resp.
`[profile]` stands for the profile name as written in the table above

If you want to execute a single test, just provide the path to the test as an argument.
The tests are located in `tests/features/`. For example:

```bash
./bin/behat -c tests/behat.yml tests/features/content_editing.feature
```
$ ./bin/behat -c tests/behat.yml tests/features/content_editing.feature

Some tests are functionnal only with specific theme. So you have to build your site using this theme. To check it see in `tests/balancer/` where your .feature behat file is called (folder available after setup behat).
For sample `tests/features/tmgmt/tmgmt_dgt_connector_cart.feature` is in `tests/balancer/behat.standard_ec_resp.0.yml` so you have to install the platform in local with the `multisite_drupal_standard` profile and `ec_resp` theme:
```bash
./bin/behat -c tests/behat.yml -p standard_ec_resp --colors -f pretty --strict tests/features/tmgmt/tmgmt_dgt_connector_cart.feature
```


Some tests need to mimic external services that listen on particular ports, e.g.
the central server of the Integration Layer. If you already have services running
on the same ports, they will conflict. You will need to change the ports used in
build.properties.local.
`build.properties.local`.

Remember to specify the right configuration file before running the tests.

Expand All @@ -211,8 +282,8 @@ If you are not using the development build but one of the other builds
(`build-platform-dist` or `build-multisite-dist`) and you want to run PHPUnit tests
then you'll need to set up the PHPUnit configuration manually by running:

```
$ ./bin/phing setup-phpunit
```bash
./bin/phing setup-phpunit
```

Each custom module or feature can expose unit tests by executing the following steps:
Expand Down Expand Up @@ -254,8 +325,8 @@ class ExampleTest extends AbstractUnitTest {

PHPUnit tests can be executed from the repository root by running:

```
$ ./bin/phpunit -c tests/phpunit.xml
```bash
./bin/phpunit -c tests/phpunit.xml
```

## Running Drupal Simpletests on the platform
Expand All @@ -267,12 +338,12 @@ Check the documentation [here](https://webgate.ec.europa.eu/fpfis/wikis/x/NJUQE)
After executing the 'setup-php-codesniffer' Phing target,
PHP CodeSniffer will be set up and can be run with the following command:

```
```bash
# Scan all files for coding standards violations.
$ ./bin/phpcs
./bin/phpcs

# Scan only a single folder.
$ ./bin/phpcs profiles/common/modules/custom/ecas
./bin/phpcs profiles/common/modules/custom/ecas
```

# Docker-compose.yml file
Expand All @@ -294,12 +365,12 @@ Composer patches are added via cweagans/composer-patches to projects via compose
### rych/random

Add PHP 7 compatibility.
```
```JSON
"https://github.com/rchouinard/rych-random/pull/5": "https://patch-diff.githubusercontent.com/raw/rchouinard/rych-random/pull/5.patch"
```

Provide new generator that works with PHP version >= 7.1
```
```JSON
"https://github.com/rchouinard/rych-random/pull/7": "https://patch-diff.githubusercontent.com/raw/rchouinard/rych-random/pull/7.patch
```

Expand All @@ -308,7 +379,7 @@ Provide new generator that works with PHP version >= 7.1
Prevent infinite loops, see https://webgate.ec.europa.eu/CITnet/jira/browse/NEPT-2160
To better handle XML parsing for attributes (modification of http://www.akchauhan.com/convert-xml-to-array-using-dom-extension-in-php5/),
see https://webgate.ec.europa.eu/CITnet/jira/browse/NEPT-1278, https://webgate.ec.europa.eu/CITnet/jira/browse/NEXTEUROPA-11605
```
```JSON
"phpCAS-1.4.0_handle_XML_parsing_ECAS_attributes.patch": "../resources/patches/phpCAS-1.4.0_handle_XML_parsing_ECAS_attributes.patch"
```

4 changes: 4 additions & 0 deletions build.properties.dist
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ behat.poetry.wsdl = /wsdl
behat.poetry.username = username
behat.poetry.password = password

# Solr mock
behat.solr.host = localhost
behat.solr.port = 8983

# Poetry mock
# Example mock.poetry.base_url = http://127.0.0.1:8080/platform-dev/build
# Example mock.poetry.base_url = http://web:8080
Expand Down
2 changes: 2 additions & 0 deletions build.test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
<token key="platform.build.dir" value="${platform.build.dir}" />
<token key="behat.screenshots.path" value="${behat.screenshots.path}" />
<token key="behat.subcontexts.path" value="${behat.subcontexts.path}" />
<token key="behat.solr.host" value="${behat.solr.host}" />
<token key="behat.solr.port" value="${behat.solr.port}" />
<token key="flickr.key" value="${flickr.key}" />
<token key="flickr.secret" value="${flickr.secret}" />
<token key="drush.bin" value="${drush.bin}" />
Expand Down
Loading

0 comments on commit 6d6384c

Please sign in to comment.