| 1 | <?php |
||
| 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 |