Skip to content

Commit aacabfd

Browse files
committed
AC-3005::Fixed the unit tests
1 parent cf956db commit aacabfd

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

lib/internal/Magento/Framework/Composer/Test/Unit/DependencyCheckerTest.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ class DependencyCheckerTest extends TestCase
2020
*/
2121
public function testCheckDependencies(): void
2222
{
23-
$composerApp =
24-
$this->createPartialMock(Application::class, ['setAutoExit', 'resetComposer', 'run']);
23+
$composerApp = $this->getMockBuilder(Application::class)
24+
->setMethods(['setAutoExit', 'resetComposer', 'run','__destruct'])
25+
->disableOriginalConstructor()
26+
->getMock();
2527
$directoryList = $this->createMock(DirectoryList::class);
2628
$directoryList->expects($this->exactly(2))->method('getRoot');
2729
$composerApp->expects($this->once())->method('setAutoExit')->with(false);
30+
$composerApp->expects($this->any())->method('__destruct');
2831

2932
$composerApp
3033
->method('run')
@@ -35,6 +38,7 @@ function ($input, $buffer) {
3538
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL .
3639
'magento/package-c requires magento/package-a (1.0)' . PHP_EOL;
3740
$buffer->writeln($output);
41+
return 1;
3842
}
3943
),
4044
$this->returnCallback(
@@ -43,6 +47,7 @@ function ($input, $buffer) {
4347
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL .
4448
'magento/package-d requires magento/package-b (1.0)' . PHP_EOL;
4549
$buffer->writeln($output);
50+
return 1;
4651
}
4752
)
4853
);
@@ -64,11 +69,14 @@ function ($input, $buffer) {
6469
*/
6570
public function testCheckDependenciesExcludeSelf(): void
6671
{
67-
$composerApp =
68-
$this->createPartialMock(Application::class, ['setAutoExit', 'resetComposer', 'run']);
72+
$composerApp = $this->getMockBuilder(Application::class)
73+
->setMethods(['setAutoExit', 'resetComposer', 'run','__destruct'])
74+
->disableOriginalConstructor()
75+
->getMock();
6976
$directoryList = $this->createMock(DirectoryList::class);
7077
$directoryList->expects($this->exactly(3))->method('getRoot');
7178
$composerApp->expects($this->once())->method('setAutoExit')->with(false);
79+
$composerApp->expects($this->any())->method('__destruct');
7280

7381
$composerApp
7482
->method('run')
@@ -79,6 +87,7 @@ function ($input, $buffer) {
7987
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL .
8088
'magento/package-c requires magento/package-a (1.0)' . PHP_EOL;
8189
$buffer->writeln($output);
90+
return 1;
8291
}
8392
),
8493
$this->returnCallback(
@@ -87,13 +96,15 @@ function ($input, $buffer) {
8796
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL .
8897
'magento/package-d requires magento/package-b (1.0)' . PHP_EOL;
8998
$buffer->writeln($output);
99+
return 1;
90100
}
91101
),
92102
$this->returnCallback(
93103
function ($input, $buffer) {
94104
$output = 'magento/package-d requires magento/package-c (1.0)' . PHP_EOL .
95105
'magento/project-community-edition requires magento/package-a (1.0)' . PHP_EOL;
96106
$buffer->writeln($output);
107+
return 1;
97108
}
98109
)
99110
);

0 commit comments

Comments
 (0)