Skip to content

Commit

Permalink
Create option to not generate sample data and add extra data #149
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Paliarush committed Oct 29, 2017
1 parent 56c5c25 commit 4e2cc49
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added

- Support for new location of `generated` directory in Magento 2.2.0
- Basic data generation can be turned off. Added configurable product and customer address generation

### Fixed

Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* [Clear Magento cache](#clear-magento-cache)
* [Switch between CE and EE](#switch-between-ce-and-ee)
* [Sample data installation](#sample-data-installation)
* [Basic data generation](#basic-data-generation)
* [Use Magento CLI (bin/magento)](#use-magento-cli-binmagento)
* [Debugging with XDebug](#debugging-with-xdebug)
* [Connecting to MySQL DB](#connecting-to-mysql-db)
Expand Down Expand Up @@ -186,6 +187,16 @@ During initial project setup or during `bash init_project.sh -fc` (with `-fc` pr

To install Magento with sample data set `install_sample_data` in [config.yaml](etc/config.yaml.dist) to `1` and run `bash m-switch-to-ce -f` or `bash m-switch-to-ee -f`, depending on the edition to be installed. To disable sample data, set this option to `0` and force-switch to necessary edition (using the same commands).

### Basic data generation

Several entities are generated for testing purposes by default using REST API after Magento installation:
- Customer with address (credentials `[email protected]`:`123123qQ`)
- Category
- Couple simple products
- Configurable product

To disable this feature, set `magento/generate_basic_data` in [config.yaml](etc/config.yaml.dist) to `0` and run `bash m-switch-to-ce -f` or `bash m-switch-to-ee -f`, depending on the edition to be installed.

### Use Magento CLI (bin/magento)

Go to 'vagrant-magento' created earlier and run in command line:
Expand Down
2 changes: 2 additions & 0 deletions etc/config.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ environment:
magento:
# [To apply changes: m-switch-to-ce -f OR m-switch-to-ee -f]
install_sample_data: 0
# [To apply changes: m-switch-to-ce -f OR m-switch-to-ee -f] Generate customer ([email protected]:123123qQ), category, simple product, configurable product after successful Magento installation
generate_basic_data: 1
# [To apply changes: init_project.sh -f]
host_name: "magento2.vagrant2"
# [To apply changes: m-reinstall]
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions scripts/guest/m-reinstall
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ get_config_value="/vagrant/scripts/get_config_value.sh"
magento_host_name="$(bash ${get_config_value} "magento_host_name")"
use_nfs="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "guest_use_nfs")"
is_windows_host=${IS_WINDOWS_HOST}
generate_data="$(bash ${get_config_value} "magento_generate_sample_data")"
generate_basic_data="$(bash ${get_config_value} "magento_generate_basic_data")"

declare -A setupOptions
setupOptions[admin_frontname]="$(bash ${get_config_value} "magento_admin_frontname")"
Expand Down Expand Up @@ -106,8 +106,8 @@ if [[ ${is_windows_host} == 1 ]] || [[ ${use_nfs} == 0 ]]; then
sudo chown -R vagrant:vagrant ${MAGENTO_ROOT}
fi

if [[ ${generate_data} == 1 ]]; then
bash generate_sample_data
if [[ ${generate_basic_data} != 0 ]]; then
bash generate_basic_data
fi
bash configure_search_engine
bash change_magento_config_for_functional_tests
Expand Down

0 comments on commit 4e2cc49

Please sign in to comment.