mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-05-17 21:26:40 +02:00
Add some notes about coverage annotations
This commit is contained in:
parent
19c687b800
commit
ca6756a6ad
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue