mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 16:55:38 +08:00
Introduce AttributeMapper for managing extensions and doctor attributes
This commit is contained in:
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\Tests\builder;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SPC\builder\BuilderBase;
|
||||
use SPC\builder\BuilderProvider;
|
||||
@@ -14,7 +13,7 @@ use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\store\LockFile;
|
||||
use SPC\util\CustomExt;
|
||||
use SPC\util\AttributeMapper;
|
||||
use SPC\util\DependencyUtil;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
@@ -36,9 +35,8 @@ class BuilderTest extends TestCase
|
||||
$this->builder = BuilderProvider::makeBuilderByInput(new ArgvInput());
|
||||
[$extensions, $libs] = DependencyUtil::getExtsAndLibs(['mbregex']);
|
||||
$this->builder->proveLibs($libs);
|
||||
CustomExt::loadCustomExt();
|
||||
foreach ($extensions as $extension) {
|
||||
$class = CustomExt::getExtClass($extension);
|
||||
$class = AttributeMapper::getExtensionClassByName($extension) ?? Extension::class;
|
||||
$ext = new $class($extension, $this->builder);
|
||||
$this->builder->addExt($ext);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace SPC\Tests\builder;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SPC\builder\BuilderProvider;
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
use SPC\util\AttributeMapper;
|
||||
use SPC\util\DependencyUtil;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
@@ -23,9 +23,8 @@ class ExtensionTest extends TestCase
|
||||
$builder = BuilderProvider::makeBuilderByInput(new ArgvInput());
|
||||
[$extensions, $libs] = DependencyUtil::getExtsAndLibs(['mbregex']);
|
||||
$builder->proveLibs($libs);
|
||||
CustomExt::loadCustomExt();
|
||||
foreach ($extensions as $extension) {
|
||||
$class = CustomExt::getExtClass($extension);
|
||||
$class = AttributeMapper::getExtensionClassByName($extension) ?? Extension::class;
|
||||
$ext = new $class($extension, $builder);
|
||||
$builder->addExt($ext);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace SPC\Tests\doctor;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SPC\doctor\CheckListHandler;
|
||||
use SPC\doctor\DoctorHandler;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -14,9 +14,9 @@ final class CheckListHandlerTest extends TestCase
|
||||
{
|
||||
public function testRunChecksReturnsListOfCheck(): void
|
||||
{
|
||||
$list = new CheckListHandler();
|
||||
$list = new DoctorHandler();
|
||||
|
||||
$id = $list->runChecks();
|
||||
$id = $list->getValidCheckList();
|
||||
foreach ($id as $item) {
|
||||
$this->assertInstanceOf('SPC\doctor\AsCheckItem', $item);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ declare(strict_types=1);
|
||||
namespace SPC\Tests\store;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,3 +4,5 @@ declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../src/globals/internal-env.php';
|
||||
require_once __DIR__ . '/mock/SPC_store.php';
|
||||
|
||||
\SPC\util\AttributeMapper::init();
|
||||
|
||||
Reference in New Issue
Block a user