diff --git a/Model/Command/ApplyMediaFiles.php b/Model/Command/ApplyMediaFiles.php index a636d399019e1f3188e4c0a0009583ce8278760b..763a123fd5e2779fecec28526f05e640cfa6a20d 100644 --- a/Model/Command/ApplyMediaFiles.php +++ b/Model/Command/ApplyMediaFiles.php @@ -7,7 +7,6 @@ use Firegento\ContentProvisioning\Api\Data\EntryInterface; use Firegento\ContentProvisioning\Api\TargetMediaDirectoryPathProviderInterface; use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Filesystem\DriverInterface; -use SplFileInfo; class ApplyMediaFiles { @@ -61,7 +60,7 @@ class ApplyMediaFiles $targetPathname = $targetDirPath . DIRECTORY_SEPARATOR . $fileName; if ($this->fileSystemDriver->isFile($sourcePathname) - && $this->fileSystemDriver->isReadable($sourcePathname)() + && $this->fileSystemDriver->isReadable($sourcePathname) ) { $this->createDirectory($targetDirPath, $sourceDirPath, $sourcePathname); $this->fileSystemDriver->copy($sourcePathname, $targetPathname); diff --git a/Model/Config/Parser/ParserChain.php b/Model/Config/Parser/ParserChain.php index 27c6f1373d5391b3512ad8268f637d0db41add23..b8976bf6806de05667e19254d8c366a57d1b448d 100644 --- a/Model/Config/Parser/ParserChain.php +++ b/Model/Config/Parser/ParserChain.php @@ -7,6 +7,9 @@ use DOMElement; use Firegento\ContentProvisioning\Api\ConfigParserInterface; use Magento\Framework\Exception\LocalizedException; +/** + * @api + */ class ParserChain implements ConfigParserInterface { /** diff --git a/Model/Config/Parser/Query/FetchMediaFilesChain.php b/Model/Config/Parser/Query/FetchMediaFilesChain.php index b20834c581867192230d297cec59f0bb8ba0cd8e..e5f425ced126fae09e8248b6df06ba7a9d29b8b0 100644 --- a/Model/Config/Parser/Query/FetchMediaFilesChain.php +++ b/Model/Config/Parser/Query/FetchMediaFilesChain.php @@ -6,6 +6,9 @@ namespace Firegento\ContentProvisioning\Model\Config\Parser\Query; use Firegento\ContentProvisioning\Api\MediaFilesParserInterface; use Magento\Framework\Exception\LocalizedException; +/** + * @api + */ class FetchMediaFilesChain implements MediaFilesParserInterface { /** diff --git a/Test/Integration/Model/Config/_files/test-files/content-with-images-1.html b/Test/Integration/Model/Config/_files/test-files/content-with-images-1.html index dc3c06d323aca666c6b1da39c36bdf930ab9d321..ae7f2148b8d453c4437828040ff7fe1326c7cf77 100644 --- a/Test/Integration/Model/Config/_files/test-files/content-with-images-1.html +++ b/Test/Integration/Model/Config/_files/test-files/content-with-images-1.html @@ -1,5 +1,5 @@ <h5>Some foobar</h5> -<p>Foobar: <a href="{{media url="image-1.png"}}">Link zu einem Bilder</a></p> +<p>Foobar: <a href="{{media url=image-1.png}}">Link zu einem Bilder</a></p> <p>Dummy content...</p> -<p>Image: <img src="{{media url="some-test-image.png"}}" alt="fooo" width="300"></p> -<p>Image 2: <img src="{{media url="foobar/test.png"}}" alt="" width="450" height="150"></p> \ No newline at end of file +<p>Image: <img src="{{media url=some-test-image.png}}" alt="fooo" width="300"></p> +<p>Image 2: <img src="{{media url=foobar/test.png}}" alt="" width="450" height="150"></p> \ No newline at end of file diff --git a/Test/Integration/Model/PageInstaller/InstallMediaFilesTest.php b/Test/Integration/Model/PageInstaller/InstallMediaFilesTest.php index bb6c6adc55266f1b0a8a028ff875011fd0f5dbf3..8683079098be88563e7ea258c0ede734dee1017e 100644 --- a/Test/Integration/Model/PageInstaller/InstallMediaFilesTest.php +++ b/Test/Integration/Model/PageInstaller/InstallMediaFilesTest.php @@ -81,13 +81,7 @@ class InstallMediaFilesTest extends TestCase */ private function getChildDirectoryUrl(string $name): string { - foreach ($this->fileSystem->getChildren() as $child) { - if ($child->getName() === $name) { - return $child->url(); - } - } - - $this->fail('Unknown child name for virtual directory!'); + return $this->fileSystem->getChild($name)->url(); } protected function initEntries() diff --git a/Test/Integration/_files/content/content-with-images-1.html b/Test/Integration/_files/content/content-with-images-1.html index dc3c06d323aca666c6b1da39c36bdf930ab9d321..ae7f2148b8d453c4437828040ff7fe1326c7cf77 100644 --- a/Test/Integration/_files/content/content-with-images-1.html +++ b/Test/Integration/_files/content/content-with-images-1.html @@ -1,5 +1,5 @@ <h5>Some foobar</h5> -<p>Foobar: <a href="{{media url="image-1.png"}}">Link zu einem Bilder</a></p> +<p>Foobar: <a href="{{media url=image-1.png}}">Link zu einem Bilder</a></p> <p>Dummy content...</p> -<p>Image: <img src="{{media url="some-test-image.png"}}" alt="fooo" width="300"></p> -<p>Image 2: <img src="{{media url="foobar/test.png"}}" alt="" width="450" height="150"></p> \ No newline at end of file +<p>Image: <img src="{{media url=some-test-image.png}}" alt="fooo" width="300"></p> +<p>Image 2: <img src="{{media url=foobar/test.png}}" alt="" width="450" height="150"></p> \ No newline at end of file diff --git a/Test/Integration/phpunit.gitlab.xml b/Test/Integration/phpunit.gitlab.xml index e91b10b8aa6b42023355dd2403fac3a63aab4cf1..ed3e3ed57e2c5b344cac26bfe959ae633dd422ee 100644 --- a/Test/Integration/phpunit.gitlab.xml +++ b/Test/Integration/phpunit.gitlab.xml @@ -42,7 +42,7 @@ <!-- Semicolon-separated 'glob' patterns, that match global XML configuration files --> <const name="TESTS_GLOBAL_CONFIG_DIR" value="../../../app/etc"/> <!-- Whether to cleanup the application before running tests or not --> - <const name="TESTS_CLEANUP" value="enabled"/> + <const name="TESTS_CLEANUP" value="disabled"/> <!-- Memory usage and estimated leaks thresholds --> <!--<const name="TESTS_MEM_USAGE_LIMIT" value="1024M"/>--> <const name="TESTS_MEM_LEAK_LIMIT" value=""/> diff --git a/etc/di.xml b/etc/di.xml index 5eab44e3e9799332de6576b42e2ec270584ab344..3cb939c3a367d472eb948000b17b35537f24fca5 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -105,6 +105,17 @@ </arguments> </type> + <type name="Firegento\ContentProvisioning\Model\Resolver\FileContentResolver"> + <arguments> + <argument name="fileSystemDriver" xsi:type="object">Magento\Framework\Filesystem\Driver\File</argument> + </arguments> + </type> + <type name="Firegento\ContentProvisioning\Model\Command\ApplyMediaFiles"> + <arguments> + <argument name="fileSystemDriver" xsi:type="object">Magento\Framework\Filesystem\Driver\File</argument> + </arguments> + </type> + <type name="Firegento\ContentProvisioning\Model\Resolver\ContentResolverProvider"> <arguments> <argument name="contentResolvers" xsi:type="array">