From d7df546502eb04141b1d32d1e4cb705766da296d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 25 Jul 2016 23:41:30 +0300 Subject: [PATCH] Fixed version constraints, adjusted readme, fixed formatting --- README.md | 32 ++++++++++++++++++---------- composer.json | 6 +++--- tests/functional/ContactFormCest.php | 20 ++++++++--------- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 543d87f..7f813f8 100644 --- a/README.md +++ b/README.md @@ -106,21 +106,32 @@ return [ TESTING ------- -Tests are located in `tests` directory, developed with [Codeception PHP Testing Framework](http://codeception.com/). -By default there are 3 test suites: `unit`, `functional` and `acceptance`. Tests can be executed by running +Tests are located in `tests` directory. They are developed with [Codeception PHP Testing Framework](http://codeception.com/). +By default there are 3 test suites: - ``` - composer exec codecept run - ``` +- `unit` +- `functional` +- `acceptance` -This will execute unit and functional tests. Unit tests are testing the system components, while functional tests are for testing user interaction. -Acceptance tests are disabled by default as they require additional setup as they perform testing in real browser. +Tests can be executed by running + +``` +composer exec codecept run +``` + +The command above will execute unit and functional tests. Unit tests are testing the system components, while functional +tests are for testing user interaction. Acceptance tests are disabled by default as they require additional setup since +they perform testing in real browser. + + +### Running acceptance tests To execute acceptance tests do the following: 1. Rename `tests/acceptance.suite.yml.example` to `tests/acceptance.suite.yml` to enable suite configuration -2. Replace `codeception/base` package in `composer.json` with `codeception/codeception` to install full featured version of Codeception. +2. Replace `codeception/base` package in `composer.json` with `codeception/codeception` to install full featured + version of Codeception 3. Update dependencies with Composer @@ -162,8 +173,7 @@ To execute acceptance tests do the following: composer exec codecept run unit,functional ``` -Code coverage support ---------------------- +### Code coverage support By default, code coverage is disabled in `codeception.yml` configuration file, you should uncomment needed rows to be able to collect code coverage. You can run your tests and collect coverage with the following command: @@ -179,4 +189,4 @@ composer exec codecept run unit --coverage-html --coverage-xml composer exec codecept run functional,unit --coverage-html --coverage-xml ``` -You can see code coverage output under the `tests/_output` directory. \ No newline at end of file +You can see code coverage output under the `tests/_output` directory. diff --git a/composer.json b/composer.json index ec9bcb4..d459e63 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", @@ -21,11 +21,11 @@ }, "require-dev": { "codeception/base": "^2.2.3", - "codeception/verify": "*", + "codeception/verify": "~0.3.1", "yiisoft/yii2-debug": "*", "yiisoft/yii2-gii": "*", "yiisoft/yii2-faker": "*", - "codeception/specify": "*" + "codeception/specify": "~0.4.3" }, "config": { "process-timeout": 1800 diff --git a/tests/functional/ContactFormCest.php b/tests/functional/ContactFormCest.php index a874317..7f198bf 100644 --- a/tests/functional/ContactFormCest.php +++ b/tests/functional/ContactFormCest.php @@ -26,11 +26,11 @@ class ContactFormCest public function submitFormWithIncorrectEmail(\FunctionalTester $I) { $I->submitForm('#contact-form', [ - 'ContactForm[name]' => 'tester', - 'ContactForm[email]' => 'tester.email', - 'ContactForm[subject]' => 'test subject', - 'ContactForm[body]' => 'test content', - 'ContactForm[verifyCode]' => 'testme', + 'ContactForm[name]' => 'tester', + 'ContactForm[email]' => 'tester.email', + 'ContactForm[subject]' => 'test subject', + 'ContactForm[body]' => 'test content', + 'ContactForm[verifyCode]' => 'testme', ]); $I->expectTo('see that email address is wrong'); $I->dontSee('Name cannot be blank', '.help-inline'); @@ -43,11 +43,11 @@ class ContactFormCest public function submitFormSuccessfully(\FunctionalTester $I) { $I->submitForm('#contact-form', [ - 'ContactForm[name]' => 'tester', - 'ContactForm[email]' => 'tester@example.com', - 'ContactForm[subject]' => 'test subject', - 'ContactForm[body]' => 'test content', - 'ContactForm[verifyCode]' => 'testme', + 'ContactForm[name]' => 'tester', + 'ContactForm[email]' => 'tester@example.com', + 'ContactForm[subject]' => 'test subject', + 'ContactForm[body]' => 'test content', + 'ContactForm[verifyCode]' => 'testme', ]); $I->seeEmailIsSent(); $I->dontSeeElement('#contact-form');