Skip to content

Commit

Permalink
Merge pull request #2772 from CalderaWP/feature/2771
Browse files Browse the repository at this point in the history
Refactor testing fixes #2771
  • Loading branch information
Josh Pollock authored Oct 23, 2018
2 parents 38b768b + 1971f5e commit 23e4982
Show file tree
Hide file tree
Showing 2,262 changed files with 771,709 additions and 73,627 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ npm-debug.log
**/.DS_Store
includes/freemius/assets/img/caldera-forms.png
bin/caldera-forms

wordpress/*
wp-content/*
cypress/screenshots/*
cypress/videos/*
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ notifications:
on_failure: change


cache: false
cache:
directories:
- node_modules
- vendor

env:
- WP_VERSION=latest
Expand Down Expand Up @@ -57,6 +60,7 @@ script:
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit
composer test:unit
fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
Expand Down
26 changes: 0 additions & 26 deletions Dockerfile

This file was deleted.

63 changes: 51 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ Requires: git, npm, Grunt.
- `git clone [email protected]:CalderaWP/Caldera-Forms.git`
- Switch directory
- `cd Caldera-Forms.git`
- npm install
- `npm i`
- If you are using your own local development environment:
- `npm i && composer install`
- If you are wish to use the provided local development environment
- `composer dev:install`


### Build For Release
To create a build to ship to WordPress.org:
`npm run package`
Expand Down Expand Up @@ -60,7 +64,11 @@ This is the old stuff, built with grunt.
### Test Environment
All PHP tests are based off of the WordPress "unit" test suite, and therefore need a full WordPress test environment. The install script in '/bin' is pretty standard and should work with VVV or whatever.

Alternatively, because this, isn't 2014, you can use the provided Docker environment.
We provide a docker-based development environment. It is recommended that you use this environment because the setup is scripted and all of the tests can be run with it.

The local server is [http://localhost:8228](http://localhost:8228)


#### Requirements
* Docker
- [Installation documentation](https://docs.docker.com/install/)
Expand All @@ -69,21 +77,52 @@ Alternatively, because this, isn't 2014, you can use the provided Docker environ
* npm
- [Installation documentation](https://www.npmjs.com/get-npm)


#### Install Test Environment
* Install local development environment, dependencies and setup test forms
- `composer dev:install`
- May take awhile.
* Go to [http://localhost:8228](http://localhost:8228) and make sure you have a WordPress site and can login.
- Username: admin
- password: password

### Test Structures
* PHP tests go in /tests and are run using phpunit
* JavaScript tests go in clients/tests
- Unit tests go in clients/tests/unit and are run using [Jest](https://facebook.github.io/jest/docs/en/getting-started.html)
- Unit tests must have the word test in file name. For example, `formConfig.test.js`
- Integration tests, which require WordPress, are in tests. These used to be all the tests we have.
- Unit tests -- isolated tests that do NOT require WordPress -- go in `tests/Unit`.
- The trait `calderawp\calderaforms\Util\Traits` should have all of the factories used for integration and unit tests (aspirational.)
* JavaScript UNIT tests go in clients/tests
- Unit tests go in clients/tests/unit and are run using [Jest](https://facebook.github.io/jest/docs/en/getting-started.html)
- Unit tests must have the word test in file name. For example, `formConfig.test.js`
* End to end tests go in `cypress/integration` amd are written using [Cypress](https://cypress.io)
- See our [Cypress README for testing](./cypress/README.md)

#### Commands
* `composer wp-install` - Installs Docker-based test environment.
* `composer wp-start` - Starts Docker-based test environment.
* `composer wp-tests` - Runs phpunit inside of Docker container.
* `composer wp-stop` - Stops Docker-based test environment, without destroying containers.
* `composer wp-remove` - Stops Docker-based test environment and destroys containers.
##### Composer
* `composer dev:install` - Installs dependencies, Docker-based test environment and sets up test forms.
* `composer dev:destroy` - Deletes dependencies and the Docker-based test environment.
* `composer wp:install` - Installs Docker-based test environment.
* `composer wp:start` - Starts Docker-based test environment.
* `composer wp:activate` - Activate plugins in Docker-based environment.
* `composer wp:tests` - Runs the PHP integration tests using phpunit inside Docker-based environment .
* `composer wp:stop` - Stops Docker-based test environment, without destroying containers.
* `composer wp:destroy` - Removes (including the database) the test environment and destroys containers.
* `composer test:setup` - Adds test forms and puts them on pages.
* `composer test:delete` - Delete test forms and pages the are on.
* `composer nuke` - Deletes dependencies, including lock files -- NPM and Composer.

##### Composer
* `npm test` - Run JavaScript test watcher
* `npm run test:once` - Run JavaScript unit tests once

* `npm run test:e2e` - Start Cypress e2e test runner.
* `npm run test:e2e:ci` - Trigger Cypress.io test record.

##### wp-cli
Probably don't use these directly. They will change. Must be prefaced with `docker-compose run --rm cli`
* `wp cf import-test-forms` - Import test forms
* `wp cf delete-test-forms` - Delete test forms
* `wp cf create-test-pages` - Import test pages
* `wp cf delete-test-pages` - Delete test pages
### Release To WordPress.org
##### Requires
* [svn](https://subversion.apache.org/quick-start#installing-the-client)
Expand Down
3 changes: 2 additions & 1 deletion assets/build/css/caldera-forms-front.min.css

Large diffs are not rendered by default.

64 changes: 1 addition & 63 deletions assets/css/caldera-forms-front.css

Large diffs are not rendered by default.

Loading

0 comments on commit 23e4982

Please sign in to comment.