Skip to content

Commit 8e6ad97

Browse files
committed
fix test
1 parent c4bf3b4 commit 8e6ad97

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tests/Command/DiffCommandTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Composer\DependencyResolver\Operation\UninstallOperation;
88
use Composer\DependencyResolver\Operation\UpdateOperation;
99
use IonBazan\ComposerDiff\Command\DiffCommand;
10+
use IonBazan\ComposerDiff\Tests\Integration\ComposerApplication;
1011
use IonBazan\ComposerDiff\Tests\TestCase;
1112
use Symfony\Component\Console\Tester\CommandTester;
1213

@@ -20,7 +21,10 @@ class DiffCommandTest extends TestCase
2021
public function testItGeneratesReportInGivenFormat($expectedOutput, array $options)
2122
{
2223
$diff = $this->getMockBuilder('IonBazan\ComposerDiff\PackageDiff')->getMock();
23-
$tester = new CommandTester(new DiffCommand($diff, array('gitlab2.org')));
24+
$application = new ComposerApplication();
25+
$command = new DiffCommand($diff, array('gitlab2.org'));
26+
$command->setApplication($application);
27+
$tester = new CommandTester($command);
2428
$diff->expects($this->once())
2529
->method('getPackageDiff')
2630
->with($this->isType('string'), $this->isType('string'), false, false)
@@ -49,7 +53,10 @@ public function testItGeneratesReportInGivenFormat($expectedOutput, array $optio
4953
public function testStrictMode($exitCode, array $prodOperations, array $devOperations)
5054
{
5155
$diff = $this->getMockBuilder('IonBazan\ComposerDiff\PackageDiff')->getMock();
52-
$tester = new CommandTester(new DiffCommand($diff, array('gitlab2.org')));
56+
$application = new ComposerApplication();
57+
$command = new DiffCommand($diff, array('gitlab2.org'));
58+
$command->setApplication($application);
59+
$tester = new CommandTester($command);
5360
$diff->expects($this->exactly(2))
5461
->method('getPackageDiff')
5562
->with($this->isType('string'), $this->isType('string'), $this->isType('boolean'), false)

tests/Integration/DiffCommandTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ class DiffCommandTest extends TestCase
2424
*/
2525
public function testCommand($expectedOutput, array $input)
2626
{
27-
$tester = new CommandTester(new DiffCommand(new PackageDiff()));
27+
$application = new ComposerApplication();
28+
$command = new DiffCommand(new PackageDiff());
29+
$command->setApplication($application);
30+
$tester = new CommandTester($command);
2831
$result = $tester->execute($input);
2932
$this->assertSame(0, $result);
3033
$this->assertSame($expectedOutput, $tester->getDisplay());

0 commit comments

Comments
 (0)