Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
- hhvm

matrix:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"source": "https://github.com/BernardoSilva/git-hooks-installer-plugin"
},
"require": {
"composer-plugin-api": "^1.0",
"composer-plugin-api": "^2.0",
"symfony/process": ">=2.3"
},
"require-dev": {
"composer/composer": "~1.0@dev",
"composer/composer": "~2.0@dev",
"phpunit/phpunit": "^4.8",
"squizlabs/php_codesniffer": "^2.0"
},
Expand Down
8 changes: 8 additions & 0 deletions src/GitHooksInstallerPlugin/Composer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@ public function activate(Composer $composer, IOInterface $io)
$installer = new Installer($io, $composer);
$composer->getInstallationManager()->addInstaller($installer);
}

public function deactivate(Composer $composer, IOInterface $io)
{
}

public function uninstall(Composer $composer, IOInterface $io)
{
}
}
16 changes: 14 additions & 2 deletions tests/unit/GitHooksInstallerPlugin/Composer/InstallerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use Composer\Package\Package;
use Composer\Util\Filesystem;
use Composer\TestCase;
use Composer\Composer;
use Composer\Config;
use Composer\Package\RootPackage;
use PHPUnit\Framework\TestCase;

class InstallerTest extends TestCase
{
Expand All @@ -22,7 +22,7 @@ class InstallerTest extends TestCase
protected $package;
protected function setUp()
{
$this->fs = new Filesystem;
$this->fs = new Filesystem();
$this->composer = new Composer();
$this->config = new Config();
$this->composer->setConfig($this->config);
Expand Down Expand Up @@ -51,6 +51,18 @@ protected function setUp()
);
$this->io = $this->getMock('Composer\IO\IOInterface');
}

private function ensureDirectoryExistsAndClear($directory)
{
$fs = new Filesystem();

if (is_dir($directory)) {
$fs->removeDirectory($directory);
}

mkdir($directory, 0777, true);
}

protected function tearDown()
{
$this->fs->removeDirectory($this->vendorDir);
Expand Down
11 changes: 8 additions & 3 deletions tests/unit/GitHooksInstallerPlugin/Composer/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
namespace BernardoSilva\GitHooksInstallerPlugin\Composer;

use Composer\Installer\InstallationManager;
use Composer\TestCase;
use Composer\Composer;
use Composer\Config;
use Composer\IO\IOInterface;
use Composer\Util\Loop;
use PHPUnit\Framework\TestCase;

class PluginTest extends TestCase
{
Expand All @@ -21,8 +23,11 @@ protected function setUp()
$this->composer = new Composer();
$this->config = new Config();
$this->composer->setConfig($this->config);
$this->composer->setInstallationManager(new InstallationManager());
$this->io = $this->getMock('Composer\IO\IOInterface');

$loop = $this->getMockBuilder(Loop::class)->disableOriginalConstructor()->getMock();
$this->io = $this->getMock(IOInterface::class);

$this->composer->setInstallationManager(new InstallationManager($loop, $this->io));
}

public function testActivateAddsInstallerSuccessfully()
Expand Down