From f124ad7c5ffde47f15608c1f1f922a5e48659fa7 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:45:26 -0400 Subject: [PATCH] Initial commit. (#1) --- README.md | 14 +-- composer.json | 28 ++++-- config/common/param/yiisoft-aliases.php | 20 +++++ package.json | 17 ++++ phpunit.xml.dist | 2 +- src/Example.php | 13 --- src/FilePond.php | 40 +++++++++ src/FilePondCdn.php | 28 ++++++ src/FilePondImagePreviewPlugin.php | 32 +++++++ src/FilePondImagePreviewPluginCdn.php | 18 ++++ src/FilePondImagePreviewPluginProd.php | 32 +++++++ src/FilePondPdfPreviewPlugin.php | 29 +++++++ src/FilePondPdfPreviewPluginCdn.php | 18 ++++ src/FilePondPdfPreviewPluginProd.php | 32 +++++++ src/FilePondProd.php | 40 +++++++++ src/Js/FilePondEncodePlugin.php | 28 ++++++ src/Js/FilePondEncodePluginCdn.php | 17 ++++ src/Js/FilePondEncodePluginProd.php | 28 ++++++ src/Js/FilePondImageCropPlugin.php | 28 ++++++ src/Js/FilePondImageCropPluginCdn.php | 17 ++++ src/Js/FilePondImageCropPluginProd.php | 28 ++++++ src/Js/FilePondImageExifOrientationPlugin.php | 28 ++++++ .../FilePondImageExifOrientationPluginCdn.php | 19 ++++ ...FilePondImageExifOrientationPluginProd.php | 28 ++++++ src/Js/FilePondImageTransformPlugin.php | 28 ++++++ src/Js/FilePondImageTransformPluginCdn.php | 19 ++++ src/Js/FilePondImageTransformPluginProd.php | 28 ++++++ src/Js/FilePondRenamePlugin.php | 28 ++++++ src/Js/FilePondRenamePluginCdn.php | 17 ++++ src/Js/FilePondRenamePluginProd.php | 28 ++++++ src/Js/FilePondValidateSizePlugin.php | 28 ++++++ src/Js/FilePondValidateSizePluginCdn.php | 19 ++++ src/Js/FilePondValidateSizePluginProd.php | 28 ++++++ src/Js/FilePondValidateTypePlugin.php | 28 ++++++ src/Js/FilePondValidateTypePluginCdn.php | 17 ++++ src/Js/FilePondValidateTypePluginProd.php | 28 ++++++ tests/CdnAssetTest.php | 52 +++++++++++ tests/ExampleTest.php | 18 ---- tests/NpmAssetTest.php | 87 +++++++++++++++++++ tests/Provider/CdnAssetProvider.php | 31 +++++++ tests/Provider/NpmAssetProvider.php | 41 +++++++++ tests/Support/TestTrait.php | 74 ++++++++++++++++ tests/Support/runtime/.gitignore | 0 43 files changed, 1137 insertions(+), 46 deletions(-) create mode 100644 config/common/param/yiisoft-aliases.php create mode 100644 package.json delete mode 100644 src/Example.php create mode 100644 src/FilePond.php create mode 100644 src/FilePondCdn.php create mode 100644 src/FilePondImagePreviewPlugin.php create mode 100644 src/FilePondImagePreviewPluginCdn.php create mode 100644 src/FilePondImagePreviewPluginProd.php create mode 100644 src/FilePondPdfPreviewPlugin.php create mode 100644 src/FilePondPdfPreviewPluginCdn.php create mode 100644 src/FilePondPdfPreviewPluginProd.php create mode 100644 src/FilePondProd.php create mode 100644 src/Js/FilePondEncodePlugin.php create mode 100644 src/Js/FilePondEncodePluginCdn.php create mode 100644 src/Js/FilePondEncodePluginProd.php create mode 100644 src/Js/FilePondImageCropPlugin.php create mode 100644 src/Js/FilePondImageCropPluginCdn.php create mode 100644 src/Js/FilePondImageCropPluginProd.php create mode 100644 src/Js/FilePondImageExifOrientationPlugin.php create mode 100644 src/Js/FilePondImageExifOrientationPluginCdn.php create mode 100644 src/Js/FilePondImageExifOrientationPluginProd.php create mode 100644 src/Js/FilePondImageTransformPlugin.php create mode 100644 src/Js/FilePondImageTransformPluginCdn.php create mode 100644 src/Js/FilePondImageTransformPluginProd.php create mode 100644 src/Js/FilePondRenamePlugin.php create mode 100644 src/Js/FilePondRenamePluginCdn.php create mode 100644 src/Js/FilePondRenamePluginProd.php create mode 100644 src/Js/FilePondValidateSizePlugin.php create mode 100644 src/Js/FilePondValidateSizePluginCdn.php create mode 100644 src/Js/FilePondValidateSizePluginProd.php create mode 100644 src/Js/FilePondValidateTypePlugin.php create mode 100644 src/Js/FilePondValidateTypePluginCdn.php create mode 100644 src/Js/FilePondValidateTypePluginProd.php create mode 100644 tests/CdnAssetTest.php delete mode 100644 tests/ExampleTest.php create mode 100644 tests/NpmAssetTest.php create mode 100644 tests/Provider/CdnAssetProvider.php create mode 100644 tests/Provider/NpmAssetProvider.php create mode 100644 tests/Support/TestTrait.php create mode 100644 tests/Support/runtime/.gitignore diff --git a/README.md b/README.md index 4a0e65d..889fe6a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- +

Template.

@@ -22,12 +22,12 @@ For install this package, you need [composer](https://getcomposer.org/). ## CI status -[![build](https://github.com/yii-tools/template/actions/workflows/build.yml/badge.svg)](https://github.com/yii-tools/template/actions/workflows/build.yml) -[![codecov](https://codecov.io/gh/yii-tools/template/branch/main/graph/badge.svg?token=MF0XUGVLYC)](https://codecov.io/gh/yii-tools/template) -[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyii-tools%2Ftemplate%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/yii-tools/template/main) -[![static analysis](https://github.com/yii-tools/template/actions/workflows/static.yml/badge.svg)](https://github.com/yii-tools/template/actions/workflows/static.yml) -[![type-coverage](https://shepherd.dev/github/yii-tools/template/coverage.svg)](https://shepherd.dev/github/yii-tools/template) -[![StyleCI](https://github.styleci.io/repos/494495136/shield?branch=main)](https://github.styleci.io/repos/494495136?branch=main) +[![build](https://github.com/yii-tools/filepond-asset/actions/workflows/build.yml/badge.svg)](https://github.com/yii-tools/filepond-asset/actions/workflows/build.yml) +[![codecov](https://codecov.io/gh/yii-tools/filepond-asset/branch/main/graph/badge.svg?token=MF0XUGVLYC)](https://codecov.io/gh/yii-tools/filepond-asset) +[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyii-tools%2Ffilepond-asset%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/yii-tools/filepond-asset/main) +[![static analysis](https://github.com/yii-tools/filepond-asset/actions/workflows/static.yml/badge.svg)](https://github.com/yii-tools/filepond-asset/actions/workflows/static.yml) +[![type-coverage](https://shepherd.dev/github/yii-tools/filepond-asset/coverage.svg)](https://shepherd.dev/github/yii-tools/filepond-asset) +[![StyleCI](https://github.styleci.io/repos/661366645/shield?branch=main)](https://github.styleci.io/repos/661366645?branch=main) ## Our social networks diff --git a/composer.json b/composer.json index 57e194a..c3294d8 100644 --- a/composer.json +++ b/composer.json @@ -1,41 +1,55 @@ { - "name": "yii-tools/template", + "name": "yii-tools/filepond-asset", "type": "library", - "description": "_____", + "description": "Filepond Asset for YiiFramework v.3.0.", "keywords": [ - "_____" + "yii-tools", + "asset", + "filepond", + "yii3" ], "license": "mit", "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "^8.1" + "php": "^8.1", + "foxy/foxy": "^1.3", + "yiisoft/assets": "^4.0", + "yiisoft/files":"^2.0" }, "require-dev": { "maglnet/composer-require-checker": "^4.6", + "php-forge/support": "^1.0@dev", "phpunit/phpunit": "^10.2", "roave/infection-static-analysis-plugin": "^1.32", "vimeo/psalm": "^5.1" }, "autoload": { "psr-4": { - "Template\\": "src" + "Yii\\Assets\\": "src" } }, "autoload-dev": { "psr-4": { - "Template\\Tests\\": "tests" + "Yii\\Assets\\Tests\\": "tests" } }, "extra": { "branch-alias": { "dev-main": "1.0.x-dev" + }, + "config-plugin-options": { + "source-directory": "config" + }, + "config-plugin": { + "params": "common/param/*.php" } }, "config": { "sort-packages": true, "allow-plugins": { - "infection/extension-installer": true + "infection/extension-installer": true, + "foxy/foxy": true } }, "scripts": { diff --git a/config/common/param/yiisoft-aliases.php b/config/common/param/yiisoft-aliases.php new file mode 100644 index 0000000..8a7e803 --- /dev/null +++ b/config/common/param/yiisoft-aliases.php @@ -0,0 +1,20 @@ + [ + 'aliases' => [ + '@filepond-asset' => '@npm/filepond/dist', + '@filepond-file-encode-plugin' => '@npm/filepond-plugin-file-encode/dist', + '@filepond-file-rename-plugin' => '@npm/filepond-plugin-file-rename/dist', + '@filepond-file-validate-size-plugin' => '@npm/filepond-plugin-file-validate-size/dist', + '@filepond-file-validate-type-plugin' => '@npm/filepond-plugin-file-validate-type/dist', + '@filepond-file-image-crop-plugin' => '@npm/filepond-plugin-image-crop/dist', + '@filepond-image-exif-orientation-plugin' => '@npm/filepond-plugin-image-exif-orientation/dist', + '@filepond-image-preview-plugin' => '@npm/filepond-plugin-image-preview/dist', + '@filepond-image-transform-plugin' => '@npm/filepond-plugin-image-transform/dist', + '@filepond-pdf-preview-plugin' => '@npm/filepond-plugin-pdf-preview/dist', + ], + ], +]; diff --git a/package.json b/package.json new file mode 100644 index 0000000..cf4b745 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "filepond-asset", + "version": "1.0.0", + "dependencies": { + "filepond": "^4.30.4", + "filepond-plugin-file-encode": "^2.1.10", + "filepond-plugin-file-rename": "^1.1.8", + "filepond-plugin-file-validate-size": "^2.2.8", + "filepond-plugin-file-validate-type": "^1.2.8", + "filepond-plugin-image-crop": "^2.0.6", + "filepond-plugin-image-exif-orientation": "^1.0.11", + "filepond-plugin-image-preview": "^4.6.11", + "filepond-plugin-image-transform": "^3.8.7", + "filepond-plugin-pdf-preview": "^1.0.4" + }, + "license": "mit" +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f29a28d..5102fe5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,7 +11,7 @@ stopOnFailure="false" > - + tests diff --git a/src/Example.php b/src/Example.php deleted file mode 100644 index 4dfa14e..0000000 --- a/src/Example.php +++ /dev/null @@ -1,13 +0,0 @@ -publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond.css', '**/filepond.js'), + ]; + } +} diff --git a/src/FilePondCdn.php b/src/FilePondCdn.php new file mode 100644 index 0000000..2ef5d26 --- /dev/null +++ b/src/FilePondCdn.php @@ -0,0 +1,28 @@ +publishOptions = [ + 'filter' => $pathMatcher->only( + '**/filepond-plugin-image-preview.css', + '**/filepond-plugin-image-preview.js', + ), + ]; + } +} diff --git a/src/FilePondImagePreviewPluginCdn.php b/src/FilePondImagePreviewPluginCdn.php new file mode 100644 index 0000000..d00fb74 --- /dev/null +++ b/src/FilePondImagePreviewPluginCdn.php @@ -0,0 +1,18 @@ +publishOptions = [ + 'filter' => $pathMatcher->only( + '**/filepond-plugin-image-preview.min.css', + '**/filepond-plugin-image-preview.min.js', + ), + ]; + } +} diff --git a/src/FilePondPdfPreviewPlugin.php b/src/FilePondPdfPreviewPlugin.php new file mode 100644 index 0000000..3defab4 --- /dev/null +++ b/src/FilePondPdfPreviewPlugin.php @@ -0,0 +1,29 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-pdf-preview.css', '**/filepond-plugin-pdf-preview.js'), + ]; + } +} diff --git a/src/FilePondPdfPreviewPluginCdn.php b/src/FilePondPdfPreviewPluginCdn.php new file mode 100644 index 0000000..97cf49b --- /dev/null +++ b/src/FilePondPdfPreviewPluginCdn.php @@ -0,0 +1,18 @@ +publishOptions = [ + 'filter' => $pathMatcher->only( + '**/filepond-plugin-pdf-preview.min.css', + '**/filepond-plugin-pdf-preview.min.js', + ), + ]; + } +} diff --git a/src/FilePondProd.php b/src/FilePondProd.php new file mode 100644 index 0000000..73eeb16 --- /dev/null +++ b/src/FilePondProd.php @@ -0,0 +1,40 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond.min.css', '**/filepond.min.js'), + ]; + } +} diff --git a/src/Js/FilePondEncodePlugin.php b/src/Js/FilePondEncodePlugin.php new file mode 100644 index 0000000..654886e --- /dev/null +++ b/src/Js/FilePondEncodePlugin.php @@ -0,0 +1,28 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-file-encode.js'), + ]; + } +} diff --git a/src/Js/FilePondEncodePluginCdn.php b/src/Js/FilePondEncodePluginCdn.php new file mode 100644 index 0000000..cd306d7 --- /dev/null +++ b/src/Js/FilePondEncodePluginCdn.php @@ -0,0 +1,17 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-file-encode.min.js'), + ]; + } +} diff --git a/src/Js/FilePondImageCropPlugin.php b/src/Js/FilePondImageCropPlugin.php new file mode 100644 index 0000000..e7cdc7f --- /dev/null +++ b/src/Js/FilePondImageCropPlugin.php @@ -0,0 +1,28 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-image-crop.js'), + ]; + } +} diff --git a/src/Js/FilePondImageCropPluginCdn.php b/src/Js/FilePondImageCropPluginCdn.php new file mode 100644 index 0000000..8c8dcd5 --- /dev/null +++ b/src/Js/FilePondImageCropPluginCdn.php @@ -0,0 +1,17 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-image-crop.min.js'), + ]; + } +} diff --git a/src/Js/FilePondImageExifOrientationPlugin.php b/src/Js/FilePondImageExifOrientationPlugin.php new file mode 100644 index 0000000..876cd91 --- /dev/null +++ b/src/Js/FilePondImageExifOrientationPlugin.php @@ -0,0 +1,28 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-image-exif-orientation.js'), + ]; + } +} diff --git a/src/Js/FilePondImageExifOrientationPluginCdn.php b/src/Js/FilePondImageExifOrientationPluginCdn.php new file mode 100644 index 0000000..38e4b3b --- /dev/null +++ b/src/Js/FilePondImageExifOrientationPluginCdn.php @@ -0,0 +1,19 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-image-exif-orientation.min.js'), + ]; + } +} diff --git a/src/Js/FilePondImageTransformPlugin.php b/src/Js/FilePondImageTransformPlugin.php new file mode 100644 index 0000000..e3b1c31 --- /dev/null +++ b/src/Js/FilePondImageTransformPlugin.php @@ -0,0 +1,28 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-image-transform.js'), + ]; + } +} diff --git a/src/Js/FilePondImageTransformPluginCdn.php b/src/Js/FilePondImageTransformPluginCdn.php new file mode 100644 index 0000000..35238d9 --- /dev/null +++ b/src/Js/FilePondImageTransformPluginCdn.php @@ -0,0 +1,19 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**filepond-plugin-image-transform.min.js'), + ]; + } +} diff --git a/src/Js/FilePondRenamePlugin.php b/src/Js/FilePondRenamePlugin.php new file mode 100644 index 0000000..e6834ee --- /dev/null +++ b/src/Js/FilePondRenamePlugin.php @@ -0,0 +1,28 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-file-rename.js'), + ]; + } +} diff --git a/src/Js/FilePondRenamePluginCdn.php b/src/Js/FilePondRenamePluginCdn.php new file mode 100644 index 0000000..f855f55 --- /dev/null +++ b/src/Js/FilePondRenamePluginCdn.php @@ -0,0 +1,17 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-file-rename.min.js'), + ]; + } +} diff --git a/src/Js/FilePondValidateSizePlugin.php b/src/Js/FilePondValidateSizePlugin.php new file mode 100644 index 0000000..35338da --- /dev/null +++ b/src/Js/FilePondValidateSizePlugin.php @@ -0,0 +1,28 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-file-validate-size.js'), + ]; + } +} diff --git a/src/Js/FilePondValidateSizePluginCdn.php b/src/Js/FilePondValidateSizePluginCdn.php new file mode 100644 index 0000000..9fc42bb --- /dev/null +++ b/src/Js/FilePondValidateSizePluginCdn.php @@ -0,0 +1,19 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-file-validate-size.min.js'), + ]; + } +} diff --git a/src/Js/FilePondValidateTypePlugin.php b/src/Js/FilePondValidateTypePlugin.php new file mode 100644 index 0000000..2da8fc3 --- /dev/null +++ b/src/Js/FilePondValidateTypePlugin.php @@ -0,0 +1,28 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-file-validate-type.js'), + ]; + } +} diff --git a/src/Js/FilePondValidateTypePluginCdn.php b/src/Js/FilePondValidateTypePluginCdn.php new file mode 100644 index 0000000..b869cb8 --- /dev/null +++ b/src/Js/FilePondValidateTypePluginCdn.php @@ -0,0 +1,17 @@ +publishOptions = [ + 'filter' => $pathMatcher->only('**/filepond-plugin-file-validate-type.min.js'), + ]; + } +} diff --git a/tests/CdnAssetTest.php b/tests/CdnAssetTest.php new file mode 100644 index 0000000..f3dcc77 --- /dev/null +++ b/tests/CdnAssetTest.php @@ -0,0 +1,52 @@ +assetManager->registerMany([$cdnBundle]); + + if ($type === 'Css' && isset($bundle->css[0])) { + $this->assertSame($bundle->css[0], $this->assetManager->getCssFiles()[$bundle->css[0]][0]); + } + + if ($type === 'Css' && $cdnDepend !== null && isset($depend->css[0])) { + $this->assertSame($depend->css[0], $this->assetManager->getCssFiles()[$depend->css[0]][0]); + } + + if ($type === 'Js' && isset($bundle->js[0])) { + $this->assertEquals($bundle->js[0], $this->assetManager->getJsFiles()[$bundle->js[0]][0]); + } + + if ($type === 'Js' && $cdnDepend !== null && isset($depend->js[0])) { + $this->assertEquals($depend->js[0], $this->assetManager->getJsFiles()[$depend->js[0]][0]); + } + } +} diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php deleted file mode 100644 index 4e7a602..0000000 --- a/tests/ExampleTest.php +++ /dev/null @@ -1,18 +0,0 @@ -assertTrue($example->getExample()); - } -} diff --git a/tests/NpmAssetTest.php b/tests/NpmAssetTest.php new file mode 100644 index 0000000..429cb8f --- /dev/null +++ b/tests/NpmAssetTest.php @@ -0,0 +1,87 @@ +assetManager->registerMany([$assetBundle]); + + if ($type === 'Css' && is_string($bundle->sourcePath) && isset($bundle->css[0])) { + $getPublishedUrl = $this->assetPublisher->getPublishedUrl($bundle->sourcePath); + /** @psalm-var string|null $css */ + $css = $bundle->css[0]; + + if ($getPublishedUrl !== null && $css !== null) { + $bundleUrl = $getPublishedUrl . '/' . $css; + + $this->assertTrue($bundle->publishOptions['filter']->match('**/' . $bundle->css[0])); + $this->assertSame($bundleUrl, $this->assetManager->getCssFiles()[$bundleUrl][0]); + } + } + + if ($type === 'Css' && $depend !== null && is_string($depend->sourcePath) && isset($depend->css[0])) { + $getPublishedUrl = $this->assetPublisher->getPublishedUrl($depend->sourcePath); + /** @psalm-var string|null $css */ + $css = $depend->css[0]; + + if ($getPublishedUrl !== null && $css !== null) { + $dependUrl = $getPublishedUrl . '/' . $css; + + $this->assertTrue($depend->publishOptions['filter']->match('**/' . $depend->css[0])); + $this->assertSame($dependUrl, $this->assetManager->getCssFiles()[$dependUrl][0]); + } + } + + if ($type === 'Js' && $depend !== null && is_string($depend->sourcePath) && isset($depend->js[0])) { + $getPublishedUrl = $this->assetPublisher->getPublishedUrl($depend->sourcePath); + /** @psalm-var string|null $js */ + $js = $depend->js[0]; + if ($getPublishedUrl !== null && $js !== null) { + $dependUrl = $getPublishedUrl . '/' . $js; + + $this->assertTrue($depend->publishOptions['filter']->match('**/' . $depend->js[0])); + $this->assertSame($dependUrl, $this->assetManager->getJsFiles()[$dependUrl][0]); + } + } + + if ($type === 'Js' && is_string($bundle->sourcePath) && isset($bundle->js[0])) { + $getPublishedUrl = $this->assetPublisher->getPublishedUrl($bundle->sourcePath); + /** @psalm-var string|null $js */ + $js = $bundle->js[0]; + + if ($getPublishedUrl !== null && $js !== null) { + $bundleUrl = $getPublishedUrl . '/' . $js; + + $this->assertTrue($bundle->publishOptions['filter']->match('**/' . $bundle->js[0])); + $this->assertSame($bundleUrl, $this->assetManager->getJsFiles()[$bundleUrl][0]); + } + } + } +} diff --git a/tests/Provider/CdnAssetProvider.php b/tests/Provider/CdnAssetProvider.php new file mode 100644 index 0000000..5662468 --- /dev/null +++ b/tests/Provider/CdnAssetProvider.php @@ -0,0 +1,31 @@ +aliases = new Aliases( + [ + '@root' => dirname(__DIR__, 2), + '@assets' => __DIR__ . '/runtime', + '@assetsUrl' => '/assets', + '@filepond-asset' => '@npm/filepond/dist', + '@filepond-file-encode-plugin' => '@npm/filepond-plugin-file-encode/dist', + '@filepond-file-image-crop-plugin' => '@npm/filepond-plugin-image-crop/dist', + '@filepond-file-rename-plugin' => '@npm/filepond-plugin-file-rename/dist', + '@filepond-file-validate-size-plugin' => '@npm/filepond-plugin-file-validate-size/dist', + '@filepond-file-validate-type-plugin' => '@npm/filepond-plugin-file-validate-type/dist', + '@filepond-image-exif-orientation-plugin' => '@npm/filepond-plugin-image-exif-orientation/dist', + '@filepond-image-preview-plugin' => '@npm/filepond-plugin-image-preview/dist', + '@filepond-image-transform-plugin' => '@npm/filepond-plugin-image-transform/dist', + '@filepond-pdf-preview-plugin' => '@npm/filepond-plugin-pdf-preview/dist', + '@npm' => '@root/node_modules', + ] + ); + $this->assetManager = $this->createAssetManager($this->aliases); + } + + /** + * @throws Exception + */ + protected function tearDown(): void + { + Assert::removeFilesFromDirectory($this->aliases->get('@assets')); + + unset($this->assetManager); + } + + /** + * Create AssetManager with AssetConverter and AssetPublisher instances for testing. + * + * @param Aliases $aliases The aliases instance. + * + * @return AssetManager The AssetManager instance. + */ + protected function createAssetManager(Aliases $aliases): AssetManager + { + $converter = new AssetConverter($aliases, new NullLogger(), [], false); + $loader = new AssetLoader($aliases, false, [], null, null); + + $this->assetPublisher = new AssetPublisher($aliases, false, false); + $this->assetPublisher = $this->assetPublisher->withForceCopy(true); + + $manager = new AssetManager($aliases, $loader, [], []); + + return $manager->withConverter($converter)->withPublisher($this->assetPublisher); + } +} diff --git a/tests/Support/runtime/.gitignore b/tests/Support/runtime/.gitignore new file mode 100644 index 0000000..e69de29