mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 08:13:39 +08:00
33 lines
833 B
PHP
33 lines
833 B
PHP
|
<?php
|
||
|
|
||
|
/*
|
||
|
* This file is part of Flarum.
|
||
|
*
|
||
|
* For detailed copyright and license information, please view the
|
||
|
* LICENSE file that was distributed with this source code.
|
||
|
*/
|
||
|
|
||
|
namespace Flarum\PackageManager\Tests\integration;
|
||
|
|
||
|
use Flarum\Foundation\Paths;
|
||
|
|
||
|
trait DummyExtensions
|
||
|
{
|
||
|
protected function makeDummyExtensionCompatibleWith(string $name, string $coreVersions): void
|
||
|
{
|
||
|
$dirName = $this->tmpDir() . "/packages/" . str_replace('/', '-', $name);
|
||
|
|
||
|
if (! file_exists($dirName)) {
|
||
|
mkdir($dirName);
|
||
|
}
|
||
|
|
||
|
file_put_contents($dirName."/composer.json", json_encode([
|
||
|
'name' => $name,
|
||
|
'version' => '1.0.0',
|
||
|
'require' => [
|
||
|
'flarum/core' => $coreVersions
|
||
|
],
|
||
|
], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
|
||
|
}
|
||
|
}
|