diff --git a/.env.default b/.env.default new file mode 100644 index 0000000..751b2cb --- /dev/null +++ b/.env.default @@ -0,0 +1,44 @@ +# docker4drupal variables. +PROJECT_NAME=falcon +PROJECT_BASE_URL=flc.local + +DB_NAME=drupal +DB_USER=drupal +DB_PASSWORD=drupal +DB_ROOT_PASSWORD=password +DB_DRIVER=mysql + +DB_HOST_GIFTS=be_gifts_mariadb +DB_HOST_DONATIONS=be_donations_mariadb + +MARIADB_TAG=10.1-3.1.3 +PHP_TAG=7.1-dev-4.4.2 +# MacOS. +# PHP_TAG=7.1-dev-macos-4.4.2 +NGINX_TAG=8-1.13-4.1.0 + +# Docker-compose environment variables - see https://docs.docker.com/compose/reference/envvars/ +COMPOSE_FILE=./docker/docker-compose.yml:./docker/docker-compose.override.yml +COMPOSE_PROJECT_NAME=falcon + +MODULES_GIFTS=falcon_demo_content default_content better_normalizers hal +MODULES_DONATIONS=falcon_demo_content default_content better_normalizers hal + +# Platform.sh related variables. +PLATFORM_PROJECT_ID=kkgqvmy5atnt2 +PLATFORM_ENVIRONMENT=master +PLATFORM_APPLICATION_GIFTS=backend-gifts +PLATFORM_APPLICATION_DONATIONS=backend-donations +PLATFORM_RELATIONSHIP_GIFTS=database +PLATFORM_RELATIONSHIP_DONATIONS=database + +# Local environment variables. +ENV=local-dev +BACKUP_DIR=backup +DB_DUMP_NAME_GIFTS=dump-gifts +DB_DUMP_NAME_DONATIONS=dump-donations +# On Linux machines you can put DB into memory - /dev/shm +# Possible values: ./mysql | /dev/shm +MYSQL_DATA_DIR=./mysql +MYSQL_DATA_DIR_GIFTS=gifts +MYSQL_DATA_DIR_DONATIONS=donations diff --git a/.gitignore b/.gitignore index 939b05d..5a969d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,17 @@ -# IDE files +# PHPStorm directory. .idea -dev -# Ignoring any composer files inside of the root (if any). -vendor +# MacOS Desktop Services Store files. .DS_Store + +# Docker mysql storage. +/docker/mysql/* +!/docker/mysql/.gitkeep + +# DB dumps/backups. +/backup/* +!/backup/.gitkeep + +# Environment overrides. +/.env +/docker/docker-compose.override.yml diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7cfaec6 --- /dev/null +++ b/Makefile @@ -0,0 +1,267 @@ +.PHONY: default pull up stop down drush shell tests\:prepare tests\:run test install update + +# Make sure the local file with docker-compose overrides exist. +$(shell cp -n \.\/docker\/docker-compose\.override\.default\.yml \.\/docker\/docker-compose\.override\.yml) + +# Create a .env file if not exists and include default env variables. +$(shell cp -n \.env.default \.env) +include .env + +# Define 3 users with different permissions within the container. +# docker-www-data is applicable only for php containers. +docker-www-data = docker-compose exec --user=82:82 $(firstword ${1}) sh -c "$(filter-out $(firstword ${1}), ${1})" +docker = docker-compose exec $(firstword ${1}) sh -c "$(filter-out $(firstword ${1}), ${1})" +docker-root = docker-compose exec --user=0:0 $(firstword ${1}) sh -c "$(filter-out $(firstword ${1}), ${1})" + +cyan = `tput setaf 6` +bold = `tput bold` +reset = `tput sgr0` +message = @echo "${cyan}${bold}${1}${reset}" + +default: up + +pull: + $(call message,$(PROJECT_NAME): Updating Docker images) + docker-compose pull + +up: + $(call message,$(PROJECT_NAME): Build and run containers) + docker-compose up -d --remove-orphans + +stop: + $(call message,$(PROJECT_NAME): Stopping containers) + docker-compose stop + +down: + $(call message,$(PROJECT_NAME): Removing network & containers) + docker-compose down -v --remove-orphans + +exec-www-data: + docker-compose exec --user=82:82 php sh + +exec: + docker-compose exec php sh + +exec-root: + docker-compose exec --user=0:0 php sh + +drush: + # Remove the first argument from the list of make commands. + $(eval ARGS := $(filter-out $@,$(MAKECMDGOALS))) + $(eval TARGET := $(firstword $(ARGS))) + $(eval COMMAND_ARGS := $(filter-out $(TARGET), $(ARGS))) + $(call message,Target is \"$(TARGET)\") + $(call message,Executing \"drush -r /var/www/html/web $(COMMAND_ARGS) --yes\") + $(call docker-www-data, $(TARGET) drush -r /var/www/html/web $(COMMAND_ARGS) --yes) + +shell: + # Remove the first argument from the list of make commands. + $(eval ARGS := $(filter-out $@,$(MAKECMDGOALS))) + $(eval TARGET := $(firstword $(ARGS))) + $(eval COMMAND_ARGS := $(filter-out $(TARGET), $(ARGS))) + $(call message,Target is \"$(TARGET)\") + $(call message,Executing \"shell $(COMMAND_ARGS)\") + $(call docker-www-data, $(TARGET) $(COMMAND_ARGS)) + +########################### +# Container preparations. # +########################### + +prepare: | pull prepare\:git prepare\:frontend\:gifts prepare\:frontend\:main \ +up prepare\:apibus prepare\:backend\:gifts prepare\:backend\:donations + +prepare\:git: + $(call message,Setting git config to ignore local files chmod) + @git config core.fileMode false + +prepare\:frontend\:gifts: | down + $(call message,FE Gifts: Installing yarn dependencies) + @docker-compose run --no-deps fe_gifts yarn install + +prepare\:frontend\:main: | down + $(call message,FE Main: Installing yarn dependencies) + @docker-compose run --no-deps fe_main yarn install + +prepare\:apibus: + $(call message,API Bus: Installing/updating composer dependencies) + -$(call docker, api_bus composer install) + $(call message,API Bus: Copying default local config file into the adjustable local config) + @cp ./backend-api-bus/src/config/local.default.php ./backend-api-bus/src/config/local.php + +prepare\:backend\:gifts: + $(call message,BE Gifts: Installing/updating composer dependencies) + -$(call docker, be_gifts composer install) + +prepare\:backend\:donations: + $(call message,BE Donations: Installing/updating composer dependencies) + -$(call docker, be_donations composer install) + +##################### +# Files operations. # +##################### + +files\:sync: | files\:sync\:gifts files\:sync\:donations + +files\:sync\:gifts: | files\:chown\:wodby\:gifts + platform mount:download -y --project=${PLATFORM_PROJECT_ID} --environment=${PLATFORM_ENVIRONMENT} --app=${PLATFORM_APPLICATION_GIFTS} \ +--mount=web/sites/default/files --target=backend-gifts/web/sites/default/files \ +--exclude=css/* --exclude=js/* --exclude=php/* --exclude=styles/* + $(MAKE) -s files\:chown\:gifts + +files\:sync\:donations: | files\:chown\:wodby\:donations + platform mount:download -y --project=${PLATFORM_PROJECT_ID} --environment=${PLATFORM_ENVIRONMENT} --app=${PLATFORM_APPLICATION_DONATIONS} \ +--mount=web/sites/default/files --target=backend-donations/web/sites/default/files \ +--exclude=css/* --exclude=js/* --exclude=php/* --exclude=styles/* + $(MAKE) -s files\:chown\:donations + +files\:chown: files\:chown\:gifts files\:chown\:donations + +files\:chown\:gifts: + $(call docker-root, be_gifts chown -R www-data: web/sites/default/files) + +files\:chown\:donations: + $(call docker-root, be_donations chown -R www-data: web/sites/default/files) + +files\:chown\:wodby: files\:chown\:wodby\:gifts files\:chown\:wodby\:donations + +files\:chown\:wodby\:gifts: + $(call docker-root, be_gifts chown -R wodby: web/sites/default/files) + +files\:chown\:wodby\:donations: + $(call docker-root, be_donations chown -R wodby: web/sites/default/files) + +##################################### +# Installation from config profile. # +##################################### + +install\:config: | prepare install\:config\:gifts install\:config\:donations + +install\:config\:gifts: | prepare + $(call message,BE Gifts: Make settings.php writable) + $(call docker, be_gifts chmod 666 web/sites/default/settings.php) + $(call message,BE Gifts: Installing site) + $(MAKE) -s drush be_gifts site-install config_installer + $(call message,BE Gifts: Restore settings.php) + git checkout backend-gifts/web/sites/default/settings.php + $(call message,BE Gifts: Installing the module to import demo content) + $(MAKE) -s drush be_gifts en $(MODULES_GIFTS) + $(call message,BE Gifts: Disabling unnecessary modules after demo content import) + $(MAKE) -s drush be_gifts pmu $(MODULES_GIFTS) + +install\:config\:donations: | prepare + $(call message,BE Donations: Make settings.php writable) + $(call docker, be_donations chmod 666 web/sites/default/settings.php) + $(call message,BE Donations: Installing site) + $(MAKE) -s drush be_donations site-install config_installer + $(call message,BE Donations: Restore settings.php) + git checkout backend-donations/web/sites/default/settings.php + $(call message,BE Donations: Installing the module to import demo content) + $(MAKE) -s drush be_donations en $(MODULES_DONATIONS) + $(call message,BE Donations: Disabling unnecessary modules after demo content import) + $(MAKE) -s drush be_donations pmu $(MODULES_DONATIONS) + +#################################### +# Installation from database dump. # +#################################### + +install\:db: | install\:db\:gifts install\:db\:donations + +install\:db\:gifts: | prepare files\:sync\:gifts db\:dump\:gifts reinstall\:db\:gifts + +install\:db\:donations: | prepare files\:sync\:donations db\:dump\:donations reinstall\:db\:donations + +reinstall\:db: | reinstall\:db\:gifts reinstall\:db\:donations + +reinstall\:db\:gifts: | db\:import\:gifts update\:gifts + +reinstall\:db\:donations: | db\:import\:donations update\:donations + +######################## +# Database operations. # +######################## + +db\:dump: | db\:dump\:gifts db\:dump\:donations + +db\:dump\:gifts: + $(call message,BE Gifts: Creating DB dump) + -$(shell platform db:dump -y --project=${PLATFORM_PROJECT_ID} --environment=${PLATFORM_ENVIRONMENT} --app=${PLATFORM_APPLICATION_GIFTS} --relationship=${PLATFORM_RELATIONSHIP_GIFTS} --gzip --file=${BACKUP_DIR}/${DB_DUMP_NAME_GIFTS}.sql.gz) + +db\:dump\:donations: + $(call message,BE Donations: Creating DB dump) + -$(shell platform db:dump -y --project=${PLATFORM_PROJECT_ID} --environment=${PLATFORM_ENVIRONMENT} --app=${PLATFORM_APPLICATION_DONATIONS} --relationship=${PLATFORM_RELATIONSHIP_DONATIONS} --gzip --file=${BACKUP_DIR}/${DB_DUMP_NAME_DONATIONS}.sql.gz) + +db\:drop: | db\:drop\:gifts db\:drop\:donations + +db\:drop\:gifts: + $(call message,BE Gifts: Dropping DB) + $(MAKE) -s drush be_gifts sql-drop + +db\:drop\:donations: + $(call message,BE Donations: Dropping DB) + $(MAKE) -s drush be_donations sql-drop + +db\:import: | db\:import\:gifts db\:import\:donations + +db\:import\:gifts: | db\:drop\:gifts + sleep 30 + $(call message,BE Gifts: Importing DB) + $(call docker-www-data, be_gifts zcat ${BACKUP_DIR}/${DB_DUMP_NAME_GIFTS}.sql.gz | drush sql-cli) + +db\:import\:donations: | db\:drop\:donations + sleep 30 + $(call message,BE Donations: Importing DB) + $(call docker-www-data, be_donations zcat ${BACKUP_DIR}/${DB_DUMP_NAME_DONATIONS}.sql.gz | drush sql-cli) + +#################### +# Update backends. # +#################### + +update: | prepare update\:gifts update\:donations + +update\:gifts: + $(call message,BE Gifts: Updating cache) + $(MAKE) -s drush be_gifts cr + $(call message,BE Gifts: Applying database updates) + $(MAKE) -s drush be_gifts updb + $(call message,BE Gifts: Importing configs) + $(MAKE) -s drush be_gifts cim + $(call message,BE Gifts: Applying entity updates) + $(MAKE) -s drush be_gifts entup + +update\:donations: + $(call message,BE Donations: Updating cache) + $(MAKE) -s drush be_donations cr + $(call message,BE Donations: Applying database updates) + $(MAKE) -s drush be_donations updb + $(call message,BE Donations: Importing configs) + $(MAKE) -s drush be_donations cim + $(call message,BE Donations: Applying entity updates) + $(MAKE) -s drush be_donations entup + +########## +# Tests. # +########## + +tests\:prepare: + # Prepare codeception to run. + $(call docker, be_gifts ./vendor/bin/codecept --config=tests/codeception build) + # Run Gifts frontend with SSR support to test SSR as well. + @docker-compose stop fe_gifts + @docker-compose run fe_gifts yarn build + @docker-compose run -d fe_gifts yarn start:server + # Give node.js server several seconds to initialize. + @sleep 5 + +tests\:run: + $(MAKE) -s test be_gifts acceptance + +test: + # Remove the first argument from the list of make commands. + $(eval ARGS := $(filter-out $@,$(MAKECMDGOALS))) + $(call message,Target is \"$(firstword $(ARGS))\") + $(call message,Executing \"\./vendor/bin/codecept --config=tests/codeception run $(filter-out $(firstword $(ARGS)), $(ARGS))\") + $(call docker, $(firstword $(ARGS)) ./vendor/bin/codecept --config=tests/codeception run $(filter-out $(firstword $(ARGS)), $(ARGS)) --steps) + +# https://stackoverflow.com/a/6273809/1826109 +%: + @: diff --git a/README.md b/README.md index f5a7a11..69e6c68 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,32 @@ [![CircleCI](https://circleci.com/gh/systemseed/falcon.svg?style=shield&circle-token=7736ea9ff7656c7025fb3727b27a4f9d0be0857d)](https://circleci.com/gh/systemseed/falcon) -# Falcon - -This is the main repository for Falcon. You should start your journey by cloning this repo and following the instructions in this file. - -## Understanding the project's structure - -This repo contains Platform.sh multi-app project. -You'll find more info about it at their [documentation](https://docs.platform.sh/configuration/app/multi-app.html). - - ## Getting started - -1. Download this repo to your local environment: + +1. Add the following lines to your hosts file: ``` - git clone git@github.com:systemseed/falcon.git + 127.0.0.1 gifts.flc.local + 127.0.0.1 main.flc.local + 127.0.0.1 api.flc.local + 127.0.0.1 gifts.api.flc.local + 127.0.0.1 pma.gifts.api.flc.local + 127.0.0.1 donations.api.flc.local + 127.0.0.1 pma.donations.api.flc.local ``` + +2. Download this repository to your local environment: -2. Install [Platform.sh CLI](https://github.com/platformsh/platformsh-cli): - - ``` - curl -sS https://platform.sh/cli/installer | php ``` - - Don't forget to authenticate after the installation. CLI docs to the rescue. - -3. Run bash script `./local-prepare.sh` in the git root to prepare all necessary dependencies & local environment. - -4. Add the following lines to your hosts file: - - ``` - 127.0.0.1 main.flc.local gifts.flc.local api.flc.local gifts.api.flc.local donations.api.flc.local # FALCON installation + git clone git@github.com:systemseed/falcon.git ``` -5. Run `docker-compose up -d`. Profit! - -## Accessing web sites locally + +3. Run `make falcon:install` in the root of repository. Profit! -### Gifts Frontend +4. TODO -[http://gifts.flc.local](http://gifts.flc.local) -### Gifts Backend -[http://gifts.api.flc.local](http://gifts.api.flc.local) -### Donations Backend - -[http://donations.api.flc.local](http://donations.api.flc.local) - -### API Bus - -[http://api.flc.local](http://api.flc.local) ## Running ESLint for FrontEnd apps @@ -61,7 +36,3 @@ docker-compose run fe_gifts sh ./node_modules/.bin/eslint ./src ``` -## Shutting down the environments - -To shut the environment run `docker-compose stop`. - diff --git a/backend-donations/.gitignore b/backend-donations/.gitignore index 12214b3..cd046a8 100644 --- a/backend-donations/.gitignore +++ b/backend-donations/.gitignore @@ -6,9 +6,6 @@ web/modules/contrib web/themes/contrib web/profiles/contrib -# Ignore mysql files. -mysql - # Ignore Drupal's file directory web/sites/*/files diff --git a/backend-donations/composer.json b/backend-donations/composer.json index a4cb9a9..041e847 100644 --- a/backend-donations/composer.json +++ b/backend-donations/composer.json @@ -50,7 +50,7 @@ "drupal/ultimate_cron": "^2.0@alpha", "drupal/metatag": "^1.2", "drupal/config_ignore": "^2.0", - "drupal/config_installer": "^1.5", + "drupal/config_installer": "^1.8", "drupal/better_normalizers": "^1.0@beta", "drupal/default_content": "^1.0@alpha", "drupal/rest_absolute_urls": "^1.0@beta", diff --git a/backend-donations/composer.lock b/backend-donations/composer.lock index 7f18863..b00b730 100644 --- a/backend-donations/composer.lock +++ b/backend-donations/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7a6ea28d70155016407399e8663ba154", + "content-hash": "69322ca69f76121b1b044bd63845f7ef", "packages": [ { "name": "alchemy/zippy", @@ -2125,17 +2125,17 @@ }, { "name": "drupal/config_installer", - "version": "1.5.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://git.drupal.org/project/config_installer", - "reference": "8.x-1.5" + "reference": "8.x-1.8" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.5.zip", - "reference": "8.x-1.5", - "shasum": "ef2ea56469481c482c1ee716438a24b4ad12c6e2" + "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.8.zip", + "reference": "8.x-1.8", + "shasum": "43d7af76a3f00d074161e242ddf94d942d256250" }, "require": { "drupal/core": "~8.0" @@ -2146,8 +2146,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.5", - "datestamp": "1506257944", + "version": "8.x-1.8", + "datestamp": "1524572284", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -2156,7 +2156,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { diff --git a/backend-donations/config/sync/README.txt b/backend-donations/config/sync/README.txt new file mode 100644 index 0000000..37874bd --- /dev/null +++ b/backend-donations/config/sync/README.txt @@ -0,0 +1 @@ +This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync. For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config \ No newline at end of file diff --git a/backend-donations/web/modules/falcon/falcon_demo_content/content/user/3b111b33-7654-4933-a072-ea3c56ad70bd.json b/backend-donations/web/modules/falcon/falcon_demo_content/content/user/3b111b33-7654-4933-a072-ea3c56ad70bd.json deleted file mode 100644 index f85778e..0000000 --- a/backend-donations/web/modules/falcon/falcon_demo_content/content/user/3b111b33-7654-4933-a072-ea3c56ad70bd.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "_links": { - "self": { - "href": "http:\/\/default\/user\/18?_format=hal_json" - }, - "type": { - "href": "http:\/\/drupal.org\/rest\/type\/user\/user" - } - }, - "uid": [ - { - "value": 18 - } - ], - "uuid": [ - { - "value": "3b111b33-7654-4933-a072-ea3c56ad70bd" - } - ], - "langcode": [ - { - "value": "en", - "lang": "en" - } - ], - "preferred_langcode": [ - { - "value": "en" - } - ], - "preferred_admin_langcode": [ - { - "value": "en" - } - ], - "name": [ - { - "value": "gifts_manager.test" - } - ], - "mail": [ - { - "value": "flc.gifts_manager-test@systemseed.com" - } - ], - "timezone": [ - { - "value": "UTC" - } - ], - "status": [ - { - "value": true - } - ], - "created": [ - { - "value": 1493111825 - } - ], - "changed": [ - { - "value": 1509381343, - "lang": "en" - } - ], - "access": [ - { - "value": 1496327687 - } - ], - "login": [ - { - "value": 1496078514 - } - ], - "init": [ - { - "value": "flc.gifts_manager-test@systemseed.com" - } - ], - "roles": [ - { - "target_id": "gifts_manager" - } - ], - "default_langcode": [ - { - "value": true, - "lang": "en" - } - ] -} \ No newline at end of file diff --git a/backend-donations/web/modules/falcon/falcon_demo_content/content/user/5bda671a-dec8-4764-aeb0-a70e76fdeefa.json b/backend-donations/web/modules/falcon/falcon_demo_content/content/user/5bda671a-dec8-4764-aeb0-a70e76fdeefa.json deleted file mode 100644 index fdb4705..0000000 --- a/backend-donations/web/modules/falcon/falcon_demo_content/content/user/5bda671a-dec8-4764-aeb0-a70e76fdeefa.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "_links": { - "self": { - "href": "http:\/\/default\/user\/14?_format=hal_json" - }, - "type": { - "href": "http:\/\/drupal.org\/rest\/type\/user\/user" - } - }, - "uid": [ - { - "value": 14 - } - ], - "uuid": [ - { - "value": "5bda671a-dec8-4764-aeb0-a70e76fdeefa" - } - ], - "langcode": [ - { - "value": "en", - "lang": "en" - } - ], - "preferred_langcode": [ - { - "value": "en" - } - ], - "preferred_admin_langcode": [ - { - "value": "en" - } - ], - "name": [ - { - "value": "api.gifts_manager" - } - ], - "mail": [ - { - "value": "flc.api.gifts_manager-test@systemseed.com" - } - ], - "timezone": [ - { - "value": "UTC" - } - ], - "status": [ - { - "value": false - } - ], - "created": [ - { - "value": 1491678205 - } - ], - "changed": [ - { - "value": 1497017261, - "lang": "en" - } - ], - "access": [ - { - "value": 1509112832 - } - ], - "login": [ - { - "value": 0 - } - ], - "init": [ - { - "value": "flc.api.gifts_manager-test@systemseed.com" - } - ], - "roles": [ - { - "target_id": "gifts_manager" - } - ], - "default_langcode": [ - { - "value": true, - "lang": "en" - } - ] -} \ No newline at end of file diff --git a/backend-donations/web/modules/falcon/falcon_demo_content/content/user/6c6c8f0c-81a1-4fce-93e6-0330f87b3162.json b/backend-donations/web/modules/falcon/falcon_demo_content/content/user/6c6c8f0c-81a1-4fce-93e6-0330f87b3162.json deleted file mode 100644 index 0973618..0000000 --- a/backend-donations/web/modules/falcon/falcon_demo_content/content/user/6c6c8f0c-81a1-4fce-93e6-0330f87b3162.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_links": { - "self": { - "href": "http:\/\/default\/user\/9?_format=hal_json" - }, - "type": { - "href": "http:\/\/drupal.org\/rest\/type\/user\/user" - } - }, - "uid": [ - { - "value": 9 - } - ], - "uuid": [ - { - "value": "6c6c8f0c-81a1-4fce-93e6-0330f87b3162" - } - ], - "langcode": [ - { - "value": "en", - "lang": "en" - } - ], - "preferred_langcode": [ - { - "value": "en" - } - ], - "preferred_admin_langcode": [ - { - "value": "en" - } - ], - "name": [ - { - "value": "administrator.test" - } - ], - "mail": [ - { - "value": "flc.administrator-test@systemseed.com" - } - ], - "timezone": [ - { - "value": "UTC" - } - ], - "status": [ - { - "value": true - } - ], - "created": [ - { - "value": 1489059956 - } - ], - "changed": [ - { - "value": 1509381343, - "lang": "en" - } - ], - "access": [ - { - "value": 1497015582 - } - ], - "login": [ - { - "value": 1497015582 - } - ], - "roles": [ - { - "target_id": "administrator" - } - ], - "default_langcode": [ - { - "value": true, - "lang": "en" - } - ] -} \ No newline at end of file diff --git a/backend-donations/web/modules/falcon/falcon_development/falcon_development.install b/backend-donations/web/modules/falcon/falcon_development/falcon_development.install index 786e18d..21d6b77 100644 --- a/backend-donations/web/modules/falcon/falcon_development/falcon_development.install +++ b/backend-donations/web/modules/falcon/falcon_development/falcon_development.install @@ -1,26 +1,73 @@ id() == 'anonymous') { + continue; + } + + $username = $role->id() . '.test'; + /* @var $account \Drupal\user\Entity\User */ - if ($account = user_load_by_name($role->id() . '.test')) { - if ($account->isBlocked()) { - $account->activate(); - $account->save(); + $account = user_load_by_name($username); + if (empty($account)) { + $account = User::create(); + $account->enforceIsNew(); + $account->setEmail('test+falcon-' . $role->id() . '@systemseed.com'); + $account->setUsername($role->id() . '.test'); + $account->activate(); + + if ($role->id() !== 'authenticated') { + $account->addRole($role->id()); } + + drupal_set_message(t('User @username was created.', ['@username' => $account->getUsername()])); + } + else { + $account->activate(); } + + $account->setPassword('password'); + $account->save(); } } + +/** + * Deactivate test users on non-development environments. + */ +function deactivateTestUsers() { + + /* @var $role \Drupal\user\Entity\Role */ + foreach (\Drupal\user\Entity\Role::loadMultiple() as $role) { + + /* @var $account \Drupal\user\Entity\User */ + $account = user_load_by_name($role->id() . '.test'); + if (!empty($account)) { + $account->block(); + $account->save(); + } + } +} + diff --git a/backend-donations/web/profiles/config_installer/LICENSE.txt b/backend-donations/web/profiles/config_installer/LICENSE.txt deleted file mode 100644 index d159169..0000000 --- a/backend-donations/web/profiles/config_installer/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/backend-donations/web/profiles/config_installer/config_installer.info.yml b/backend-donations/web/profiles/config_installer/config_installer.info.yml deleted file mode 100644 index 22b4138..0000000 --- a/backend-donations/web/profiles/config_installer/config_installer.info.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: 'Configuration installer' -type: profile -description: 'Use configuration from another Drupal site to install a Drupal instance. Suitable for advanced users.' -# core: 8.x -# Un comment to completely remove profile selection. -#distribution: TRUE - -# Information added by Drupal.org packaging script on 2017-09-24 -version: '8.x-1.5' -core: '8.x' -project: 'config_installer' -datestamp: 1506257946 diff --git a/backend-donations/web/profiles/config_installer/config_installer.install b/backend-donations/web/profiles/config_installer/config_installer.install deleted file mode 100644 index 9a6921f..0000000 --- a/backend-donations/web/profiles/config_installer/config_installer.install +++ /dev/null @@ -1,20 +0,0 @@ -set('features.node_user_picture', FALSE)->save(); -// -// // Allow visitor account creation, but with administrative approval. -// \Drupal::config('user.settings')->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(); -//} diff --git a/backend-donations/web/profiles/config_installer/config_installer.profile b/backend-donations/web/profiles/config_installer/config_installer.profile deleted file mode 100644 index 610282b..0000000 --- a/backend-donations/web/profiles/config_installer/config_installer.profile +++ /dev/null @@ -1,353 +0,0 @@ - [ - 'display_name' => t('Upload config'), - 'type' => 'form', - 'function' => 'Drupal\config_installer\Form\SyncConfigureForm' - ], - 'config_install_batch' => [ - 'display_name' => t('Install configuration'), - 'type' => 'batch', - ], - 'config_download_translations' => [], - 'config_installer_fix_profile' => [], - ]; - $tasks = array_slice($tasks, 0, $key, true) + - $config_tasks + - array_slice($tasks, $key, NULL , true); - $tasks['install_configure_form']['function'] = 'Drupal\config_installer\Form\SiteConfigureForm'; -} - -/** - * Creates a batch for the config importer to process. - * - * @see config_installer_install_tasks_alter() - */ -function config_install_batch() { - // We need to manually trigger the installation of core-provided entity types, - // as those will not be handled by the module installer. - // @see install_profile_modules() - install_core_entity_type_definitions(); - - // Create a source storage that reads from sync. - $listing = new \Drupal\Core\Extension\ExtensionDiscovery(\Drupal::root()); - $listing->setProfileDirectories([]); - $sync = new SourceStorage(\Drupal::service('config.storage.sync'), $listing->scan('profile')); - - // Match up the site uuids, the install_base_system install task will have - // installed the system module and created a new UUID. - $system_site = $sync->read('system.site'); - \Drupal::configFactory()->getEditable('system.site')->set('uuid', $system_site['uuid'])->save(); - - // Create the storage comparer and the config importer. - $config_manager = \Drupal::service('config.manager'); - $storage_comparer = new StorageComparer($sync, \Drupal::service('config.storage'), $config_manager); - $storage_comparer->createChangelist(); - $config_importer = new ConfigImporter( - $storage_comparer, - \Drupal::service('event_dispatcher'), - $config_manager, - \Drupal::service('lock.persistent'), - \Drupal::service('config.typed'), - \Drupal::service('module_handler'), - \Drupal::service('module_installer'), - \Drupal::service('theme_handler'), - \Drupal::service('string_translation') - ); - - try { - $sync_steps = $config_importer->initialize(); - - // Implementing hook_config_import_steps_alter() in this file does not work - // if using the 'drush site-install' command. Add the step to fix the import - // profile before the last step of the configuration import. - $last = array_pop($sync_steps); - $sync_steps[] = 'config_installer_install_uninstalled_profile_dependencies'; - $sync_steps[] = 'config_installer_config_import_profile'; - $sync_steps[] = $last; - - $batch = [ - 'operations' => [], - 'finished' => 'config_install_batch_finish', - 'title' => t('Synchronizing configuration'), - 'init_message' => t('Starting configuration synchronization.'), - 'progress_message' => t('Completed @current step of @total.'), - 'error_message' => t('Configuration synchronization has encountered an error.'), - 'file' => drupal_get_path('module', 'config') . '/config.admin.inc', - ]; - foreach ($sync_steps as $sync_step) { - $batch['operations'][] = ['config_install_batch_process', [$config_importer, $sync_step]]; - } - - return $batch; - } - catch (ConfigImporterException $e) { - // There are validation errors. - drupal_set_message(\Drupal::translation()->translate('The configuration synchronization failed validation.')); - foreach ($config_importer->getErrors() as $message) { - drupal_set_message($message, 'error'); - } - } -} - -/** - * Processes the config import batch and persists the importer. - * - * @param \Drupal\Core\Config\ConfigImporter $config_importer - * The batch config importer object to persist. - * @param string $sync_step - * The synchronisation step to do. - * @param $context - * The batch context. - * - * @see config_install_batch() - */ -function config_install_batch_process(ConfigImporter $config_importer, $sync_step, &$context) { - if (!isset($context['sandbox']['config_importer'])) { - $context['sandbox']['config_importer'] = $config_importer; - } - - $config_importer = $context['sandbox']['config_importer']; - $config_importer->doSyncStep($sync_step, $context); - if ($errors = $config_importer->getErrors()) { - if (!isset($context['results']['errors'])) { - $context['results']['errors'] = []; - } - $context['results']['errors'] += $errors; - } -} - -/** - * Finish config importer batch. - * - * @see config_install_batch() - */ -function config_install_batch_finish($success, $results, $operations) { - if ($success) { - if (!empty($results['errors'])) { - foreach ($results['errors'] as $error) { - drupal_set_message($error, 'error'); - \Drupal::logger('config_sync')->error($error); - } - drupal_set_message(\Drupal::translation()->translate('The configuration was imported with errors.'), 'warning'); - } - else { - // Configuration sync needs a complete cache flush. - drupal_flush_all_caches(); - } - } - else { - // An error occurred. - // $operations contains the operations that remained unprocessed. - $error_operation = reset($operations); - $message = \Drupal::translation() - ->translate('An error occurred while processing %error_operation with arguments: @arguments', [ - '%error_operation' => $error_operation[0], - '@arguments' => print_r($error_operation[1], TRUE) - ]); - drupal_set_message($message, 'error'); - } -} - -/** - * Ensures all profile dependencies are created. - * - * @param array $context. - * The batch context. - * @param \Drupal\Core\Config\ConfigImporter $config_importer - * The config importer. - * - * @see config_install_batch() - */ -function config_installer_install_uninstalled_profile_dependencies(array &$context, ConfigImporter $config_importer) { - if (!array_key_exists('missing_profile_dependencies', $context)) { - $profile = _config_installer_get_original_install_profile(); - $profile_file = drupal_get_path('profile', $profile) . "/$profile.info.yml"; - $info = \Drupal::service('info_parser')->parse($profile_file); - $dependencies = isset($info['dependencies']) ? $info['dependencies'] : []; - $context['missing_profile_dependencies'] = array_diff($dependencies, array_keys(\Drupal::moduleHandler()->getModuleList())); - if (count($context['missing_profile_dependencies']) === 0) { - $context['finished'] = 1; - return; - } - // @todo Need to dependency sort them... - } - - $still_missing = array_diff($context['missing_profile_dependencies'], array_keys(\Drupal::moduleHandler()->getModuleList())); - if (!empty($still_missing)) { - $missing_module = array_shift($still_missing); - // This is not a config sync module install... fun! - \Drupal::service('config.installer')->setSyncing(FALSE); - \Drupal::service('module_installer')->install([$missing_module]); - $context['message'] = t('Installed @module. This will be uninstalled after the profile has been installed.', ['@module' => $missing_module]); - } - $context['finished'] = (count($context['missing_profile_dependencies']) - count($still_missing)) / count($context['missing_profile_dependencies']); -} - -/** - * Processes profile as part of configuration sync. - * - * @param array $context. - * The batch context. - * @param \Drupal\Core\Config\ConfigImporter $config_importer - * The config importer. - * - * @see config_install_batch() - */ -function config_installer_config_import_profile(array &$context, ConfigImporter $config_importer) { - $orginal_profile = _config_installer_get_original_install_profile(); - if ($orginal_profile) { - \Drupal::service('config.installer') - ->setSyncing(TRUE) - ->setSourceStorage($config_importer->getStorageComparer()->getSourceStorage()); - \Drupal::service('module_installer')->install([$orginal_profile], FALSE); - module_set_weight($orginal_profile, 1000); - $context['message'] = t('Synchronising install profile: @name.', ['@name' => $orginal_profile]); - } - $context['finished'] = 1; -} - -/** - * Fixes configuration if the install profile has made changes in hook_install(). - * - * @see config_installer_install_tasks_alter() - */ -function config_installer_fix_profile() { - global $install_state; - // It is possible that installing the profile makes unintended configuration - // changes. - $config_manager = \Drupal::service('config.manager'); - $storage_comparer = new StorageComparer(\Drupal::service('config.storage.sync'), \Drupal::service('config.storage'), $config_manager); - $storage_comparer->createChangelist(); - if ($storage_comparer->hasChanges()) { - // Swap out the install profile so that the profile module exists. - _config_installer_switch_profile(_config_installer_get_original_install_profile()); - system_list_reset(); - $config_importer = new ConfigImporter( - $storage_comparer, - \Drupal::service('event_dispatcher'), - $config_manager, - \Drupal::service('lock.persistent'), - \Drupal::service('config.typed'), - \Drupal::service('module_handler'), - \Drupal::service('module_installer'), - \Drupal::service('theme_handler'), - \Drupal::service('string_translation') - ); - try { - $config_importer->import(); - } - catch (ConfigImporterException $e) { - // There are validation errors. - drupal_set_message(\Drupal::translation()->translate('The configuration synchronization failed validation.')); - foreach ($config_importer->getErrors() as $message) { - drupal_set_message($message, 'error'); - } - } - - // At this point the configuration should match completely. - if (\Drupal::moduleHandler()->moduleExists('language')) { - // If the English language exists at this point we need to ensure - // install_download_additional_translations_operations() does not delete - // it. - if (\Drupal\language\Entity\ConfigurableLanguage::load('en')) { - $install_state['profile_info']['keep_english'] = TRUE; - } - } - // Replace the install profile so that the config_installer still works. - _config_installer_switch_profile('config_installer'); - system_list_reset(); - } -} - -/** - * Switch the currently active profile in the installer. - * - * @param string $profile - * The profile to switch to. - */ -function _config_installer_switch_profile($profile) { - global $install_state; - $install_state['parameters']['profile'] = $profile; - $settings = Settings::getAll(); - $settings['install_profile'] = $profile; - new Settings($settings); -} - -/** - * Gets the original install profile name. - * - * @return string|null - * The name of the install profile from the sync configuration. - */ -function _config_installer_get_original_install_profile() { - // In Drupal 8.3 the profile is written to config and not settings. - $core = \Drupal::service('config.storage.sync')->read('core.extension'); - if (isset($core['profile'])) { - return $core['profile']; - } - - $original_profile = NULL; - // Profiles need to be extracted from the install list if they are there. - // This is because profiles need to be installed after all the configuration - // has been processed. - $listing = new \Drupal\Core\Extension\ExtensionDiscovery(\Drupal::root()); - $listing->setProfileDirectories([]); - // Read directly from disk since the source storage in the config importer is - // being altered to exclude profiles. - $profiles = array_intersect_key($listing->scan('profile'), $core['module']); - - if (!empty($profiles)) { - // There can be only one. - $original_profile = key($profiles); - } - return $original_profile; -} - -/** - * Replaces install_download_translation() during config_installer installs. - * - * @param array $install_state - * An array of information about the current installation state. - * - * @return string - * A themed status report, or an exception if there are requirement errors. - * Upon successful download the page is reloaded and no output is returned. - * - * @see install_download_translation() - */ -function config_download_translations(&$install_state) { - $needs_download = isset($install_state['parameters']['langcode']) && !isset($install_state['translations'][$install_state['parameters']['langcode']]) && $install_state['parameters']['langcode'] !== 'en'; - if ($needs_download) { - return install_download_translation($install_state); - } -} diff --git a/backend-donations/web/profiles/config_installer/src/Form/SiteConfigureForm.php b/backend-donations/web/profiles/config_installer/src/Form/SiteConfigureForm.php deleted file mode 100644 index d11a478..0000000 --- a/backend-donations/web/profiles/config_installer/src/Form/SiteConfigureForm.php +++ /dev/null @@ -1,222 +0,0 @@ -root = $root; - $this->sitePath = $site_path; - $this->userStorage = $user_storage; - $this->state = $state; - $this->moduleHandler = $module_handler; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('app.root'), - $container->get('site.path'), - $container->get('entity.manager')->getStorage('user'), - $container->get('state'), - $container->get('module_handler') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'config_installer_site_configure_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $form['#title'] = $this->t('Configure site'); - - // Warn about settings.php permissions risk. - $settings_file = $this->sitePath . '/settings.php'; - // Check that $_POST is empty so we only show this message when the form is - // first displayed, not on the next page after it is submitted. We do not - // want to repeat it multiple times because it is a general warning that is - // not related to the rest of the installation process; it would also be - // especially out of place on the last page of the installer, where it would - // distract from the message that the Drupal installation has completed - // successfully. - $post_params = $this->getRequest()->request->all(); - if (empty($post_params)) { - $original_profile_name = _config_installer_get_original_install_profile(); - $need_to_write_settings = $original_profile_name !== Settings::get('install_profile'); - // In Drupal 8.3.x it is not necessary to have an install profile written - // to settings.php. - if (version_compare(\Drupal::VERSION, '8.3', '>=') && !is_writable(\Drupal::service('site.path') . '/settings.php')) { - \Drupal::service('kernel')->invalidateContainer(); - $need_to_write_settings = FALSE; - } - if ($need_to_write_settings) { - $settings['settings']['install_profile'] = (object) [ - 'value' => $original_profile_name, - 'required' => TRUE, - ]; - drupal_rewrite_settings($settings); - } - - if (!drupal_verify_install_file($this->root . '/' . $settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE) || !drupal_verify_install_file($this->root . '/' . $this->sitePath, FILE_NOT_WRITABLE, 'dir')) { - drupal_set_message(t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the online handbook.', [ - '%dir' => $this->sitePath, - '%file' => $settings_file, - '@handbook_url' => 'http://drupal.org/server-permissions', - ]), 'warning'); - } - } - - $form['#attached']['library'][] = 'system/drupal.system'; - - $form['admin_account'] = [ - '#type' => 'fieldgroup', - '#title' => $this->t('Site maintenance account'), - ]; - $form['admin_account']['account']['name'] = [ - '#type' => 'textfield', - '#title' => $this->t('Username'), - '#maxlength' => USERNAME_MAX_LENGTH, - '#description' => $this->t('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'), - '#required' => TRUE, - '#attributes' => ['class' => ['username']], - ]; - $form['admin_account']['account']['pass'] = [ - '#type' => 'password_confirm', - '#required' => TRUE, - '#size' => 25, - ]; - $form['admin_account']['account']['#tree'] = TRUE; - $form['admin_account']['account']['mail'] = [ - '#type' => 'email', - '#title' => $this->t('Email address'), - '#required' => TRUE, - ]; - - // Use default drush options if available whilst running a site install. - if (function_exists('drush_get_option') && function_exists('drush_generate_password')) { - $form['admin_account']['account']['name']['#default_value'] = drush_get_option('account-name', 'admin'); - $form['admin_account']['account']['pass']['#type'] = 'textfield'; - $form['admin_account']['account']['pass']['#default_value'] = drush_get_option('account-pass', drush_generate_password()); - $form['admin_account']['account']['mail']['#default_value'] = drush_get_option('account-mail', 'admin@example.com'); - } - - $form['actions'] = ['#type' => 'actions']; - $form['actions']['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Save and continue'), - '#weight' => 15, - '#button_type' => 'primary', - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, FormStateInterface $form_state) { - if ($error = user_validate_name($form_state->getValue(['account', 'name']))) { - $form_state->setErrorByName('account][name', $error); - } - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - - $account_values = $form_state->getValue('account'); - - // We precreated user 1 with placeholder values. Let's save the real values. - $account = $this->userStorage->load(1); - $account->init = $account->mail = $account_values['mail']; - $account->roles = $account->getRoles(); - $account->activate(); - $account->timezone = $form_state->getValue('date_default_timezone'); - $account->pass = $account_values['pass']; - $account->name = $account_values['name']; - $account->save(); - - // Record when this install ran. - $this->state->set('install_time', $_SERVER['REQUEST_TIME']); - - if (version_compare(\Drupal::VERSION, '8.3', '>=')) { - // We need to invalidate the container to ensure that the correct profile - // is used on after installation. - \Drupal::service('kernel')->invalidateContainer(); - } - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Form/SyncConfigureForm.php b/backend-donations/web/profiles/config_installer/src/Form/SyncConfigureForm.php deleted file mode 100644 index 63fdab7..0000000 --- a/backend-donations/web/profiles/config_installer/src/Form/SyncConfigureForm.php +++ /dev/null @@ -1,214 +0,0 @@ -t('Configure configuration import location'); - - $form['sync_directory'] = [ - '#type' => 'textfield', - '#title' => $this->t('Synchronisation directory'), - '#default_value' => config_get_config_directory(CONFIG_SYNC_DIRECTORY), - '#maxlength' => 255, - '#description' => $this->t('Path to the config directory you wish to import, can be relative to document root or an absolute path.'), - '#required' => TRUE, - // This value can only be changed if settngs.php is writable. - '#disabled' => !is_writable(\Drupal::service('site.path') . '/settings.php') - ]; - - $form['import_tarball'] = [ - '#type' => 'file', - '#title' => $this->t('Select your configuration export file'), - '#description' => $this->t('If the sync directory is empty you can upload a configuration export file.'), - ]; - - $form['actions'] = ['#type' => 'actions']; - $form['actions']['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Save and continue'), - '#weight' => 15, - '#button_type' => 'primary', - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, FormStateInterface $form_state) { - global $config_directories; - - $file_upload = $this->getRequest()->files->get('files[import_tarball]', NULL, TRUE); - $has_upload = FALSE; - if ($file_upload && $file_upload->isValid()) { - // The sync directory must be empty if we are doing an upload. - $form_state->setValue('import_tarball', $file_upload->getRealPath()); - $has_upload = TRUE; - } - $sync_directory = $form_state->getValue('sync_directory'); - // If we've customised the sync directory ensure its good to go. - if ($sync_directory !== config_get_config_directory(CONFIG_SYNC_DIRECTORY)) { - // We have to create the directory if it does not exist. If it exists we - // need to ensure it is writeable is we are processing an upload. - $create_directory = !is_dir($sync_directory) || $has_upload; - if ($create_directory && !file_prepare_directory($sync_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { - $form_state->setErrorByName('sync_directory', t('The directory %directory could not be created or could not be made writable. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see the online handbook.', [ - '%directory' => $sync_directory, - '@handbook_url' => 'http://drupal.org/server-permissions', - ])); - } - } - - // If no tarball ensure we have files. - if (!$has_upload && !$form_state->hasAnyErrors()) { - $sync = new FileStorage($sync_directory); - if (count($sync->listAll()) === 0) { - $form_state->setErrorByName('sync_directory', $this->t('No file upload provided and the sync directory is empty')); - } - } - - // Early exit if we have errors. - if ($form_state->hasAnyErrors()) { - return; - } - - // Update the sync directory setting if required. - if ($sync_directory !== config_get_config_directory(CONFIG_SYNC_DIRECTORY)) { - $settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) [ - 'value' => $sync_directory, - 'required' => TRUE, - ]; - drupal_rewrite_settings($settings); - $config_directories[CONFIG_SYNC_DIRECTORY] = $sync_directory; - } - - // Upload tarball if provided so we can validate the files. - if ($tarball_path = $form_state->getValue('import_tarball')) { - // Ensure that we have an empty directory if we're going. - $sync = new FileStorage($sync_directory); - $sync->deleteAll(); - try { - $archiver = new ArchiveTar($tarball_path, 'gz'); - $files = []; - $list = $archiver->listContent(); - if (is_array($list)) { - /** @var array $list */ - foreach ($list as $file) { - $files[] = $file['filename']; - } - $archiver->extractList($files, config_get_config_directory(CONFIG_SYNC_DIRECTORY)); - } - } - catch (\Exception $e) { - $form_state->setErrorByName('import_tarball', $this->t('Could not extract the contents of the tar file. The error message is @message', ['@message' => $e->getMessage()])); - } - drupal_unlink($tarball_path); - if (empty($files)) { - $form_state->setErrorByName('import_tarball', $this->t('The tar file contoins no files.')); - } - } - - // Early exit if we have errors. - if ($form_state->hasAnyErrors()) { - return; - } - - // Create a source storage that reads from sync. - $listing = new ExtensionDiscovery(\Drupal::root()); - $listing->setProfileDirectories([]); - $sync = new SourceStorage(\Drupal::service('config.storage.sync'), $listing->scan('profile')); - - // Match up the site uuids, the install_base_system install task will have - // installed the system module and created a new UUID. - $system_site = $sync->read('system.site'); - \Drupal::configFactory()->getEditable('system.site')->set('uuid', $system_site['uuid'])->save(); - - if (version_compare(\Drupal::VERSION, '8.3', '>=')){ - // In Drupal 8.3.x the install profile has moved to configuration. - // @see https://www.drupal.org/node/2156401 - \Drupal::configFactory() - ->getEditable('core.extension') - ->set('profile', _config_installer_get_original_install_profile()) - ->save(); - } - - // Create the storage comparer and the config importer. - $config_manager = \Drupal::service('config.manager'); - $storage_comparer = new StorageComparer($sync, \Drupal::service('config.storage'), $config_manager); - $storage_comparer->createChangelist(); - $config_importer = new ConfigImporter( - $storage_comparer, - \Drupal::service('event_dispatcher'), - $config_manager, - \Drupal::service('lock.persistent'), - \Drupal::service('config.typed'), - \Drupal::service('module_handler'), - \Drupal::service('module_installer'), - \Drupal::service('theme_handler'), - \Drupal::service('string_translation') - ); - - try { - $config_importer->validate(); - } - catch (ConfigImporterException $e) { - $error_message = [ - '#type' => 'inline_template', - '#template' => '{% trans %}The configuration cannot be imported because it failed validation for the following reasons:{% endtrans%}{{ errors }}', - '#context' => [ - 'errors' => [ - '#theme' => 'item_list', - '#items' => $config_importer->getErrors(), - ], - ], - ]; - - $field_name = $has_upload ? 'import_tarball' : 'sync_directory'; - $form_state->setErrorByName($field_name, \Drupal::service('renderer')->renderPlain($error_message)); - } - - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - global $install_state; - // Change the langcode to the site default langcode provided by the - // configuration. - $config_storage = new FileStorage(config_get_config_directory(CONFIG_SYNC_DIRECTORY)); - $install_state['parameters']['langcode'] = $config_storage->read('system.site')['langcode']; - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Storage/SourceStorage.php b/backend-donations/web/profiles/config_installer/src/Storage/SourceStorage.php deleted file mode 100644 index 0a9b644..0000000 --- a/backend-donations/web/profiles/config_installer/src/Storage/SourceStorage.php +++ /dev/null @@ -1,144 +0,0 @@ -baseStorage = $base_storage; - $this->profiles = $profiles; - } - - /** - * {@inheritdoc} - */ - public function exists($name) { - return $this->baseStorage->exists($name); - } - - /** - * {@inheritdoc} - */ - public function read($name) { - $data = $this->baseStorage->read($name); - if ($name === 'core.extension' && isset($data['module'])) { - // Remove any profiles from the list. These will be installed later. - // @see config_installer_config_import_profile() - $data['module'] = array_diff_key($data['module'], $this->profiles); - } - return $data; - } - - /** - * {@inheritdoc} - */ - public function readMultiple(array $names) { - $list = []; - foreach ($names as $name) { - if ($data = $this->read($name)) { - $list[$name] = $data; - } - } - return $list; - } - - /** - * {@inheritdoc} - */ - public function write($name, array $data) { - return $this->baseStorage->write($name, $data); - } - - /** - * {@inheritdoc} - */ - public function delete($name) { - return $this->baseStorage->delete($name); - } - - /** - * {@inheritdoc} - */ - public function rename($name, $new_name) { - return $this->baseStorage->rename($name, $new_name); - } - - /** - * {@inheritdoc} - */ - public function encode($data) { - return $this->baseStorage->encode($data); - } - - /** - * {@inheritdoc} - */ - public function decode($raw) { - return $this->baseStorage->decode($raw); - } - - /** - * {@inheritdoc} - */ - public function listAll($prefix = '') { - return $this->baseStorage->listAll($prefix); - } - - /** - * {@inheritdoc} - */ - public function deleteAll($prefix = '') { - return $this->baseStorage->deleteAll($prefix); - } - - /** - * {@inheritdoc} - */ - public function createCollection($collection) { - return new static($this->baseStorage->createCollection($collection), $this->profiles); - } - - /** - * {@inheritdoc} - */ - public function getAllCollectionNames() { - return $this->baseStorage->getAllCollectionNames(); - } - - /** - * {@inheritdoc} - */ - public function getCollectionName() { - return $this->baseStorage->getCollectionName(); - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerEnSecondTest.php b/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerEnSecondTest.php deleted file mode 100644 index 254ab62..0000000 --- a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerEnSecondTest.php +++ /dev/null @@ -1,77 +0,0 @@ -drupalPostForm(NULL, ['files[import_tarball]' => $this->getTarball()], 'Save and continue'); - } - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - // Do assertions from parent. - require_once \Drupal::root() . '/core/includes/install.inc'; - $this->assertRaw(t('Congratulations, you installed @drupal fr!', [ - '@drupal' => drupal_install_profile_distribution_name(), - ])); - // Even though we began the install in English the configuration is French - // so that takes precedence. - $this->assertEqual('fr', \Drupal::config('system.site')->get('default_langcode')); - $this->assertTrue(ConfigurableLanguage::load('en'), "The language 'en' exists"); - $this->assertTrue(\Drupal::service('language_manager')->isMultilingual()); - } - - /** - * {@inheritdoc} - */ - protected function setUpLanguage() { - // Place custom local translations in the translations directory so that we - // don't go and translate everything. - mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); - file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.fr.po', $this->getPo('fr')); - - parent::setUpLanguage(); - } - - /** - * Returns the string for the test .po file. - * - * @param string $langcode - * The language code. - * - * @return string - * Contents for the test .po file. - */ - protected function getPo($langcode) { - return <<versionTarball('english-second.tar.gz'); - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerFrDirectorySyncTest.php b/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerFrDirectorySyncTest.php deleted file mode 100644 index aaf855b..0000000 --- a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerFrDirectorySyncTest.php +++ /dev/null @@ -1,80 +0,0 @@ -syncDir = 'public://' . $this->randomMachineName(128); - parent::setUp(); - } - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - // Create a new sync directory. - drupal_mkdir($this->syncDir); - - // Extract the tarball into the sync directory. - $this->extractTarball($this->getTarball(), $this->syncDir); - - $this->drupalPostForm(NULL, ['sync_directory' => drupal_realpath($this->syncDir)], 'Save and continue'); - } - - /** - * Submit the config_installer_site_configure_form. - * - * @see \Drupal\config_installer\Form\SiteConfigureForm - */ - protected function setUpInstallConfigureForm() { - $params = $this->parameters['forms']['install_configure_form']; - unset($params['site_name']); - unset($params['site_mail']); - unset($params['update_status_module']); - $edit = $this->translatePostValues($params); - $this->drupalPostForm(NULL, $edit, 'Enregistrer et continuer'); - } - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - // Do assertions from parent. - require_once \Drupal::root() . '/core/includes/install.inc'; - $this->assertText('Félicitations, vous avez installé'); - $this->assertText(drupal_install_profile_distribution_name()); - - // Even though we began the install in English the configuration is French - // so that takes precedence. - $this->assertEqual('fr', \Drupal::config('system.site')->get('default_langcode')); - $this->assertFalse(\Drupal::service('language_manager')->isMultilingual()); - } - - /** - * {@inheritdoc} - */ - protected function getTarball() { - // Exported configuration after a minimal profile install in French. - return $this->versionTarball('missing-language-entity.tar.gz'); - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerFrTarballTest.php b/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerFrTarballTest.php deleted file mode 100644 index a668b2e..0000000 --- a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerFrTarballTest.php +++ /dev/null @@ -1,74 +0,0 @@ -drupalPostForm(NULL, ['files[import_tarball]' => $this->getTarball()], 'Save and continue'); - } - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - // Do assertions from parent. - require_once \Drupal::root() . '/core/includes/install.inc'; - $this->assertRaw(t('Congratulations, you installed @drupal fr!', [ - '@drupal' => drupal_install_profile_distribution_name(), - ])); - // Even though we began the install in English the configuration is French - // so that takes precedence. - $this->assertEqual('fr', \Drupal::config('system.site')->get('default_langcode')); - $this->assertFalse(\Drupal::service('language_manager')->isMultilingual()); - } - - /** - * {@inheritdoc} - */ - protected function setUpLanguage() { - // Place custom local translations in the translations directory so that we - // don't go and translate everything. - mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); - file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.fr.po', $this->getPo('fr')); - - parent::setUpLanguage(); - } - - /** - * Returns the string for the test .po file. - * - * @param string $langcode - * The language code. - * - * @return string - * Contents for the test .po file. - */ - protected function getPo($langcode) { - return <<versionTarball('minimal-fr.tar.gz'); - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerNoDependenciesProfile.php b/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerNoDependenciesProfile.php deleted file mode 100644 index ed74a70..0000000 --- a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerNoDependenciesProfile.php +++ /dev/null @@ -1,37 +0,0 @@ -info = [ - 'type' => 'profile', - 'core' => \Drupal::CORE_COMPATIBILITY, - 'name' => 'Profile with no dependencies', - ]; - // File API functions are not available yet. - $path = $this->siteDirectory . '/profiles/no_dependencies_profile'; - mkdir($path, 0777, TRUE); - file_put_contents("$path/no_dependencies_profile.info.yml", Yaml::encode($this->info)); - - parent::setUp(); - } - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->versionTarball('no_dependencies_profile.tar.gz')], 'Save and continue'); - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerSyncTest.php b/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerSyncTest.php deleted file mode 100644 index 08839f2..0000000 --- a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerSyncTest.php +++ /dev/null @@ -1,70 +0,0 @@ -syncDir = 'public://' . $this->randomMachineName(128); - parent::setUp(); - } - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - // Do assertions from parent. - parent::testInstaller(); - - // Do assertions specific to test. - $this->assertEqual(drupal_realpath($this->syncDir), config_get_config_directory(CONFIG_SYNC_DIRECTORY), 'The sync directory has been updated during the installation.'); - $this->assertEqual(USER_REGISTER_ADMINISTRATORS_ONLY, \Drupal::config('user.settings')->get('register'), 'Ensure standard_install() does not overwrite user.settings::register.'); - $this->assertEqual([], \Drupal::entityDefinitionUpdateManager()->getChangeSummary(), 'There are no entity or field definition updates.'); - } - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - // Create a new sync directory. - drupal_mkdir($this->syncDir); - - // Extract the tarball into the sync directory. - $this->extractTarball($this->getTarball(), $this->syncDir); - - // Change the user.settings::register so that we can test that - // standard_install() does not override it. - $sync = new FileStorage($this->syncDir); - $user_settings = $sync->read('user.settings'); - $user_settings['register'] = USER_REGISTER_ADMINISTRATORS_ONLY; - $sync->write('user.settings', $user_settings); - - // Create config for a module that will not be enabled. - $sync->write('foo.bar', []); - $this->drupalPostForm(NULL, ['sync_directory' => drupal_realpath($this->syncDir)], 'Save and continue'); - $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:'); - $this->assertText('Configuration foo.bar depends on the foo extension that will not be installed after import.'); - - // Remove incorrect config and continue on. - $sync->delete('foo.bar'); - $this->drupalPostForm(NULL, ['sync_directory' => drupal_realpath($this->syncDir)], 'Save and continue'); - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerTarballTest.php b/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerTarballTest.php deleted file mode 100644 index 6236222..0000000 --- a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerTarballTest.php +++ /dev/null @@ -1,32 +0,0 @@ -drupalPostForm(NULL, ['files[import_tarball]' => $this->versionTarball('broken.tar.gz')], 'Save and continue'); - $this->assertText('Could not extract the contents of the tar file.'); - - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->versionTarball('empty.tar.gz')], 'Save and continue'); - $this->assertText('The tar file contoins no files.'); - - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->versionTarball('minimal-validation-fail.tar.gz')], 'Save and continue'); - $this->assertText('The tar file contoins no files.'); - $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:'); - $this->assertText('Configuration foo.bar depends on the foo extension that will not be installed after import.'); - - // Upload the tarball. - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->getTarball()], 'Save and continue'); - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerTestBase.php b/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerTestBase.php deleted file mode 100644 index ab02a87..0000000 --- a/backend-donations/web/profiles/config_installer/src/Tests/ConfigInstallerTestBase.php +++ /dev/null @@ -1,210 +0,0 @@ -isInstalled) { - // Ensure the test environment has the latest container. - $this->rebuildAll(); - - $sync = \Drupal::service('config.storage.sync'); - $sync_core_extension = $sync->read('core.extension'); - // Ensure that the correct install profile is active. - if (version_compare(\Drupal::VERSION, '8.3', '>=')) { - $this->assertEqual($sync_core_extension['profile'], \Drupal::installProfile()); - } - else { - $listing = new ExtensionDiscovery(\Drupal::root()); - $listing->setProfileDirectories([]); - $profiles = array_intersect_key($listing->scan('profile'), $sync_core_extension['module']); - $current_profile = Settings::get('install_profile'); - $this->assertFalse(empty($current_profile), 'The $install_profile setting exists'); - $this->assertEqual($current_profile, key($profiles)); - } - - // Ensure that the configuration has been completely synced. - $this->assertNoSynDifferences(); - } - } - - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - $this->assertUrl('user/1'); - $this->assertResponse(200); - // Confirm that we are logged-in after installation. - $this->assertText($this->rootUser->getUsername()); - - // @todo hmmm this message is wrong! - // Verify that the confirmation message appears. - require_once \Drupal::root() . '/core/includes/install.inc'; - $this->assertRaw(t('Congratulations, you installed @drupal!', [ - '@drupal' => drupal_install_profile_distribution_name(), - ])); - } - - /** - * Overrides method. - * - * We have several forms to navigate through. - */ - protected function setUpSite() { - // Recreate the container so that we can simulate the submission of the - // SyncConfigureForm after the full bootstrap has occurred. Without out this - // drupal_realpath() does not work so uploading files through - // WebTestBase::postForm() is impossible. - $request = Request::createFromGlobals(); - $class_loader = require $this->container->get('app.root') . '/vendor/autoload.php'; - Settings::initialize($this->container->get('app.root'), DrupalKernel::findSitePath($request), $class_loader); - foreach ($GLOBALS['config_directories'] as $type => $path) { - $this->configDirectories[$type] = $path; - } - $this->kernel = DrupalKernel::createFromRequest($request, $class_loader, 'prod', FALSE); - $this->kernel->prepareLegacyRequest($request); - $this->container = $this->kernel->getContainer(); - - $this->setUpSyncForm(); - $this->setUpInstallConfigureForm(); - // If we've got to this point the site is installed using the regular - // installation workflow. - $this->isInstalled = TRUE; - } - - /** - * Submit the config_installer_sync_configure_form. - * - * @see \Drupal\config_installer\Form\SyncConfigureForm - */ - abstract protected function setUpSyncForm(); - - /** - * Submit the config_installer_site_configure_form. - * - * @see \Drupal\config_installer\Form\SiteConfigureForm - */ - protected function setUpInstallConfigureForm() { - $params = $this->parameters['forms']['install_configure_form']; - unset($params['site_name']); - unset($params['site_mail']); - unset($params['update_status_module']); - $edit = $this->translatePostValues($params); - $this->drupalPostForm(NULL, $edit, $this->translations['Save and continue']); - } - - /** - * Gets the tarball for testing. - * - * @var string - */ - protected function getTarball() { - // Exported configuration after a minimal profile install. - return $this->versionTarball('minimal.tar.gz'); - } - - /** - * Gets a tarball for the right version of Drupal. - * - * @param $tarball - * The tarball filename. - * - * @return string - * The fullpath to the tarball. - */ - protected function versionTarball($tarball) { - include_once \Drupal::root() . '/core/includes/install.core.inc'; - $version = _install_get_version_info(\Drupal::VERSION); - $versioned_file = __DIR__ . '/Fixtures/' . $version['major'] . '.' . $version['minor'] . '/' . $tarball; - if (file_exists($versioned_file)) { - return $versioned_file; - } - return __DIR__ . '/Fixtures/' . $tarball; - } - - /** - * Extracts a tarball to a directory. - * - * @param string $tarball_path - * The path to a tarball to extract. - * @param string $directory - * The directory to extract to. - * - * @return string[] - * The list files extracted. - */ - protected function extractTarball($tarball_path, $directory) { - $archiver = new ArchiveTar($tarball_path, 'gz'); - $files = []; - $list = $archiver->listContent(); - if (is_array($list)) { - /** @var array $list */ - foreach ($list as $file) { - $files[] = $file['filename']; - } - } - $archiver->extractList($files, $directory); - return $files; - } - - /** - * Ensures that the sync and active configuration match. - * - * @return bool - * TRUE if sync and active configuration match, FALSE if not. - */ - protected function assertNoSynDifferences() { - $sync = $this->container->get('config.storage.sync'); - $active = $this->container->get('config.storage'); - // Ensure that we have no configuration changes to import. - $storage_comparer = new StorageComparer( - $sync, - $active, - $this->container->get('config.manager') - ); - $changelist = $storage_comparer->createChangelist()->getChangelist(); - // system.mail is changed by \Drupal\simpletest\InstallerTestBase::setUp() - // this is a good idea because it prevents tests emailling. - $key = array_search('system.mail', $changelist['update'], TRUE); - if ($key !== FALSE) { - unset($changelist['update'][$key]); - } - $return = $this->assertIdentical($changelist, $storage_comparer->getEmptyChangelist()); - // Output proper diffs. - $controller = ConfigController::create($this->container); - foreach ($changelist['update'] as $config_name) { - $diff = $controller->diff($config_name); - $this->verbose(\Drupal::service('renderer')->renderPlain($diff)); - } - return $return; - } - -} diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/english-second.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/english-second.tar.gz deleted file mode 100644 index e3e373a..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/english-second.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/minimal-fr.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/minimal-fr.tar.gz deleted file mode 100644 index 584ad5f..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/minimal-fr.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/minimal-validation-fail.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/minimal-validation-fail.tar.gz deleted file mode 100644 index 1f5bb62..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/minimal-validation-fail.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/minimal.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/minimal.tar.gz deleted file mode 100644 index 1b29c56..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/minimal.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/missing-language-entity.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/missing-language-entity.tar.gz deleted file mode 100644 index 201a337..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/missing-language-entity.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/no_dependencies_profile.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/no_dependencies_profile.tar.gz deleted file mode 100644 index 1fa5dde..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/no_dependencies_profile.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/standard-without-config.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/standard-without-config.tar.gz deleted file mode 100644 index 0792293..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/8.3/standard-without-config.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/broken.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/broken.tar.gz deleted file mode 100644 index 57f89ed..0000000 --- a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/broken.tar.gz +++ /dev/null @@ -1 +0,0 @@ -broken diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/english-second.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/english-second.tar.gz deleted file mode 100644 index 53106e9..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/english-second.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/minimal-fr.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/minimal-fr.tar.gz deleted file mode 100644 index 5d04141..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/minimal-fr.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/minimal-validation-fail.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/minimal-validation-fail.tar.gz deleted file mode 100644 index aca03c5..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/minimal-validation-fail.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/minimal.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/minimal.tar.gz deleted file mode 100644 index 8e4ae83..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/minimal.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/missing-language-entity.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/missing-language-entity.tar.gz deleted file mode 100644 index 6a8113d..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/missing-language-entity.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/no_dependencies_profile.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/no_dependencies_profile.tar.gz deleted file mode 100644 index 5df979c..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/no_dependencies_profile.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/standard-without-config.tar.gz b/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/standard-without-config.tar.gz deleted file mode 100644 index 3ca473c..0000000 Binary files a/backend-donations/web/profiles/config_installer/src/Tests/Fixtures/standard-without-config.tar.gz and /dev/null differ diff --git a/backend-donations/web/profiles/config_installer/src/Tests/UninstalledProfileModulesTest.php b/backend-donations/web/profiles/config_installer/src/Tests/UninstalledProfileModulesTest.php deleted file mode 100644 index 9b462b6..0000000 --- a/backend-donations/web/profiles/config_installer/src/Tests/UninstalledProfileModulesTest.php +++ /dev/null @@ -1,45 +0,0 @@ -drupalPostForm(NULL, ['files[import_tarball]' => $this->getTarball()], 'Save and continue'); - } - - /** - * {@inheritdoc} - */ - protected function getTarball() { - // Exported configuration after a minimal profile install. - return $this->versionTarball('standard-without-config.tar.gz'); - } - - /** - * Runs tests after install. - */ - public function testInstaller() { - $this->assertResponse(200); - // Ensure that all modules, profile and themes have been installed and have - // expected weights. - $sync = \Drupal::service('config.storage.sync'); - $sync_core_extension = $sync->read('core.extension'); - $this->assertIdentical($sync_core_extension, \Drupal::config('core.extension')->get()); - $this->assertFalse(\Drupal::moduleHandler()->moduleExists('contact'), 'Contact module is not installed.'); - } - -} diff --git a/backend-donations/web/sites/default/default.settings.php b/backend-donations/web/sites/default/default.settings.php index 0e7caa3..ae8e504 100644 --- a/backend-donations/web/sites/default/default.settings.php +++ b/backend-donations/web/sites/default/default.settings.php @@ -88,7 +88,9 @@ * ); * @endcode */ -$databases = array(); +$databases = array( + +); /** * Customizing database settings. @@ -251,7 +253,9 @@ * ); * @endcode */ -$config_directories = array(); +$config_directories = array( + +); /** * Settings: @@ -278,6 +282,7 @@ * service requires the install profile use the 'install_profile' container * parameter. Functional code can use \Drupal::installProfile(). */ + # $settings['install_profile'] = ''; /** @@ -307,6 +312,7 @@ * custom code that changes the container, changing this identifier will also * allow the container to be invalidated as soon as code is deployed. */ + # $settings['deployment_identifier'] = \Drupal::VERSION; /** @@ -338,8 +344,11 @@ * You can also define an array of host names that can be accessed directly, * bypassing the proxy, in $settings['http_client_config']['proxy']['no']. */ + # $settings['http_client_config']['proxy']['http'] = 'http://proxy_user:proxy_pass@example.com:8080'; + # $settings['http_client_config']['proxy']['https'] = 'http://proxy_user:proxy_pass@example.com:8080'; + # $settings['http_client_config']['proxy']['no'] = ['127.0.0.1', 'localhost']; /** @@ -373,42 +382,49 @@ * Be aware, however, that it is likely that this would allow IP * address spoofing unless more advanced precautions are taken. */ + # $settings['reverse_proxy'] = TRUE; /** * Specify every reverse proxy IP address in your environment. * This setting is required if $settings['reverse_proxy'] is TRUE. */ + # $settings['reverse_proxy_addresses'] = array('a.b.c.d', ...); /** * Set this value if your proxy server sends the client IP in a header * other than X-Forwarded-For. */ + # $settings['reverse_proxy_header'] = 'X_CLUSTER_CLIENT_IP'; /** * Set this value if your proxy server sends the client protocol in a header * other than X-Forwarded-Proto. */ + # $settings['reverse_proxy_proto_header'] = 'X_FORWARDED_PROTO'; /** * Set this value if your proxy server sends the client protocol in a header * other than X-Forwarded-Host. */ + # $settings['reverse_proxy_host_header'] = 'X_FORWARDED_HOST'; /** * Set this value if your proxy server sends the client protocol in a header * other than X-Forwarded-Port. */ + # $settings['reverse_proxy_port_header'] = 'X_FORWARDED_PORT'; /** * Set this value if your proxy server sends the client protocol in a header * other than Forwarded. */ + # $settings['reverse_proxy_forwarded_header'] = 'FORWARDED'; /** @@ -427,8 +443,8 @@ * HTTP proxy, and bypass the reverse proxy if one is used) in order to avoid * getting cached pages from the proxy. */ -# $settings['omit_vary_cookie'] = TRUE; +# $settings['omit_vary_cookie'] = TRUE; /** * Cache TTL for client error (4xx) responses. @@ -440,6 +456,7 @@ * of client error responses set the value to 0. Currently applies only to * page_cache module. */ + # $settings['cache_ttl_4xx'] = 3600; /** @@ -450,6 +467,7 @@ * * @see \Drupal\Core\Form\FormCache::setCache() */ + # $settings['form_cache_expiration'] = 21600; /** @@ -459,6 +477,7 @@ * performance reasons. Detection can be prevented by setting * class_loader_auto_detect to false, as in the example below. */ + # $settings['class_loader_auto_detect'] = FALSE; /* @@ -473,6 +492,7 @@ * example, to use Symfony's APC class loader without automatic detection, * uncomment the code below. */ + /* if ($settings['hash_salt']) { $prefix = 'drupal.' . hash('sha256', 'drupal.' . $settings['hash_salt']); @@ -506,6 +526,7 @@ * * Remove the leading hash signs to disable. */ + # $settings['allow_authorize_operations'] = FALSE; /** @@ -513,7 +534,9 @@ * * Value should be in PHP Octal Notation, with leading zero. */ + # $settings['file_chmod_directory'] = 0775; + # $settings['file_chmod_file'] = 0664; /** @@ -527,6 +550,7 @@ * security by serving user-uploaded files from a different domain or subdomain * pointing to the same server. Do not include a trailing slash. */ + # $settings['file_public_base_url'] = 'http://downloads.example.com/files'; /** @@ -536,6 +560,7 @@ * must exist and be writable by Drupal. This directory must be relative to * the Drupal installation directory and be accessible over the web. */ + # $settings['file_public_path'] = 'sites/default/files'; /** @@ -551,6 +576,7 @@ * See https://www.drupal.org/documentation/modules/file for more information * about securing private files. */ + # $settings['file_private_path'] = ''; /** @@ -559,6 +585,7 @@ * Set the minimum interval between each session write to database. * For performance reasons it defaults to 180. */ + # $settings['session_write_interval'] = 180; /** @@ -573,9 +600,13 @@ * The "en" part of the variable name, is dynamic and can be any langcode of * any added language. (eg locale_custom_strings_de for german). */ + # $settings['locale_custom_strings_en'][''] = array( + # 'forum' => 'Discussion board', + # '@count min' => '@count minutes', + # ); /** @@ -588,6 +619,7 @@ * * Note: This setting does not apply to installation and update pages. */ + # $settings['maintenance_theme'] = 'bartik'; /** @@ -610,7 +642,9 @@ * and increase the limits of these variables. For more information, see * http://php.net/manual/pcre.configuration.php. */ + # ini_set('pcre.backtrack_limit', 200000); + # ini_set('pcre.recursion_limit', 200000); /** @@ -630,6 +664,7 @@ * override in a services.yml file in the same directory as settings.php * (definitions in this file will override service definition defaults). */ + # $settings['bootstrap_config_storage'] = array('Drupal\Core\Config\BootstrapConfigStorageFactory', 'getFileStorage'); /** @@ -654,9 +689,13 @@ * configuration values in settings.php will not fire any of the configuration * change events. */ + # $config['system.file']['path']['temporary'] = '/tmp'; + # $config['system.site']['name'] = 'My Drupal site'; + # $config['system.theme']['default'] = 'stark'; + # $config['user.settings']['anonymous'] = 'Visitor'; /** @@ -682,8 +721,11 @@ * * Remove the leading hash signs if you would like to alter this functionality. */ + # $config['system.performance']['fast_404']['exclude_paths'] = '/\/(?:styles)|(?:system\/files)\//'; + # $config['system.performance']['fast_404']['paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'; + # $config['system.performance']['fast_404']['html'] = '404 Not Found

