adrema/tests/Unit/Plugin/PluginTest.php

37 lines
956 B
PHP
Raw Normal View History

2023-09-19 00:13:36 +02:00
<?php
namespace Tests\Unit\Plugin;
use Tests\TestCase;
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();
$this->assertInstanceOf('Plugins\\Test\\ServiceProvider', app()->getProvider('Plugins\\Test\\ServiceProvider'));
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
}
}