|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of forecast.it.fill project. |
|
7
|
|
|
* (c) Patrick Jaja <[email protected]> |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace ForecastAutomationTests\ForecastDataImport; |
|
13
|
|
|
|
|
14
|
|
|
use ForecastAutomation\Activity\ActivityFacade; |
|
15
|
|
|
use ForecastAutomation\Activity\Shared\Dto\ActivityDto; |
|
16
|
|
|
use ForecastAutomation\Activity\Shared\Dto\ActivityDtoCollection; |
|
17
|
|
|
use ForecastAutomation\ForecastDataImport\ForecastDataImportFacade; |
|
|
|
|
|
|
18
|
|
|
use ForecastAutomation\ForecastDataImport\ForecastDataImportFactory; |
|
|
|
|
|
|
19
|
|
|
use ForecastAutomation\QueueClient\QueueClientFacade; |
|
20
|
|
|
use PHPUnit\Framework\TestCase; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @internal |
|
24
|
|
|
* @covers |
|
25
|
|
|
*/ |
|
26
|
|
|
final class ForecastDataImportFacadeTest extends TestCase |
|
27
|
|
|
{ |
|
28
|
|
|
public function testCanStartTheImportProcess(): void |
|
29
|
|
|
{ |
|
30
|
|
|
$writtenActivities = $this->createForecastDataImportFacade()->startImportProcess(); |
|
31
|
|
|
static::assertSame(1, $writtenActivities); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
private function createForecastDataImportFacade(): ForecastDataImportFacade |
|
35
|
|
|
{ |
|
36
|
|
|
$activityFacadeMock = $this->getMockBuilder(ActivityFacade::class) |
|
37
|
|
|
->onlyMethods(['collect']) |
|
38
|
|
|
->getMock() |
|
39
|
|
|
; |
|
40
|
|
|
$activityFacadeMock |
|
41
|
|
|
->method('collect') |
|
42
|
|
|
->willReturn( |
|
43
|
|
|
new ActivityDtoCollection( |
|
44
|
|
|
new ActivityDto('test-needle', 'test-description', new \DateTime(), 100) |
|
45
|
|
|
) |
|
46
|
|
|
) |
|
47
|
|
|
; |
|
48
|
|
|
|
|
49
|
|
|
$forecastClientFacadeMock = $this->getMockBuilder(QueueClientFacade::class) |
|
50
|
|
|
->getMock() |
|
51
|
|
|
; |
|
52
|
|
|
|
|
53
|
|
|
$forecastDataImportFactoryMock = $this->getMockBuilder(ForecastDataImportFactory::class) |
|
54
|
|
|
->onlyMethods(['getActivityFacade', 'getQueueClientFacade']) |
|
55
|
|
|
->getMock() |
|
56
|
|
|
; |
|
57
|
|
|
$forecastDataImportFactoryMock |
|
58
|
|
|
->method('getActivityFacade') |
|
59
|
|
|
->willReturn($activityFacadeMock) |
|
60
|
|
|
; |
|
61
|
|
|
$forecastDataImportFactoryMock |
|
62
|
|
|
->method('getQueueClientFacade') |
|
63
|
|
|
->willReturn($forecastClientFacadeMock) |
|
64
|
|
|
; |
|
65
|
|
|
|
|
66
|
|
|
$forecastDataImportFacadeMock = $this->getMockBuilder(ForecastDataImportFacade::class) |
|
67
|
|
|
->onlyMethods(['getFactory']) |
|
68
|
|
|
->getMock() |
|
69
|
|
|
; |
|
70
|
|
|
$forecastDataImportFacadeMock |
|
71
|
|
|
->method('getFactory') |
|
72
|
|
|
->willReturn($forecastDataImportFactoryMock) |
|
73
|
|
|
; |
|
74
|
|
|
|
|
75
|
|
|
return $forecastDataImportFacadeMock; |
|
|
|
|
|
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths