1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Yawik\Migration\Tests\Migrator\Version36; |
6
|
|
|
|
7
|
|
|
use Applications\Entity\ApplicationInterface; |
8
|
|
|
use Applications\Service\UploadHandler; |
9
|
|
|
use Core\Service\UploadedFileInfo; |
10
|
|
|
use CoreTestUtils\TestCase\FunctionalTestCase; |
|
|
|
|
11
|
|
|
use PHPUnit\Framework\MockObject\MockObject; |
12
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
13
|
|
|
use Symfony\Component\Console\Output\StreamOutput; |
14
|
|
|
use Yawik\Migration\Migrator\Version36\ApplicationAttachments; |
|
|
|
|
15
|
|
|
use Yawik\Migration\Tests\DatabaseConcernTrait; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class ApplicationAttachmentsExecutorTest |
19
|
|
|
* |
20
|
|
|
* @covers \Yawik\Migration\Migrator\Version36\ApplicationAttachments |
21
|
|
|
* @package Yawik\Migration\Tests\Migrator\Version36 |
22
|
|
|
*/ |
23
|
|
|
class ApplicationAttachmentsTest extends FunctionalTestCase |
24
|
|
|
{ |
25
|
|
|
use DatabaseConcernTrait; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var ApplicationAttachments |
29
|
|
|
*/ |
30
|
|
|
private ApplicationAttachments $target; |
31
|
|
|
/** |
32
|
|
|
* @var MockObject|OutputInterface |
33
|
|
|
*/ |
34
|
|
|
private $out; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var UploadHandler|MockObject |
38
|
|
|
*/ |
39
|
|
|
private $appHandler; |
40
|
|
|
|
41
|
|
|
protected function setUp(): void |
42
|
|
|
{ |
43
|
|
|
parent::setUp(); |
44
|
|
|
|
45
|
|
|
$this->appHandler = $this->createMock(UploadHandler::class); |
46
|
|
|
$this->out = new StreamOutput(fopen('php://memory', 'w', \false)); |
47
|
|
|
$this->target = new ApplicationAttachments( |
48
|
|
|
$this->getDoctrine(), |
49
|
|
|
$this->out, |
50
|
|
|
$this->appHandler, |
51
|
|
|
); |
52
|
|
|
$this->setDbConcernContainer($this->getApplicationServiceLocator()); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
private function createTestData() |
56
|
|
|
{ |
57
|
|
|
$bucket = $this->getBucket('old.applications'); |
58
|
|
|
$this->drop('applications'); |
59
|
|
|
$bucket->drop(); |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
$fileID = $this->createFile('old.applications'); |
63
|
|
|
$app = $this->loadJson(__DIR__.'/files/application.json'); |
64
|
|
|
$app['images'][] = $fileID; |
65
|
|
|
|
66
|
|
|
$this->insert("applications", $app); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function testExecute() |
70
|
|
|
{ |
71
|
|
|
$target = $this->target; |
72
|
|
|
$appHandler = $this->appHandler; |
73
|
|
|
$app = $this->createMock(ApplicationInterface::class); |
74
|
|
|
|
75
|
|
|
$this->createTestData(); |
76
|
|
|
|
77
|
|
|
$appHandler->expects($this->once()) |
78
|
|
|
->method('find') |
79
|
|
|
->with('55ae81046b10f87e728b4718') |
80
|
|
|
->willReturn($app); |
81
|
|
|
$appHandler->expects($this->once()) |
82
|
|
|
->method('handleUpload') |
83
|
|
|
->with($this->isInstanceOf(ApplicationInterface::class), $this->isInstanceOf(UploadedFileInfo::class)) |
84
|
|
|
->willReturn($app) |
85
|
|
|
; |
86
|
|
|
|
87
|
|
|
$target->process(); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
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