преди 8 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. This directory contains various tests for the advanced applications.
  2. Tests in `codeception` directory are developed with [Codeception PHP Testing Framework](http://codeception.com/).
  3. After creating and setting up the advanced application, follow these steps to prepare for the tests:
  4. 1. Install Codeception if it's not yet installed:
  5. ```
  6. composer global require "codeception/codeception=2.0.*" "codeception/specify=*" "codeception/verify=*"
  7. ```
  8. If you've never used Composer for global packages run `composer global status`. It should output:
  9. ```
  10. Changed current directory to <directory>
  11. ```
  12. Then add `<directory>/vendor/bin` to you `PATH` environment variable. Now you're able to use `codecept` from command
  13. line globally.
  14. 2. Install faker extension by running the following from template root directory where `composer.json` is:
  15. ```
  16. composer require --dev yiisoft/yii2-faker:*
  17. ```
  18. 3. Create `yii2_advanced_tests` database then update it by applying migrations:
  19. ```
  20. codeception/bin/yii migrate
  21. ```
  22. 4. In order to be able to run acceptance tests you need to start a webserver. The simplest way is to use PHP built in
  23. webserver. In the root directory where `common`, `frontend` etc. are execute the following:
  24. ```
  25. php -S localhost:8080
  26. ```
  27. 5. Now you can run the tests with the following commands, assuming you are in the `tests/codeception` directory:
  28. ```
  29. # frontend tests
  30. cd frontend
  31. codecept build
  32. codecept run
  33. # backend tests
  34. cd backend
  35. codecept build
  36. codecept run
  37. # etc.
  38. ```
  39. If you already have run `codecept build` for each application, you can skip that step and run all tests by a single `codecept run`.