Not Found

The requested URL "@path" was not found on this server.

'; /** @@ -698,6 +740,7 @@ * tracking purposes, for testing a service container with an error condition or * to test a service container that throws an exception. */ + # $settings['container_base_class'] = '\Drupal\Core\DependencyInjection\Container'; /** @@ -707,6 +750,7 @@ * alternate implementation YAML parser. The class must implement the * \Drupal\Component\Serialization\SerializationInterface interface. */ + # $settings['yaml_parser_class'] = NULL; /** @@ -781,7 +825,11 @@ * * Keep this code block at the end of this file to take full effect. */ + # + # if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { + # include $app_root . '/' . $site_path . '/settings.local.php'; -# } + +# } \ No newline at end of file diff --git a/backend-donations/web/sites/development.services.yml b/backend-donations/web/sites/default/services.development.yml similarity index 100% rename from backend-donations/web/sites/development.services.yml rename to backend-donations/web/sites/default/services.development.yml diff --git a/backend-gifts/web/sites/services.yml b/backend-donations/web/sites/default/services.yml similarity index 100% rename from backend-gifts/web/sites/services.yml rename to backend-donations/web/sites/default/services.yml diff --git a/backend-donations/web/sites/default/settings.local.php b/backend-donations/web/sites/default/settings.local.php index 0d04a05..e97aaa7 100644 --- a/backend-donations/web/sites/default/settings.local.php +++ b/backend-donations/web/sites/default/settings.local.php @@ -7,23 +7,29 @@ assert_options(ASSERT_ACTIVE, TRUE); \Drupal\Component\Assertion\Handle::register(); +# Display all errors. +$config['system.logging']['error_level'] = 'verbose'; + // Set private files folder. $settings['file_private_path'] = preg_replace('~/web$~', '/private', $app_root); // Enable local development services. -$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml'; - -$settings['hash_salt'] = 'Qf7s6_7c-W3lpFljM8ZSfYuUbAH6Ha5ldqFpJ177TzGggpOzVk9DI0OIsy80T58WU9uGkfsRCA'; +$settings['container_yamls'][] = __DIR__ . '/services.development.yml'; // Configure base url for images going outside of the site. $config['rest_absolute_urls']['base_url'] = 'http://donations.api.flc.local'; $settings['file_public_base_url'] = 'http://donations.api.flc.local/sites/default/files'; -$databases['default']['default'] = array( - 'driver' => 'mysql', - 'host' => 'be_donations_mariadb', +// Make default hash salt for local envs. +$settings['hash_salt'] = 'insecure-local-hash'; + +$databases['default']['default'] = array ( + 'database' => 'drupal', 'username' => 'drupal', 'password' => 'drupal', - 'database' => 'drupal', 'prefix' => '', + 'host' => 'be_donations_mariadb', + 'port' => '3306', + 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', + 'driver' => 'mysql', ); diff --git a/backend-donations/web/sites/default/settings.php b/backend-donations/web/sites/default/settings.php index ac34550..77c95e3 100644 --- a/backend-donations/web/sites/default/settings.php +++ b/backend-donations/web/sites/default/settings.php @@ -4,7 +4,7 @@ $databases = []; $config_directories = []; $settings['update_free_access'] = FALSE; -$settings['container_yamls'][] = $app_root . '/services.yml'; +$settings['container_yamls'][] = __DIR__ . '/services.yml'; $settings['file_scan_ignore_directories'] = [ 'node_modules', 'bower_components', @@ -28,13 +28,6 @@ $settings['reverse_proxy'] = TRUE; $settings['reverse_proxy_addresses'] = [$_SERVER['REMOTE_ADDR']]; -// Error logging. -$config['system.logging']['error_level'] = 'verbose'; - -// Disable CSS and JS aggregation. -$config['system.performance']['css']['preprocess'] = FALSE; -$config['system.performance']['js']['preprocess'] = FALSE; - // Custom configs for sites based on Falcon. This folder is always empty // for Falcon repo. However, if you're basing your site on top of Falcon and // there are configs different from Falcon's, then you'll want to graylist @@ -42,6 +35,13 @@ $config['config_split.config_split.customizations']['status'] = TRUE; $config['config_split.config_split.development']['status'] = TRUE; +// Error logging. +$config['system.logging']['error_level'] = 'verbose'; + +// Disable CSS and JS aggregation. +$config['system.performance']['css']['preprocess'] = FALSE; +$config['system.performance']['js']['preprocess'] = FALSE; + // Enable test mode by default for all development environments, overridden for master in settings.platform.php. $config['falcon.settings']['test_mode_enabled'] = TRUE; diff --git a/backend-gifts/.gitignore b/backend-gifts/.gitignore index 12214b3..cd046a8 100644 --- a/backend-gifts/.gitignore +++ b/backend-gifts/.gitignore @@ -6,9 +6,6 @@ web/modules/contrib web/themes/contrib web/profiles/contrib -# Ignore mysql files. -mysql - # Ignore Drupal's file directory web/sites/*/files diff --git a/backend-gifts/composer.json b/backend-gifts/composer.json index 6293fd3..8b78c79 100644 --- a/backend-gifts/composer.json +++ b/backend-gifts/composer.json @@ -44,7 +44,7 @@ "drupal/field_group": "^1.0@RC", "drupal/config_ignore": "^2.1", "drupal/metatag": "^1.2", - "drupal/config_installer": "^1.5", + "drupal/config_installer": "^1.8", "drupal/default_content": "^1.0@alpha", "drupal/better_normalizers": "^1.0@beta", "drupal/config_filter": "^1.1", diff --git a/backend-gifts/composer.lock b/backend-gifts/composer.lock index c201200..fff9ef6 100644 --- a/backend-gifts/composer.lock +++ b/backend-gifts/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "73130d1affe2016d0a18220b80ddde84", + "content-hash": "3025ad2edaa56db2a86907cfed4eaad4", "packages": [ { "name": "alchemy/zippy", @@ -1415,17 +1415,17 @@ }, { "name": "drupal/config_installer", - "version": "1.5.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://git.drupal.org/project/config_installer", - "reference": "8.x-1.5" + "reference": "8.x-1.8" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.5.zip", - "reference": "8.x-1.5", - "shasum": "ef2ea56469481c482c1ee716438a24b4ad12c6e2" + "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.8.zip", + "reference": "8.x-1.8", + "shasum": "43d7af76a3f00d074161e242ddf94d942d256250" }, "require": { "drupal/core": "~8.0" @@ -1436,8 +1436,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.5", - "datestamp": "1506257944", + "version": "8.x-1.8", + "datestamp": "1524572284", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -1446,7 +1446,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { diff --git a/backend-gifts/tests/codeception/.gitignore b/backend-gifts/tests/codeception/.gitignore index 9a620c1..82e6fce 100644 --- a/backend-gifts/tests/codeception/.gitignore +++ b/backend-gifts/tests/codeception/.gitignore @@ -1 +1,4 @@ tests/_output + +# Files generated for test suite. +tests/_support/_generated diff --git a/backend-gifts/tests/codeception/README.md b/backend-gifts/tests/codeception/README.md deleted file mode 100644 index ea5c234..0000000 --- a/backend-gifts/tests/codeception/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Codeception Test Suites - - -## Prepare for local run and development - -1. Make sure all URLs inside of `codeception.yml` file are valid. They should be valid if you're using Falcon Docker. - -2. From inside of Docker php container, build test helper CodeCeption files: - -``` -docker-compose run be_gifts sh -cd tests/codeception/ -../../vendor/bin/codecept build -``` - -## Run Unit Tests - -**Important:** currently, unit tests require Drupal database to be configured to fully bootstrap Drupal codebase. See `unit/_bootstrap.php` for details. - -Unit tests run on local codebase. No URL needs to be specified. - -Run the whole unit test suite: - -``` -../../vendor/bin/codecept run unit --debug -``` - -Run shared tests (both regions): - -``` -../../vendor/bin/codecept run unit shared/ --debug -``` - -Run specific Cest: - -``` -../../vendor/bin/codecept run unit shared/ExampleCest.php --debug -``` - -## Run Acceptance Tests - -Acceptance tests run on specified WebDriver URL. - -Run all acceptance tests in PhantomJS (debug mode): - -``` -../../vendor/bin/codecept run acceptance --env=phantom --debug -``` - -Run region specific tests: - -``` -../../vendor/bin/codecept run acceptance ie/ --env=phantom --debug -``` - - -## Run API Tests - -API tests run on specified REST URL. - -Run all API tests in debug mode: - -``` -../../vendor/bin/codecept run api --debug -``` diff --git a/backend-gifts/tests/codeception/codeception.yml b/backend-gifts/tests/codeception/codeception.yml index 150e38e..57a2a30 100644 --- a/backend-gifts/tests/codeception/codeception.yml +++ b/backend-gifts/tests/codeception/codeception.yml @@ -1,33 +1,33 @@ actor: Tester paths: - tests: tests - log: tests/_output - data: tests/_data - support: tests/_support - envs: tests/_envs + tests: tests + log: tests/_output + data: tests/_data + support: tests/_support + envs: tests/_envs settings: - bootstrap: _bootstrap.php - colors: true - memory_limit: 1024M + bootstrap: _bootstrap.php + colors: true + memory_limit: 1024M extensions: - enabled: - - RunFailed - - CustomUrlsExtension - - PlatformExtension - #- Codeception\Extension\Recorder - config: - PlatformExtension: - http_user: falcon - http_pass: FALC0n$! + enabled: + - RunFailed + - CustomUrlsExtension + - PlatformExtension + #- Codeception\Extension\Recorder + config: + # TODO: Read from Circle's env. + PlatformExtension: + http_user: falcon + http_pass: FALC0n$! modules: - config: - WebDriver: - url: https://be_gifts_nginx - # TODO: place correct Docker URLs here. - frontend_url: https://fe_gifts - donations_url: https://be_donations_nginx - REST: - url: https://be_gifts_nginx - PhpBrowser: - url: https://be_gifts_nginx + config: + WebDriver: + url: http://gifts.api.flc.local + frontend_url: http://gifts.flc.local + donations_url: http://donations.api.flc.local + REST: + url: http://gifts.api.flc.local + PhpBrowser: + url: http://gifts.api.flc.local diff --git a/backend-gifts/tests/codeception/tests/_envs/chrome.yml b/backend-gifts/tests/codeception/tests/_envs/chrome.yml index 464bab1..f5c732a 100644 --- a/backend-gifts/tests/codeception/tests/_envs/chrome.yml +++ b/backend-gifts/tests/codeception/tests/_envs/chrome.yml @@ -1,6 +1,7 @@ -# `phantom` environment config goes here +# Configuration of chrome environment. modules: config: - WebDriver: - browser: 'chrome' - port: 9515 + WebDriver: + browser: chrome + host: chrome + port: 4444 diff --git a/backend-gifts/tests/codeception/tests/_envs/firefox.yml b/backend-gifts/tests/codeception/tests/_envs/firefox.yml deleted file mode 100644 index e4ae960..0000000 --- a/backend-gifts/tests/codeception/tests/_envs/firefox.yml +++ /dev/null @@ -1,6 +0,0 @@ -# `firefox` environment config goes here -modules: - config: - WebDriver: - browser: 'firefox' - port: 4444 diff --git a/backend-gifts/tests/codeception/tests/_envs/phantom-circle.yml b/backend-gifts/tests/codeception/tests/_envs/phantom-circle.yml deleted file mode 100644 index 992bc35..0000000 --- a/backend-gifts/tests/codeception/tests/_envs/phantom-circle.yml +++ /dev/null @@ -1,5 +0,0 @@ -# `phantom` environment for CircleCI. -modules: - config: - WebDriver: - browser: 'phantomjs' diff --git a/backend-gifts/tests/codeception/tests/_envs/phantom.yml b/backend-gifts/tests/codeception/tests/_envs/phantom.yml deleted file mode 100644 index 492d1de..0000000 --- a/backend-gifts/tests/codeception/tests/_envs/phantom.yml +++ /dev/null @@ -1,7 +0,0 @@ -# `phantom` environment config goes here -modules: - config: - WebDriver: - host: phantomjs - browser: 'phantomjs' - port: 8910 diff --git a/backend-gifts/tests/codeception/tests/_support/_generated/AcceptanceTesterActions.php b/backend-gifts/tests/codeception/tests/_support/_generated/AcceptanceTesterActions.php deleted file mode 100644 index 323f169..0000000 --- a/backend-gifts/tests/codeception/tests/_support/_generated/AcceptanceTesterActions.php +++ /dev/null @@ -1,2929 +0,0 @@ -getScenario()->runStep(new \Codeception\Step\Action('debugWebDriverLogs', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Changes the subdomain for the 'url' configuration parameter. - * Does not open a page; use `amOnPage` for that. - * - * ``` php - * amOnSubdomain('user'); - * $I->amOnPage('/'); - * // moves to http://user.mysite.com/ - * ?> - * ``` - * - * @param $subdomain - * - * @return mixed - * @see \Codeception\Module\WebDriver::amOnSubdomain() - */ - public function amOnSubdomain($subdomain) { - return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Takes a screenshot of the current window and saves it to `tests/_output/debug`. - * - * ``` php - * amOnPage('/user/edit'); - * $I->makeScreenshot('edit_page'); - * // saved to: tests/_output/debug/edit_page.png - * $I->makeScreenshot(); - * // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.png - * ``` - * - * @param $name - * @see \Codeception\Module\WebDriver::makeScreenshot() - */ - public function makeScreenshot($name = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('makeScreenshot', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Resize the current window. - * - * ``` php - * resizeWindow(800, 600); - * - * ``` - * - * @param int $width - * @param int $height - * @see \Codeception\Module\WebDriver::resizeWindow() - */ - public function resizeWindow($width, $height) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('resizeWindow', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that a cookie with the given name is set. - * You can set additional cookie params like `domain`, `path` as array passed in last argument. - * - * ``` php - * seeCookie('PHPSESSID'); - * ?> - * ``` - * - * @param $cookie - * @param array $params - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeCookie() - */ - public function canSeeCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that a cookie with the given name is set. - * You can set additional cookie params like `domain`, `path` as array passed in last argument. - * - * ``` php - * seeCookie('PHPSESSID'); - * ?> - * ``` - * - * @param $cookie - * @param array $params - * @return mixed - * @see \Codeception\Module\WebDriver::seeCookie() - */ - public function seeCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there isn't a cookie with the given name. - * You can set additional cookie params like `domain`, `path` as array passed in last argument. - * - * @param $cookie - * - * @param array $params - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeCookie() - */ - public function cantSeeCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there isn't a cookie with the given name. - * You can set additional cookie params like `domain`, `path` as array passed in last argument. - * - * @param $cookie - * - * @param array $params - * @return mixed - * @see \Codeception\Module\WebDriver::dontSeeCookie() - */ - public function dontSeeCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Sets a cookie with the given name and value. - * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. - * - * ``` php - * setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); - * ?> - * ``` - * - * @param $name - * @param $val - * @param array $params - * - * @return mixed - * @see \Codeception\Module\WebDriver::setCookie() - */ - public function setCookie($cookie, $value, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Unsets cookie with the given name. - * You can set additional cookie params like `domain`, `path` in array passed as last argument. - * - * @param $cookie - * - * @param array $params - * @return mixed - * @see \Codeception\Module\WebDriver::resetCookie() - */ - public function resetCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Grabs a cookie value. - * You can set additional cookie params like `domain`, `path` in array passed as last argument. - * - * @param $cookie - * - * @param array $params - * @return mixed - * @see \Codeception\Module\WebDriver::grabCookie() - */ - public function grabCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Grabs current page source code. - * - * @throws ModuleException if no page was opened. - * - * @return string Current page source code. - * @see \Codeception\Module\WebDriver::grabPageSource() - */ - public function grabPageSource() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabPageSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Open web page at the given absolute URL and sets its hostname as the base host. - * - * ``` php - * amOnUrl('http://codeception.com'); - * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart - * ?> - * ``` - * @see \Codeception\Module\WebDriver::amOnUrl() - */ - public function amOnUrl($url) { - return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Opens the page for the given relative URI. - * - * ``` php - * amOnPage('/'); - * // opens /register page - * $I->amOnPage('/register'); - * ``` - * - * @param string $page - * @see \Codeception\Module\WebDriver::amOnPage() - */ - public function amOnPage($page) { - return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string (case insensitive). - * - * You can specify a specific HTML element (via CSS or XPath) as the second - * parameter to only search within that element. - * - * ``` php - * see('Logout'); // I can suppose user is logged in - * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page - * $I->see('Sign Up', '//body/h1'); // with XPath - * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator - * ``` - * - * Note that the search is done after stripping all HTML tags from the body, - * so `$I->see('strong')` will return true for strings like: - * - * - `

