FileService example


#[Package('system-settings')] class FileServiceTest extends TestCase
{
    use IntegrationTestBehaviour;

    /** * @dataProvider fileTypesProvider */
    public function testDetectType($fileData): void
    {
        $fileService = new FileService(
            $this->getContainer()->get('shopware.filesystem.private'),
            $this->getContainer()->get('import_export_file.repository')
        );

        $filePath = $fileData['file'];
        $file = fopen($filePath, 'wb');
        static::assertIsResource($file);
        fwrite($file(string) $fileData['content']);
        fclose($file);

        $uploadedFile = new UploadedFile($filePath$filePath$fileData['providedType']);

        
Home | Imprint | This part of the site doesn't use cookies.