From d4be41f0bd35e7ebc27de2541fd3e9b6320bd8f9 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 13 Oct 2016 16:36:52 +0200 Subject: [PATCH] Add Codeception testing suite --- README.md | 5 +++ codeception.yml | 18 ++++++++ composer.json | 8 ++++ tests/_bootstrap.php | 11 +++++ tests/_support/Helper/Unit.php | 80 ++++++++++++++++++++++++++++++++++ tests/_support/UnitTester.php | 26 +++++++++++ tests/unit.suite.yml | 9 ++++ tests/unit/_bootstrap.php | 3 ++ 8 files changed, 160 insertions(+) create mode 100644 codeception.yml create mode 100644 tests/_bootstrap.php create mode 100644 tests/_support/Helper/Unit.php create mode 100644 tests/_support/UnitTester.php create mode 100644 tests/unit.suite.yml create mode 100644 tests/unit/_bootstrap.php diff --git a/README.md b/README.md index f6d9811f..d689dbaa 100644 --- a/README.md +++ b/README.md @@ -105,3 +105,8 @@ If you have been following the [blog](http://getgrav.org/blog), [Twitter](https: The **standard free version**, is very powerful, and has more functionality than most commercial flat-file CMS systems. We also intend to release in the near future a more feature-rich **pro version** that will include enhanced functionality, as well as some additional nice-to-have capabilities. This pro version will be a **paid** plugin the price of which is not yet 100% finalized. + +# Running Tests + +First install the dev dependencies by running `composer update` from the Grav root. +Then `composer test` will run the Unit Tests, which should be always executed successfully on any site. diff --git a/codeception.yml b/codeception.yml new file mode 100644 index 00000000..7d317a5a --- /dev/null +++ b/codeception.yml @@ -0,0 +1,18 @@ +actor: Tester +paths: + tests: tests + log: tests/_output + data: tests/_data + support: tests/_support + envs: tests/_envs +settings: + bootstrap: _bootstrap.php + colors: true + memory_limit: 1024M +extensions: + enabled: + - Codeception\Extension\RunFailed + # - Codeception\Extension\Recorder + +modules: + config: diff --git a/composer.json b/composer.json index bd3f435e..2386d0ac 100644 --- a/composer.json +++ b/composer.json @@ -2,5 +2,13 @@ "require": { "composer/semver": "^1.4", "fguillot/picofeed": "@stable" + }, + "require-dev": { + "codeception/codeception": "^2.1", + "fzaninotto/faker": "^1.5" + }, + "scripts": { + "test": "vendor/bin/codecept run unit", + "test-windows": "vendor\\bin\\codecept run unit" } } diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php new file mode 100644 index 00000000..9b932bd6 --- /dev/null +++ b/tests/_bootstrap.php @@ -0,0 +1,11 @@ +