mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-05-17 21:26:40 +02:00
Merge pull request #190 from edpauto/contribution-coverage
Add some notes about coverage annotations into CONTRIBUTING.md
This commit is contained in:
commit
8a9aee4395
|
@ -90,6 +90,31 @@ bin/phpunit --coverate-html report
|
||||||
```
|
```
|
||||||
where `report` is the directory where html report files shall be stored.
|
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`.
|
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
|
## Configuration
|
||||||
Magallanes configuration is kept in YAML files. Please follow those rules while adding or changing the configuration:
|
Magallanes configuration is kept in YAML files. Please follow those rules while adding or changing the configuration:
|
||||||
|
|
Loading…
Reference in a new issue