I am Stronger than thou

` - * - `` - * - * But will *not* be true for strings like: - * - * - `Home` - * - `
Home` - * - `` - * - * For checking the raw source code, use `seeInSource()`. - * - * @param string $text - * @param string $selector optional - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::see() - */ - public function canSee($text, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string (case insensitive). - * - * You can specify a specific HTML element (via CSS or XPath) as the second - * parameter to only search within that element. - * - * ``` php - * see('Logout'); // I can suppose user is logged in - * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page - * $I->see('Sign Up', '//body/h1'); // with XPath - * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator - * ``` - * - * Note that the search is done after stripping all HTML tags from the body, - * so `$I->see('strong')` will return true for strings like: - * - * - `

I am Stronger than thou

` - * - `` - * - * But will *not* be true for strings like: - * - * - `Home` - * - `
Home` - * - `` - * - * For checking the raw source code, use `seeInSource()`. - * - * @param string $text - * @param string $selector optional - * @see \Codeception\Module\WebDriver::see() - */ - public function see($text, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page doesn't contain the text specified (case insensitive). - * Give a locator as the second parameter to match a specific region. - * - * ```php - * dontSee('Login'); // I can suppose user is already logged in - * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page - * $I->dontSee('Sign Up','//body/h1'); // with XPath - * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator - * ``` - * - * Note that the search is done after stripping all HTML tags from the body, - * so `$I->dontSee('strong')` will fail on strings like: - * - * - `

