2023-09-19 00:13:36 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Unit\Plugin;
|
|
|
|
|
|
|
|
use Tests\TestCase;
|
2023-09-19 20:06:41 +02:00
|
|
|
use Plugins\Test\ServiceProvider;
|
2023-09-19 00:13:36 +02:00
|
|
|
|
|
|
|
class PluginTest extends TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{}
|
|
|
|
|
|
|
|
public function testItCanRegisterAPlugin(): void
|
|
|
|
{
|
|
|
|
$pluginsPath = __DIR__.'/../../../plugins/Test';
|
2023-09-19 19:56:19 +02:00
|
|
|
@mkdir($pluginsPath, 0755, true);
|
2023-09-19 00:13:36 +02:00
|
|
|
|
|
|
|
file_put_contents($pluginsPath.'/ServiceProvider.php', '<?php
|
|
|
|
namespace Plugins\Test;
|
|
|
|
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
|
|
|
|
class ServiceProvider extends BaseServiceProvider
|
|
|
|
{
|
|
|
|
public function register() {}
|
|
|
|
public function boot() {}
|
|
|
|
}');
|
|
|
|
|
|
|
|
|
|
|
|
parent::setUp();
|
|
|
|
|
2023-09-19 20:06:41 +02:00
|
|
|
$this->assertInstanceOf(ServiceProvider::class, app()->getProvider('Plugins\\Test\\ServiceProvider'));
|
2023-09-19 00:13:36 +02:00
|
|
|
|
|
|
|
array_map(fn ($file) => unlink($file), glob($pluginsPath.'/*'));
|
|
|
|
rmdir($pluginsPath);
|
2023-09-19 19:57:40 +02:00
|
|
|
rmdir(dirname($pluginsPath));
|
2023-09-19 00:13:36 +02:00
|
|
|
}
|
|
|
|
}
|