Skip to content
Merged
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
6 changes: 4 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
# Remove files for archives generated using `git archive`
.phive export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
phpunit.xml.dist export-ignore
phpcs.xml.dist export-ignore
phpcs.xml export-ignore
.github export-ignore
phpstan.neon export-ignore
psalm.xml export-ignore
tests export-ignore
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://img.shields.io/github/actions/workflow/status/cakephp/plugin-installer/ci.yml?style=flat-square)](https://github.com/cakephp/plugin-installer/actions/workflows/ci.yml)
[![Latest Stable Version](https://img.shields.io/github/v/release/cakephp/plugin-installer?sort=semver&style=flat-square)](https://packagist.org/packages/cakephp/plugin-installer)
[![Total Downloads](https://img.shields.io/packagist/dt/cakephp/plugin-installer?style=flat-square)](https://packagist.org/packages/cakephp/plugin-installer/stats)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.txt)

A composer installer for installing CakePHP plugins.

Expand All @@ -16,7 +16,7 @@ Your CakePHP application should already depend on `cakephp/plugin-installer`, if
not in your CakePHP application run:

```
composer require cakephp/plugin-installer:*
composer require cakephp/plugin-installer
```

Your plugins themselves do **not** need to require `cakephp/plugin-installer`. They
Expand Down
12 changes: 10 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@
"name": "cakephp/plugin-installer",
"description": "A composer installer for CakePHP plugins.",
"type": "composer-plugin",
"keywords": [
"cakephp",
"plugin",
"installer",
"composer-plugin"
],
"license": "MIT",
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://cakephp.org"
}
],
"support": {
"issues": "https://github.com/cakephp/plugin-installer/issues",
"source": "https://github.com/cakephp/plugin-installer"
},
"require": {
"php": ">=8.1",
"composer-plugin-api": "^2.0"
Expand Down Expand Up @@ -47,8 +57,6 @@
"cs-fix": "phpcbf",
"phpstan": "tools/phpstan analyse",
"stan": "@phpstan",
"stan-tests": "phpstan.phar analyze -c tests/phpstan.neon",
"stan-baseline": "phpstan.phar --generate-baseline",
"stan-setup": "phive install",
"test": "phpunit"
}
Expand Down
15 changes: 5 additions & 10 deletions tests/TestCase/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Composer\Package\RootPackage;
use Composer\Repository\RepositoryManager;
use Composer\Script\Event;
use Composer\Util\Filesystem;
use Composer\Util\HttpDownloader;
use PHPUnit\Framework\TestCase;

Expand All @@ -21,7 +22,7 @@ class PluginTest extends TestCase
protected Package $package;

/**
* @var \Composer\IO\IOInterface&\PHPUnit\Framework\MockObject\MockObject
* @var \Composer\IO\IOInterface&\PHPUnit\Framework\MockObject\Stub
*/
protected $io;

Expand Down Expand Up @@ -60,7 +61,7 @@ public function setUp(): void
$this->package = new Package('cake/plugin', '1.0', '1.0');
$this->package->setType('cakephp-plugin');

$this->path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'plugin-installer-test';
$this->path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'plugin-installer-test-' . bin2hex(random_bytes(4));

foreach ($this->testDirs as $dir) {
if (!is_dir($this->path . '/' . $dir)) {
Expand All @@ -78,9 +79,7 @@ public function setUp(): void

$this->composer->setConfig($config);

/** @var \Composer\IO\IOInterface&\PHPUnit\Framework\MockObject\MockObject $io */
$io = $this->getMockBuilder(IOInterface::class)->getMock();
$this->io = $io;
$this->io = $this->createStub(IOInterface::class);

$httpDownloader = new HttpDownloader($this->io, $config);

Expand All @@ -98,11 +97,7 @@ public function tearDown(): void
{
parent::tearDown();

if (PHP_OS === 'Windows') {
exec(sprintf('rd /s /q %s', escapeshellarg($this->path)));
} else {
exec(sprintf('rm -rf %s', escapeshellarg($this->path)));
}
(new Filesystem())->removeDirectory($this->path);
}

public function testGetSubscribedEvents()
Expand Down
Loading