Skip to content

Commit

Permalink
Remove double registration of the event listeners
Browse files Browse the repository at this point in the history
Composer already registers listeners when the plugin class implements EventSubscriberInterface
  • Loading branch information
stof committed Jul 22, 2016
1 parent b300ac2 commit 7dea49e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/PackageVersions/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function getVersion(string $packageName) : string
*/
public function activate(Composer $composer, IOInterface $io)
{
$composer->getEventDispatcher()->addSubscriber($this);
// Nothing to do here, as all features are provided through event listeners
}

/**
Expand Down
11 changes: 2 additions & 9 deletions test/PackageVersionsTest/InstallerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class InstallerTest extends PHPUnit_Framework_TestCase

/**
* {@inheritDoc}
*
*
* @throws \PHPUnit_Framework_Exception
*/
protected function setUp()
Expand All @@ -59,13 +59,6 @@ protected function setUp()
$this->composer->expects(self::any())->method('getEventDispatcher')->willReturn($this->eventDispatcher);
}

public function testActivate()
{
$this->eventDispatcher->expects(self::once())->method('addSubscriber')->with($this->installer);

$this->installer->activate($this->composer, $this->io);
}

public function testGetSubscribedEvents()
{
$events = Installer::getSubscribedEvents();
Expand Down Expand Up @@ -299,7 +292,7 @@ public static function getVersion(string $packageName) : string

/**
* @group #12
*
*
* @throws \RuntimeException
*/
public function testDumpVersionsWithoutPackageSourceDetails()
Expand Down

0 comments on commit 7dea49e

Please sign in to comment.