I am Stronger than thou

` - * - `` - * - * But will ignore strings like: - * - * - `Home` - * - `
Home` - * - `` - * - * For checking the raw source code, use `seeInSource()`. - * - * @param string $text - * @param string $selector optional - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSee() - */ - public function cantSee($text, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page doesn't contain the text specified (case insensitive). - * Give a locator as the second parameter to match a specific region. - * - * ```php - * dontSee('Login'); // I can suppose user is already logged in - * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page - * $I->dontSee('Sign Up','//body/h1'); // with XPath - * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator - * ``` - * - * Note that the search is done after stripping all HTML tags from the body, - * so `$I->dontSee('strong')` will fail on strings like: - * - * - `

I am Stronger than thou

` - * - `` - * - * But will ignore strings like: - * - * - `Home` - * - `
Home` - * - `` - * - * For checking the raw source code, use `seeInSource()`. - * - * @param string $text - * @param string $selector optional - * @see \Codeception\Module\WebDriver::dontSee() - */ - public function dontSee($text, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string in its - * raw source code. - * - * ``` php - * seeInSource('

Green eggs & ham

'); - * ``` - * - * @param $raw - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInSource() - */ - public function canSeeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string in its - * raw source code. - * - * ``` php - * seeInSource('

Green eggs & ham

'); - * ``` - * - * @param $raw - * @see \Codeception\Module\WebDriver::seeInSource() - */ - public function seeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string in its - * raw source code. - * - * ```php - * dontSeeInSource('

Green eggs & ham

'); - * ``` - * - * @param $raw - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInSource() - */ - public function cantSeeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string in its - * raw source code. - * - * ```php - * dontSeeInSource('

Green eggs & ham

'); - * ``` - * - * @param $raw - * @see \Codeception\Module\WebDriver::dontSeeInSource() - */ - public function dontSeeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page source contains the given string. - * - * ```php - * seeInPageSource('getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPageSource', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page source contains the given string. - * - * ```php - * seeInPageSource('getScenario()->runStep(new \Codeception\Step\Assertion('seeInPageSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page source doesn't contain the given string. - * - * @param $text - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInPageSource() - */ - public function cantSeeInPageSource($text) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInPageSource', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page source doesn't contain the given string. - * - * @param $text - * @see \Codeception\Module\WebDriver::dontSeeInPageSource() - */ - public function dontSeeInPageSource($text) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInPageSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Perform a click on a link or a button, given by a locator. - * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. - * For buttons, the "value" attribute, "name" attribute, and inner text are searched. - * For links, the link text is searched. - * For images, the "alt" attribute and inner text of any parent links are searched. - * - * The second parameter is a context (CSS or XPath locator) to narrow the search. - * - * Note that if the locator matches a button of type `submit`, the form will be submitted. - * - * ``` php - * click('Logout'); - * // button of form - * $I->click('Submit'); - * // CSS button - * $I->click('#form input[type=submit]'); - * // XPath - * $I->click('//form/*[@type=submit]'); - * // link in context - * $I->click('Logout', '#nav'); - * // using strict locator - * $I->click(['link' => 'Login']); - * ?> - * ``` - * - * @param $link - * @param $context - * @see \Codeception\Module\WebDriver::click() - */ - public function click($link, $context = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there's a link with the specified text. - * Give a full URL as the second parameter to match links with that exact URL. - * - * ``` php - * seeLink('Logout'); // matches Logout - * $I->seeLink('Logout','/logout'); // matches Logout - * ?> - * ``` - * - * @param string $text - * @param string $url optional - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeLink() - */ - public function canSeeLink($text, $url = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there's a link with the specified text. - * Give a full URL as the second parameter to match links with that exact URL. - * - * ``` php - * seeLink('Logout'); // matches Logout - * $I->seeLink('Logout','/logout'); // matches Logout - * ?> - * ``` - * - * @param string $text - * @param string $url optional - * @see \Codeception\Module\WebDriver::seeLink() - */ - public function seeLink($text, $url = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page doesn't contain a link with the given string. - * If the second parameter is given, only links with a matching "href" attribute will be checked. - * - * ``` php - * dontSeeLink('Logout'); // I suppose user is not logged in - * $I->dontSeeLink('Checkout now', '/store/cart.php'); - * ?> - * ``` - * - * @param string $text - * @param string $url optional - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeLink() - */ - public function cantSeeLink($text, $url = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page doesn't contain a link with the given string. - * If the second parameter is given, only links with a matching "href" attribute will be checked. - * - * ``` php - * dontSeeLink('Logout'); // I suppose user is not logged in - * $I->dontSeeLink('Checkout now', '/store/cart.php'); - * ?> - * ``` - * - * @param string $text - * @param string $url optional - * @see \Codeception\Module\WebDriver::dontSeeLink() - */ - public function dontSeeLink($text, $url = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that current URI contains the given string. - * - * ``` php - * seeInCurrentUrl('home'); - * // to match: /users/1 - * $I->seeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInCurrentUrl() - */ - public function canSeeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that current URI contains the given string. - * - * ``` php - * seeInCurrentUrl('home'); - * // to match: /users/1 - * $I->seeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::seeInCurrentUrl() - */ - public function seeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL is equal to the given string. - * Unlike `seeInCurrentUrl`, this only matches the full URL. - * - * ``` php - * seeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() - */ - public function canSeeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL is equal to the given string. - * Unlike `seeInCurrentUrl`, this only matches the full URL. - * - * ``` php - * seeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() - */ - public function seeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL matches the given regular expression. - * - * ``` php - * seeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() - */ - public function canSeeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL matches the given regular expression. - * - * ``` php - * seeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() - */ - public function seeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URI doesn't contain the given string. - * - * ``` php - * dontSeeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() - */ - public function cantSeeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URI doesn't contain the given string. - * - * ``` php - * dontSeeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() - */ - public function dontSeeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL doesn't equal the given string. - * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. - * - * ``` php - * dontSeeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() - */ - public function cantSeeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL doesn't equal the given string. - * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. - * - * ``` php - * dontSeeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() - */ - public function dontSeeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that current url doesn't match the given regular expression. - * - * ``` php - * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() - */ - public function cantSeeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that current url doesn't match the given regular expression. - * - * ``` php - * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() - */ - public function dontSeeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Executes the given regular expression against the current URI and returns the first capturing group. - * If no parameters are provided, the full URI is returned. - * - * ``` php - * grabFromCurrentUrl('~$/user/(\d+)/~'); - * $uri = $I->grabFromCurrentUrl(); - * ?> - * ``` - * - * @param string $uri optional - * - * @return mixed - * @see \Codeception\Module\WebDriver::grabFromCurrentUrl() - */ - public function grabFromCurrentUrl($uri = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the specified checkbox is checked. - * - * ``` php - * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms - * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. - * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); - * ?> - * ``` - * - * @param $checkbox - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() - */ - public function canSeeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the specified checkbox is checked. - * - * ``` php - * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms - * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. - * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); - * ?> - * ``` - * - * @param $checkbox - * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() - */ - public function seeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Check that the specified checkbox is unchecked. - * - * ``` php - * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms - * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. - * ?> - * ``` - * - * @param $checkbox - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() - */ - public function cantSeeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Check that the specified checkbox is unchecked. - * - * ``` php - * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms - * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. - * ?> - * ``` - * - * @param $checkbox - * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() - */ - public function dontSeeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. - * Fields are matched by label text, the "name" attribute, CSS, or XPath. - * - * ``` php - * seeInField('Body','Type your comment here'); - * $I->seeInField('form textarea[name=body]','Type your comment here'); - * $I->seeInField('form input[type=hidden]','hidden_value'); - * $I->seeInField('#searchform input','Search'); - * $I->seeInField('//form/*[@name=search]','Search'); - * $I->seeInField(['name' => 'search'], 'Search'); - * ?> - * ``` - * - * @param $field - * @param $value - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInField() - */ - public function canSeeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. - * Fields are matched by label text, the "name" attribute, CSS, or XPath. - * - * ``` php - * seeInField('Body','Type your comment here'); - * $I->seeInField('form textarea[name=body]','Type your comment here'); - * $I->seeInField('form input[type=hidden]','hidden_value'); - * $I->seeInField('#searchform input','Search'); - * $I->seeInField('//form/*[@name=search]','Search'); - * $I->seeInField(['name' => 'search'], 'Search'); - * ?> - * ``` - * - * @param $field - * @param $value - * @see \Codeception\Module\WebDriver::seeInField() - */ - public function seeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that an input field or textarea doesn't contain the given value. - * For fuzzy locators, the field is matched by label text, CSS and XPath. - * - * ``` php - * dontSeeInField('Body','Type your comment here'); - * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); - * $I->dontSeeInField('form input[type=hidden]','hidden_value'); - * $I->dontSeeInField('#searchform input','Search'); - * $I->dontSeeInField('//form/*[@name=search]','Search'); - * $I->dontSeeInField(['name' => 'search'], 'Search'); - * ?> - * ``` - * - * @param $field - * @param $value - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInField() - */ - public function cantSeeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that an input field or textarea doesn't contain the given value. - * For fuzzy locators, the field is matched by label text, CSS and XPath. - * - * ``` php - * dontSeeInField('Body','Type your comment here'); - * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); - * $I->dontSeeInField('form input[type=hidden]','hidden_value'); - * $I->dontSeeInField('#searchform input','Search'); - * $I->dontSeeInField('//form/*[@name=search]','Search'); - * $I->dontSeeInField(['name' => 'search'], 'Search'); - * ?> - * ``` - * - * @param $field - * @param $value - * @see \Codeception\Module\WebDriver::dontSeeInField() - */ - public function dontSeeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks if the array of form parameters (name => value) are set on the form matched with the - * passed selector. - * - * ``` php - * seeInFormFields('form[name=myform]', [ - * 'input1' => 'value', - * 'input2' => 'other value', - * ]); - * ?> - * ``` - * - * For multi-select elements, or to check values of multiple elements with the same name, an - * array may be passed: - * - * ``` php - * seeInFormFields('.form-class', [ - * 'multiselect' => [ - * 'value1', - * 'value2', - * ], - * 'checkbox[]' => [ - * 'a checked value', - * 'another checked value', - * ], - * ]); - * ?> - * ``` - * - * Additionally, checkbox values can be checked with a boolean. - * - * ``` php - * seeInFormFields('#form-id', [ - * 'checkbox1' => true, // passes if checked - * 'checkbox2' => false, // passes if unchecked - * ]); - * ?> - * ``` - * - * Pair this with submitForm for quick testing magic. - * - * ``` php - * 'value', - * 'field2' => 'another value', - * 'checkbox1' => true, - * // ... - * ]; - * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); - * // $I->amOnPage('/path/to/form-page') may be needed - * $I->seeInFormFields('//form[@id=my-form]', $form); - * ?> - * ``` - * - * @param $formSelector - * @param $params - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInFormFields() - */ - public function canSeeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks if the array of form parameters (name => value) are set on the form matched with the - * passed selector. - * - * ``` php - * seeInFormFields('form[name=myform]', [ - * 'input1' => 'value', - * 'input2' => 'other value', - * ]); - * ?> - * ``` - * - * For multi-select elements, or to check values of multiple elements with the same name, an - * array may be passed: - * - * ``` php - * seeInFormFields('.form-class', [ - * 'multiselect' => [ - * 'value1', - * 'value2', - * ], - * 'checkbox[]' => [ - * 'a checked value', - * 'another checked value', - * ], - * ]); - * ?> - * ``` - * - * Additionally, checkbox values can be checked with a boolean. - * - * ``` php - * seeInFormFields('#form-id', [ - * 'checkbox1' => true, // passes if checked - * 'checkbox2' => false, // passes if unchecked - * ]); - * ?> - * ``` - * - * Pair this with submitForm for quick testing magic. - * - * ``` php - * 'value', - * 'field2' => 'another value', - * 'checkbox1' => true, - * // ... - * ]; - * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); - * // $I->amOnPage('/path/to/form-page') may be needed - * $I->seeInFormFields('//form[@id=my-form]', $form); - * ?> - * ``` - * - * @param $formSelector - * @param $params - * @see \Codeception\Module\WebDriver::seeInFormFields() - */ - public function seeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks if the array of form parameters (name => value) are not set on the form matched with - * the passed selector. - * - * ``` php - * dontSeeInFormFields('form[name=myform]', [ - * 'input1' => 'non-existent value', - * 'input2' => 'other non-existent value', - * ]); - * ?> - * ``` - * - * To check that an element hasn't been assigned any one of many values, an array can be passed - * as the value: - * - * ``` php - * dontSeeInFormFields('.form-class', [ - * 'fieldName' => [ - * 'This value shouldn\'t be set', - * 'And this value shouldn\'t be set', - * ], - * ]); - * ?> - * ``` - * - * Additionally, checkbox values can be checked with a boolean. - * - * ``` php - * dontSeeInFormFields('#form-id', [ - * 'checkbox1' => true, // fails if checked - * 'checkbox2' => false, // fails if unchecked - * ]); - * ?> - * ``` - * - * @param $formSelector - * @param $params - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInFormFields() - */ - public function cantSeeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks if the array of form parameters (name => value) are not set on the form matched with - * the passed selector. - * - * ``` php - * dontSeeInFormFields('form[name=myform]', [ - * 'input1' => 'non-existent value', - * 'input2' => 'other non-existent value', - * ]); - * ?> - * ``` - * - * To check that an element hasn't been assigned any one of many values, an array can be passed - * as the value: - * - * ``` php - * dontSeeInFormFields('.form-class', [ - * 'fieldName' => [ - * 'This value shouldn\'t be set', - * 'And this value shouldn\'t be set', - * ], - * ]); - * ?> - * ``` - * - * Additionally, checkbox values can be checked with a boolean. - * - * ``` php - * dontSeeInFormFields('#form-id', [ - * 'checkbox1' => true, // fails if checked - * 'checkbox2' => false, // fails if unchecked - * ]); - * ?> - * ``` - * - * @param $formSelector - * @param $params - * @see \Codeception\Module\WebDriver::dontSeeInFormFields() - */ - public function dontSeeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Selects an option in a select tag or in radio button group. - * - * ``` php - * selectOption('form select[name=account]', 'Premium'); - * $I->selectOption('form input[name=payment]', 'Monthly'); - * $I->selectOption('//form/select[@name=account]', 'Monthly'); - * ?> - * ``` - * - * Provide an array for the second argument to select multiple options: - * - * ``` php - * selectOption('Which OS do you use?', array('Windows','Linux')); - * ?> - * ``` - * - * Or provide an associative array for the second argument to specifically define which selection method should be used: - * - * ``` php - * selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows' - * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' - * ?> - * ``` - * - * @param $select - * @param $option - * @see \Codeception\Module\WebDriver::selectOption() - */ - public function selectOption($select, $option) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Unselect an option in the given select box. - * - * @param $select - * @param $option - * @see \Codeception\Module\WebDriver::unselectOption() - */ - public function unselectOption($select, $option) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('unselectOption', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. - * - * ``` php - * checkOption('#agree'); - * ?> - * ``` - * - * @param $option - * @see \Codeception\Module\WebDriver::checkOption() - */ - public function checkOption($option) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Unticks a checkbox. - * - * ``` php - * uncheckOption('#notify'); - * ?> - * ``` - * - * @param $option - * @see \Codeception\Module\WebDriver::uncheckOption() - */ - public function uncheckOption($option) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Fills a text field or textarea with the given string. - * - * ``` php - * fillField("//input[@type='text']", "Hello World!"); - * $I->fillField(['name' => 'email'], 'jon@mail.com'); - * ?> - * ``` - * - * @param $field - * @param $value - * @see \Codeception\Module\WebDriver::fillField() - */ - public function fillField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Attaches a file relative to the Codeception `_data` directory to the given file upload field. - * - * ``` php - * attachFile('input[@type="file"]', 'prices.xls'); - * ?> - * ``` - * - * @param $field - * @param $filename - * @see \Codeception\Module\WebDriver::attachFile() - */ - public function attachFile($field, $filename) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Finds and returns the text contents of the given element. - * If a fuzzy locator is used, the element is found using CSS, XPath, - * and by matching the full page source by regular expression. - * - * ``` php - * grabTextFrom('h1'); - * $heading = $I->grabTextFrom('descendant-or-self::h1'); - * $value = $I->grabTextFrom('~ - * ``` - * - * @param $cssOrXPathOrRegex - * - * @return mixed - * @see \Codeception\Module\WebDriver::grabTextFrom() - */ - public function grabTextFrom($cssOrXPathOrRegex) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Grabs the value of the given attribute value from the given element. - * Fails if element is not found. - * - * ``` php - * grabAttributeFrom('#tooltip', 'title'); - * ?> - * ``` - * - * - * @param $cssOrXpath - * @param $attribute - * - * @return mixed - * @see \Codeception\Module\WebDriver::grabAttributeFrom() - */ - public function grabAttributeFrom($cssOrXpath, $attribute) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Finds the value for the given form field. - * If a fuzzy locator is used, the field is found by field name, CSS, and XPath. - * - * ``` php - * grabValueFrom('Name'); - * $name = $I->grabValueFrom('input[name=username]'); - * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']'); - * $name = $I->grabValueFrom(['name' => 'username']); - * ?> - * ``` - * - * @param $field - * - * @return mixed - * @see \Codeception\Module\WebDriver::grabValueFrom() - */ - public function grabValueFrom($field) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Grabs either the text content, or attribute values, of nodes - * matched by $cssOrXpath and returns them as an array. - * - * ```html - * First - * Second - * Third - * ``` - * - * ```php - * grabMultiple('a'); - * - * // would return ['#first', '#second', '#third'] - * $aLinks = $I->grabMultiple('a', 'href'); - * ?> - * ``` - * - * @param $cssOrXpath - * @param $attribute - * @return string[] - * @see \Codeception\Module\WebDriver::grabMultiple() - */ - public function grabMultiple($cssOrXpath, $attribute = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element exists on the page and is visible. - * You can also specify expected attributes of this element. - * - * ``` php - * seeElement('.error'); - * $I->seeElement('//form/input[1]'); - * $I->seeElement('input', ['name' => 'login']); - * $I->seeElement('input', ['value' => '123456']); - * - * // strict locator in first arg, attributes in second - * $I->seeElement(['css' => 'form input'], ['name' => 'login']); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * @return - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeElement() - */ - public function canSeeElement($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element exists on the page and is visible. - * You can also specify expected attributes of this element. - * - * ``` php - * seeElement('.error'); - * $I->seeElement('//form/input[1]'); - * $I->seeElement('input', ['name' => 'login']); - * $I->seeElement('input', ['value' => '123456']); - * - * // strict locator in first arg, attributes in second - * $I->seeElement(['css' => 'form input'], ['name' => 'login']); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * @return - * @see \Codeception\Module\WebDriver::seeElement() - */ - public function seeElement($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element is invisible or not present on the page. - * You can also specify expected attributes of this element. - * - * ``` php - * dontSeeElement('.error'); - * $I->dontSeeElement('//form/input[1]'); - * $I->dontSeeElement('input', ['name' => 'login']); - * $I->dontSeeElement('input', ['value' => '123456']); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeElement() - */ - public function cantSeeElement($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element is invisible or not present on the page. - * You can also specify expected attributes of this element. - * - * ``` php - * dontSeeElement('.error'); - * $I->dontSeeElement('//form/input[1]'); - * $I->dontSeeElement('input', ['name' => 'login']); - * $I->dontSeeElement('input', ['value' => '123456']); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * @see \Codeception\Module\WebDriver::dontSeeElement() - */ - public function dontSeeElement($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element exists on the page, even it is invisible. - * - * ``` php - * seeElementInDOM('//form/input[type=hidden]'); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeElementInDOM() - */ - public function canSeeElementInDOM($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElementInDOM', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element exists on the page, even it is invisible. - * - * ``` php - * seeElementInDOM('//form/input[type=hidden]'); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * @see \Codeception\Module\WebDriver::seeElementInDOM() - */ - public function seeElementInDOM($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElementInDOM', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Opposite of `seeElementInDOM`. - * - * @param $selector - * @param array $attributes - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() - */ - public function cantSeeElementInDOM($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElementInDOM', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Opposite of `seeElementInDOM`. - * - * @param $selector - * @param array $attributes - * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() - */ - public function dontSeeElementInDOM($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElementInDOM', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there are a certain number of elements matched by the given locator on the page. - * - * ``` php - * seeNumberOfElements('tr', 10); - * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements - * ?> - * ``` - * @param $selector - * @param mixed $expected int or int[] - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeNumberOfElements() - */ - public function canSeeNumberOfElements($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there are a certain number of elements matched by the given locator on the page. - * - * ``` php - * seeNumberOfElements('tr', 10); - * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements - * ?> - * ``` - * @param $selector - * @param mixed $expected int or int[] - * @see \Codeception\Module\WebDriver::seeNumberOfElements() - */ - public function seeNumberOfElements($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() - */ - public function canSeeNumberOfElementsInDOM($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElementsInDOM', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * - * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() - */ - public function seeNumberOfElementsInDOM($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElementsInDOM', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given option is selected. - * - * ``` php - * seeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeOptionIsSelected() - */ - public function canSeeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given option is selected. - * - * ``` php - * seeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * - * @return mixed - * @see \Codeception\Module\WebDriver::seeOptionIsSelected() - */ - public function seeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given option is not selected. - * - * ``` php - * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() - */ - public function cantSeeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given option is not selected. - * - * ``` php - * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * - * @return mixed - * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() - */ - public function dontSeeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page title contains the given string. - * - * ``` php - * seeInTitle('Blog - Post #1'); - * ?> - * ``` - * - * @param $title - * - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInTitle() - */ - public function canSeeInTitle($title) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page title contains the given string. - * - * ``` php - * seeInTitle('Blog - Post #1'); - * ?> - * ``` - * - * @param $title - * - * @return mixed - * @see \Codeception\Module\WebDriver::seeInTitle() - */ - public function seeInTitle($title) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page title does not contain the given string. - * - * @param $title - * - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInTitle() - */ - public function cantSeeInTitle($title) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page title does not contain the given string. - * - * @param $title - * - * @return mixed - * @see \Codeception\Module\WebDriver::dontSeeInTitle() - */ - public function dontSeeInTitle($title) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`. - * Don't confuse popups with modal windows, - * as created by [various libraries](http://jster.net/category/windows-modals-popups). - * @see \Codeception\Module\WebDriver::acceptPopup() - */ - public function acceptPopup() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('acceptPopup', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Dismisses the active JavaScript popup, as created by `window.alert`, `window.confirm`, or `window.prompt`. - * @see \Codeception\Module\WebDriver::cancelPopup() - */ - public function cancelPopup() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('cancelPopup', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the active JavaScript popup, - * as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. - * - * @param $text - * - * @throws \Codeception\Exception\ModuleException - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInPopup() - */ - public function canSeeInPopup($text) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPopup', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the active JavaScript popup, - * as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. - * - * @param $text - * - * @throws \Codeception\Exception\ModuleException - * @see \Codeception\Module\WebDriver::seeInPopup() - */ - public function seeInPopup($text) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInPopup', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Enters text into a native JavaScript prompt popup, as created by `window.prompt`. - * - * @param $keys - * - * @throws \Codeception\Exception\ModuleException - * @see \Codeception\Module\WebDriver::typeInPopup() - */ - public function typeInPopup($keys) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('typeInPopup', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Reloads the current page. - * @see \Codeception\Module\WebDriver::reloadPage() - */ - public function reloadPage() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('reloadPage', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Moves back in history. - * @see \Codeception\Module\WebDriver::moveBack() - */ - public function moveBack() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Moves forward in history. - * @see \Codeception\Module\WebDriver::moveForward() - */ - public function moveForward() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('moveForward', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Submits the given form on the page, optionally with the given form - * values. Give the form fields values as an array. Note that hidden fields - * can't be accessed. - * - * Skipped fields will be filled by their values from the page. - * You don't need to click the 'Submit' button afterwards. - * This command itself triggers the request to form's action. - * - * You can optionally specify what button's value to include - * in the request with the last parameter as an alternative to - * explicitly setting its value in the second parameter, as - * button values are not otherwise included in the request. - * - * Examples: - * - * ``` php - * submitForm('#login', [ - * 'login' => 'davert', - * 'password' => '123456' - * ]); - * // or - * $I->submitForm('#login', [ - * 'login' => 'davert', - * 'password' => '123456' - * ], 'submitButtonName'); - * - * ``` - * - * For example, given this sample "Sign Up" form: - * - * ``` html - *
- * Login: - *
- * Password: - *
- * Do you agree to our terms? - *
- * Select pricing plan: - * - * - *
- * ``` - * - * You could write the following to submit it: - * - * ``` php - * submitForm( - * '#userForm', - * [ - * 'user[login]' => 'Davert', - * 'user[password]' => '123456', - * 'user[agree]' => true - * ], - * 'submitButton' - * ); - * ``` - * Note that "2" will be the submitted value for the "plan" field, as it is - * the selected option. - * - * Also note that this differs from PhpBrowser, in that - * ```'user' => [ 'login' => 'Davert' ]``` is not supported at the moment. - * Named array keys *must* be included in the name as above. - * - * Pair this with seeInFormFields for quick testing magic. - * - * ``` php - * 'value', - * 'field2' => 'another value', - * 'checkbox1' => true, - * // ... - * ]; - * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); - * // $I->amOnPage('/path/to/form-page') may be needed - * $I->seeInFormFields('//form[@id=my-form]', $form); - * ?> - * ``` - * - * Parameter values must be set to arrays for multiple input fields - * of the same name, or multi-select combo boxes. For checkboxes, - * either the string value can be used, or boolean values which will - * be replaced by the checkbox's value in the DOM. - * - * ``` php - * submitForm('#my-form', [ - * 'field1' => 'value', - * 'checkbox' => [ - * 'value of first checkbox', - * 'value of second checkbox, - * ], - * 'otherCheckboxes' => [ - * true, - * false, - * false - * ], - * 'multiselect' => [ - * 'first option value', - * 'second option value' - * ] - * ]); - * ?> - * ``` - * - * Mixing string and boolean values for a checkbox's value is not supported - * and may produce unexpected results. - * - * Field names ending in "[]" must be passed without the trailing square - * bracket characters, and must contain an array for its value. This allows - * submitting multiple values with the same name, consider: - * - * ```php - * $I->submitForm('#my-form', [ - * 'field[]' => 'value', - * 'field[]' => 'another value', // 'field[]' is already a defined key - * ]); - * ``` - * - * The solution is to pass an array value: - * - * ```php - * // this way both values are submitted - * $I->submitForm('#my-form', [ - * 'field' => [ - * 'value', - * 'another value', - * ] - * ]); - * ``` - * - * The `$button` parameter can be either a string, an array or an instance - * of Facebook\WebDriver\WebDriverBy. When it is a string, the - * button will be found by its "name" attribute. If $button is an - * array then it will be treated as a strict selector and a WebDriverBy - * will be used verbatim. - * - * For example, given the following HTML: - * - * ``` html - * - * ``` - * - * `$button` could be any one of the following: - * - 'submitButton' - * - ['name' => 'submitButton'] - * - WebDriverBy::name('submitButton') - * - * @param $selector - * @param $params - * @param $button - * @see \Codeception\Module\WebDriver::submitForm() - */ - public function submitForm($selector, $params, $button = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for the given element to change. - * Element "change" is determined by a callback function which is called repeatedly - * until the return value evaluates to true. - * - * ``` php - * waitForElementChange('#menu', function(WebDriverElement $el) { - * return $el->isDisplayed(); - * }, 100); - * ?> - * ``` - * - * @param $element - * @param \Closure $callback - * @param int $timeout seconds - * @throws \Codeception\Exception\ElementNotFound - * @see \Codeception\Module\WebDriver::waitForElementChange() - */ - public function waitForElementChange($element, $callback, $timeout = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementChange', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for an element to appear on the page. - * If the element doesn't appear, a timeout exception is thrown. - * - * ``` php - * waitForElement('#agree_button', 30); // secs - * $I->click('#agree_button'); - * ?> - * ``` - * - * @param $element - * @param int $timeout seconds - * @throws \Exception - * @see \Codeception\Module\WebDriver::waitForElement() - */ - public function waitForElement($element, $timeout = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElement', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for the given element to be visible on the page. - * If element doesn't appear, a timeout exception is thrown. - * - * ``` php - * waitForElementVisible('#agree_button', 30); // secs - * $I->click('#agree_button'); - * ?> - * ``` - * - * @param $element - * @param int $timeout seconds - * @throws \Exception - * @see \Codeception\Module\WebDriver::waitForElementVisible() - */ - public function waitForElementVisible($element, $timeout = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementVisible', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for the given element to become invisible. - * If element stays visible, a timeout exception is thrown. - * - * ``` php - * waitForElementNotVisible('#agree_button', 30); // secs - * ?> - * ``` - * - * @param $element - * @param int $timeout seconds - * @throws \Exception - * @see \Codeception\Module\WebDriver::waitForElementNotVisible() - */ - public function waitForElementNotVisible($element, $timeout = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementNotVisible', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for the given string to appear on the page. - * - * Can also be passed a selector to search in, be as specific as possible when using selectors. - * waitForText() will only watch the first instance of the matching selector / text provided. - * If the given text doesn't appear, a timeout exception is thrown. - * - * ``` php - * waitForText('foo', 30); // secs - * $I->waitForText('foo', 30, '.title'); // secs - * ?> - * ``` - * - * @param string $text - * @param int $timeout seconds - * @param string $selector optional - * @throws \Exception - * @see \Codeception\Module\WebDriver::waitForText() - */ - public function waitForText($text, $timeout = null, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForText', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Wait for $timeout seconds. - * - * @param int|float $timeout secs - * @throws \Codeception\Exception\TestRuntimeException - * @see \Codeception\Module\WebDriver::wait() - */ - public function wait($timeout) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('wait', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Low-level API method. - * If Codeception commands are not enough, this allows you to use Selenium WebDriver methods directly: - * - * ``` php - * $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - * $webdriver->get('http://google.com'); - * }); - * ``` - * - * This runs in the context of the - * [RemoteWebDriver class](https://github.com/facebook/php-webdriver/blob/master/lib/remote/RemoteWebDriver.php). - * Try not to use this command on a regular basis. - * If Codeception lacks a feature you need, please implement it and submit a patch. - * - * @param callable $function - * @see \Codeception\Module\WebDriver::executeInSelenium() - */ - public function executeInSelenium($function) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('executeInSelenium', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Switch to another window identified by name. - * - * The window can only be identified by name. If the $name parameter is blank, the parent window will be used. - * - * Example: - * ``` html - * - * ``` - * - * ``` php - * click("Open window"); - * # switch to another window - * $I->switchToWindow("another_window"); - * # switch to parent window - * $I->switchToWindow(); - * ?> - * ``` - * - * If the window has no name, match it by switching to next active tab using `switchToNextTab` method. - * - * Or use native Selenium functions to get access to all opened windows: - * - * ``` php - * executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - * $handles=$webdriver->getWindowHandles(); - * $last_window = end($handles); - * $webdriver->switchTo()->window($last_window); - * }); - * ?> - * ``` - * - * @param string|null $name - * @see \Codeception\Module\WebDriver::switchToWindow() - */ - public function switchToWindow($name = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToWindow', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Switch to another frame on the page. - * - * Example: - * ``` html - *