From d45dc2a40e9469c51367e60ffff06db93dcc541a Mon Sep 17 00:00:00 2001 From: Adam Kadlec Date: Mon, 25 Nov 2024 17:36:02 +0100 Subject: [PATCH] Fixing dependencies to make tools buildable and testable (#321) --- src/FastyBird/Core/Tools/composer.json | 1 + src/FastyBird/Core/Tools/package.json | 3 +++ src/FastyBird/Core/Tools/src/DI/ToolsExtension.php | 3 +-- .../Core/Tools/tests/cases/unit/BaseTestCase.php | 13 +------------ .../tests/cases/unit/DI/ToolsExtensionTest.php | 3 --- src/FastyBird/Core/Tools/tests/common.neon | 5 ++--- 6 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/FastyBird/Core/Tools/composer.json b/src/FastyBird/Core/Tools/composer.json index d8681838a..042c20f97 100644 --- a/src/FastyBird/Core/Tools/composer.json +++ b/src/FastyBird/Core/Tools/composer.json @@ -35,6 +35,7 @@ "contributte/monolog": "^0.5", "doctrine/orm": "2.15.*", "doctrine/persistence": "^2.5 || ^3.4", + "ipub/doctrine-timestampable": "^v2.0", "fastybird/datetime-factory": "^0.7.1", "fastybird/metadata-library": "dev-main", "mathsolver/mathsolver": "@dev", diff --git a/src/FastyBird/Core/Tools/package.json b/src/FastyBird/Core/Tools/package.json index 7ef7b095b..48091ae6a 100644 --- a/src/FastyBird/Core/Tools/package.json +++ b/src/FastyBird/Core/Tools/package.json @@ -72,6 +72,7 @@ "eslint-config-prettier": "^9.1", "eslint-plugin-prettier": "^5.2", "eslint-plugin-vue": "^9.31", + "pinia": "^2.2", "prettier": "^3.3", "rimraf": "^6.0", "rollup-plugin-delete": "^2.1", @@ -79,7 +80,9 @@ "vite": "^5.4", "vite-plugin-dts": "^4.3", "vue": "^3.5", + "vue-i18n": "^10.0", "vue-loader": "^17.4", + "vue-router": "^4.4", "vue-tsc": "^2.1" }, "engines": { diff --git a/src/FastyBird/Core/Tools/src/DI/ToolsExtension.php b/src/FastyBird/Core/Tools/src/DI/ToolsExtension.php index 51315e341..17f25f136 100644 --- a/src/FastyBird/Core/Tools/src/DI/ToolsExtension.php +++ b/src/FastyBird/Core/Tools/src/DI/ToolsExtension.php @@ -15,7 +15,6 @@ namespace FastyBird\Core\Tools\DI; -use FastyBird\Core\Application\Boot as ApplicationBoot; use FastyBird\Core\Tools\Helpers; use FastyBird\Core\Tools\Schemas; use FastyBird\Core\Tools\Utilities; @@ -46,7 +45,7 @@ class ToolsExtension extends DI\CompilerExtension public const NAME = 'fbTools'; public static function register( - ApplicationBoot\Configurator $config, + Bootstrap\Configurator $config, string $extensionName = self::NAME, ): void { diff --git a/src/FastyBird/Core/Tools/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Core/Tools/tests/cases/unit/BaseTestCase.php index ad17e3130..b3d60fad8 100644 --- a/src/FastyBird/Core/Tools/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Core/Tools/tests/cases/unit/BaseTestCase.php @@ -3,8 +3,6 @@ namespace FastyBird\Core\Tools\Tests\Cases\Unit; use Error; -use FastyBird\Core\Application\Boot as ApplicationBoot; -use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Core\Tools\DI; use Nette; use PHPUnit\Framework\TestCase; @@ -24,8 +22,6 @@ abstract class BaseTestCase extends TestCase protected array $neonFiles = []; /** - * @throws ApplicationExceptions\InvalidArgument - * @throws ApplicationExceptions\InvalidState * @throws Error */ protected function mockContainerService( @@ -42,8 +38,6 @@ protected function mockContainerService( } /** - * @throws ApplicationExceptions\InvalidArgument - * @throws ApplicationExceptions\InvalidState * @throws Error */ protected function getContainer(): Nette\DI\Container @@ -56,8 +50,6 @@ protected function getContainer(): Nette\DI\Container } /** - * @throws ApplicationExceptions\InvalidArgument - * @throws ApplicationExceptions\InvalidState * @throws Error */ private function createContainer(): Nette\DI\Container @@ -65,8 +57,7 @@ private function createContainer(): Nette\DI\Container $rootDir = __DIR__ . '/../..'; $vendorDir = defined('FB_VENDOR_DIR') ? constant('FB_VENDOR_DIR') : $rootDir . '/../vendor'; - $config = ApplicationBoot\Bootstrap::boot(); - $config->setForceReloadContainer(); + $config = new Nette\Bootstrap\Configurator(); $config->setTempDirectory(FB_TEMP_DIR); $config->addStaticParameters( @@ -90,8 +81,6 @@ private function createContainer(): Nette\DI\Container } /** - * @throws ApplicationExceptions\InvalidArgument - * @throws ApplicationExceptions\InvalidState * @throws Error */ private function replaceContainerService(string $serviceName, object $service): void diff --git a/src/FastyBird/Core/Tools/tests/cases/unit/DI/ToolsExtensionTest.php b/src/FastyBird/Core/Tools/tests/cases/unit/DI/ToolsExtensionTest.php index 524879661..c6d926695 100644 --- a/src/FastyBird/Core/Tools/tests/cases/unit/DI/ToolsExtensionTest.php +++ b/src/FastyBird/Core/Tools/tests/cases/unit/DI/ToolsExtensionTest.php @@ -3,7 +3,6 @@ namespace FastyBird\Core\Tools\Tests\Cases\Unit\DI; use Error; -use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Core\Tools\Helpers; use FastyBird\Core\Tools\Schemas; use FastyBird\Core\Tools\Tests; @@ -13,8 +12,6 @@ final class ToolsExtensionTest extends Tests\Cases\Unit\BaseTestCase { /** - * @throws ApplicationExceptions\InvalidArgument - * @throws ApplicationExceptions\InvalidState * @throws Error * @throws Nette\DI\MissingServiceException */ diff --git a/src/FastyBird/Core/Tools/tests/common.neon b/src/FastyBird/Core/Tools/tests/common.neon index 8cabea6ec..37529609c 100644 --- a/src/FastyBird/Core/Tools/tests/common.neon +++ b/src/FastyBird/Core/Tools/tests/common.neon @@ -13,6 +13,5 @@ php: date.timezone: Europe/Prague -fbApplication: - documents: - mapping: [] \ No newline at end of file +extensions: + fbDateTimeFactory : FastyBird\DateTimeFactory\DI\DateTimeFactoryExtension