From ca6756a6ad10f1459b095567040934929faf35a5 Mon Sep 17 00:00:00 2001 From: Kuba Turek Date: Mon, 2 Feb 2015 18:38:32 +0100 Subject: [PATCH] Add some notes about coverage annotations --- CONTRIBUTING.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e044b1e..5aff929 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,6 +89,31 @@ or with more friendly and detailed user graphical representation, into HTML: ``` where `report` is the directory where html report files shall be stored. Tests structure follow the same structure as production code with `Test` suffix in class and file name. All tests should go to `tests` directory in project root. So if you've created a class `Mage\Tasks\BuilIn\NewTask` the testing class should be called `MageTest\Tasks\BuiltIn\NewTaskTest`. +To provide more strict tests, point what the method actually test and omit testing some classes indirectly, remember to add annotations to your tests: + +* **`@coversDefaultClass` class annotations** +This prevent to to write full class name each time you write `@covers` for test method (see next point) +```php + +/** + * @coversDefaultClass Mage\Console\Colors + */ +class ColorsTest extends PHPUnit_Framework_TestCase +{ +``` +* **`@covers` methods annotations** +```php +/** + * @covers ::add + */ +public function testAddOnePlusOne() +{ + // ... +} +``` +**Note:** If you omit `coversDefaultClass` for test class, you need to write full class name in `@covers` annotation. + +**Test class musn't test more than one class and any other classes than class being actually tested** ## Configuration Magallanes configuration is kept in YAML files. Please follow those rules while adding or changing the configuration: