2021-11-25 01:25:43 +08:00
|
|
|
<?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.
|
|
|
|
*/
|
|
|
|
|
2024-01-23 01:58:08 +08:00
|
|
|
namespace Flarum\ExtensionManager\Tests\integration;
|
2021-11-25 01:25:43 +08:00
|
|
|
|
|
|
|
trait DummyExtensions
|
|
|
|
{
|
|
|
|
protected function makeDummyExtensionCompatibleWith(string $name, string $coreVersions): void
|
|
|
|
{
|
2022-03-12 07:11:20 +08:00
|
|
|
$dirName = $this->tmpDir().'/packages/'.str_replace('/', '-', $name);
|
2021-11-25 01:25:43 +08:00
|
|
|
|
|
|
|
if (! file_exists($dirName)) {
|
|
|
|
mkdir($dirName);
|
|
|
|
}
|
|
|
|
|
2022-03-12 07:11:20 +08:00
|
|
|
file_put_contents($dirName.'/composer.json', json_encode([
|
2021-11-25 01:25:43 +08:00
|
|
|
'name' => $name,
|
|
|
|
'version' => '1.0.0',
|
|
|
|
'require' => [
|
|
|
|
'flarum/core' => $coreVersions
|
|
|
|
],
|
|
|
|
], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
|
|
|
|
}
|
|
|
|
}
|