-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
58 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace IonBazan\ComposerDiff\Command; | ||
|
||
use Composer\Composer; | ||
use Composer\Plugin\Capability\CommandProvider as BaseCommandProvider; | ||
use IonBazan\ComposerDiff\PackageDiff; | ||
|
||
class CommandProvider implements BaseCommandProvider | ||
{ | ||
/** | ||
* @var Composer | ||
*/ | ||
private $composer; | ||
|
||
/** | ||
* @param array{composer:Composer} $args | ||
*/ | ||
public function __construct(array $args) | ||
{ | ||
$this->composer = $args['composer']; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getCommands() | ||
{ | ||
return array(new DiffCommand(new PackageDiff(), $this->composer->getConfig()->get('gitlab-domains'))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace IonBazan\ComposerDiff\Tests\Command; | ||
|
||
use IonBazan\ComposerDiff\Command\CommandProvider; | ||
use IonBazan\ComposerDiff\Command\DiffCommand; | ||
use IonBazan\ComposerDiff\PackageDiff; | ||
use IonBazan\ComposerDiff\Tests\TestCase; | ||
|
||
class CommandProviderTest extends TestCase | ||
{ | ||
public function testProvider() | ||
{ | ||
$composer = $this->getMockBuilder('Composer\Composer')->getMock(); | ||
$config = $this->getMockBuilder('Composer\Config')->disableOriginalConstructor()->getMock(); | ||
$config->expects($this->once()) | ||
->method('get') | ||
->with('gitlab-domains') | ||
->willReturn(array()); | ||
$composer->expects($this->once())->method('getConfig')->willReturn($config); | ||
$provider = new CommandProvider(array('composer' => $composer)); | ||
$this->assertEquals(array(new DiffCommand(new PackageDiff())), $provider->getCommands()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters