You've already forked Php-Template
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 3m58s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Failing after 3m48s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 4m11s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 4m23s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 4m18s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 3m0s
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Siteworxpro\Tests;
|
|
|
|
use Illuminate\Container\Container;
|
|
use Mockery;
|
|
use PHPUnit\Framework\TestCase;
|
|
use Siteworx\Config\Config as SWConfig;
|
|
use Siteworxpro\App\Services\Facade;
|
|
use Siteworxpro\App\Services\Facades\Config;
|
|
|
|
abstract class Unit extends TestCase
|
|
{
|
|
protected function getContainer(): Container
|
|
{
|
|
$container = Facade::getFacadeContainer();
|
|
if ($container === null) {
|
|
$container = new Container();
|
|
Facade::setFacadeContainer($container);
|
|
|
|
return $container;
|
|
}
|
|
|
|
return $container;
|
|
}
|
|
|
|
/**
|
|
* @throws \ReflectionException
|
|
*/
|
|
protected function setUp(): void
|
|
{
|
|
$container = $this->getContainer();
|
|
|
|
$container->bind(SWConfig::class, function () {
|
|
return SWConfig::load(__DIR__ . '/../config.php');
|
|
});
|
|
}
|
|
|
|
protected function tearDown(): void
|
|
{
|
|
Config::clearResolvedInstances();
|
|
Facade::setFacadeContainer(null);
|
|
Mockery::close();
|
|
}
|
|
}
|