Skip to content

Commit

Permalink
Merge pull request #31 from stof/patch-1
Browse files Browse the repository at this point in the history
Remove double registration of the event listeners
  • Loading branch information
Ocramius authored Jul 22, 2016
2 parents b300ac2 + 7dea49e commit 74322cb
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 74322cb

Please sign in to comment.