Failed Conditions
Push — master ( 3cf6df...56f0b0 )
by Adrien
07:17
created

AccountingTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 25
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCheck() 0 20 1
A setUp() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApplicationTest\Service;
6
7
use Application\Model\Account;
8
use Application\Model\Product;
1 ignored issue
show
Bug introduced by
The type Application\Model\Product was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Application\Model\User;
10
use Application\Repository\AccountRepository;
11
use Application\Repository\ProductRepository;
1 ignored issue
show
Bug introduced by
The type Application\Repository\ProductRepository was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Application\Service\Accounting;
13
use ApplicationTest\Traits\TestWithTransactionAndUser;
14
use PHPUnit\Framework\TestCase;
15
16
class AccountingTest extends TestCase
17
{
18
    use TestWithTransactionAndUser {
19
        setUp as setupWithTransaction;
20
    }
21
22
    private Accounting $accounting;
23
24
    protected function setUp(): void
25
    {
26
        $this->setupWithTransaction();
27
28
        /** @var User $user */
29
        $user = _em()->getRepository(User::class)->getOneByLogin('administrator');
30
        User::setCurrent($user);
31
32
        global $container;
33
        $this->accounting = $container->get(Accounting::class);
34
    }
35
36
    public function testCheck(): void
37
    {
38
        $this->expectOutputString(<<<STRING
39
40
            Produits  : 240.00
41
            Charges   : 112.50
42
            Bénéfice  : 127.50
43
            Actifs    : 35187.50
44
            Passifs   : 60.00
45
            Capital   : 35000.00
46
            Écart     : 0.00
47
            Création du compte 20300010 pour l'utilisateur 1003...
48
            Création du compte 20300011 pour l'utilisateur 1004...
49
            Création du compte 20300012 pour l'utilisateur 1005...
50
            Création du compte 20300013 pour l'utilisateur 1006...
51
52
            STRING
53
        );
54
55
        self::assertFalse($this->accounting->check(), 'fixture data should not produce any errors');
56
    }
57
}
58