Passed
Branch master (a96d1e)
by Nicolas
02:44
created

PlanProviderTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 25
rs 10
1
<?php
2
3
namespace Tests\Cp\Provider;
4
5
use Cp\DomainObject\Configuration;
6
use Cp\DomainObject\Plan;
7
use Cp\Manager\PlanManager;
8
use Cp\Provider\PlanProvider;
9
10
/**
11
 * Class PlanProviderTest
12
 */
13
class PlanProviderTest extends \PHPUnit_Framework_TestCase
14
{
15
    /**
16
     * Test if return a Plan by configuration
17
     */
18
    public function testGetPlanByConfiguration()
19
    {
20
        $planMock = $this->getMockBuilder(Plan::class)->disableOriginalConstructor()->getMock();
21
22
        $planManagerMock = $this->getMockBuilder(PlanManager::class)->disableOriginalConstructor()->getMock();
23
        $planManagerMock
24
            ->expects($this->once())
25
            ->method('findByType')
26
            ->willReturn($planMock)
27
        ;
28
29
        $configurationMock = $this->getMockBuilder(Configuration::class)->disableOriginalConstructor()->getMock();
30
31
        $planProvider = new PlanProvider($planManagerMock);
32
33
        $actual = $planProvider->getPlanByConfiguration($configurationMock);
34
35
        $this->assertInstanceOf(Plan::class, $actual);
36
    }
37
}
38