public function test_events_are_handled()
{
$plugin = new ChangelogsPlugin();
$plugin->activate($this->composer, $this->io);
$operation = $this->getUpdateOperation();
$packageEvent = new PackageEvent(PackageEvents::POST_PACKAGE_UPDATE, $this->composer, $this->io, false, new DefaultPolicy(false, false), new Pool(), new CompositeRepository([]), new Request(new Pool()), [$operation], $operation);
$plugin->postPackageOperation($packageEvent);
$postUpdateEvent = new Event(ScriptEvents::POST_UPDATE_CMD, $this->composer, $this->io);
$plugin->postUpdate($postUpdateEvent);
$expectedOutput = <<<OUTPUT
Changelogs summary:
- foo/bar updated from v1.0.0 to v1.0.1
See changes: https://github.com/foo/bar/compare/v1.0.0...v1.0.1
Release notes: https://github.com/foo/bar/releases/tag/v1.0.1
OUTPUT;
$this->assertSame($expectedOutput, $this->io->getOutput());
}