Passed
Push — master ( 62401f...daf94f )
by Alec
07:24
created

CalculatorFactoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2
1
<?php
2
/**
3
 * User: alec
4
 * Date: 09.11.18
5
 * Time: 16:16
6
 */
7
8
namespace Tests\Unit\Money;
9
10
11
use AlecRabbit\Money\Calculator\BcMathCalculator;
12
use AlecRabbit\Money\CalculatorFactory;
13
use PHPUnit\Framework\TestCase;
14
15
class CalculatorFactoryTest extends TestCase
16
{
17
    /**
18
     * @test
19
     */
20
    public function throwsAnExceptionWhenCalculatorIsInvalid(): void
21
    {
22
        $this->expectException(\InvalidArgumentException::class);
23
        CalculatorFactory::registerCalculator('InvalidCalculator');
24
    }
25
26
    /**
27
     * @test
28
     */
29
    public function addsCalculator(): void
30
    {
31
        $this->assertEquals(2, CalculatorFactory::registerCalculator(BcMathCalculator::class));
32
    }
33
}