prepareImportExportActionControllerTestData example

private Context $context;

    protected function setUp(): void
    {
        $this->repository = $this->getContainer()->get('import_export_profile.repository');
        $this->connection = $this->getContainer()->get(Connection::class);
        $this->context = Context::createDefaultContext();
    }

    public function testUploadingFileWithUnexpectedMimeTypeFails(): void
    {
        $data = $this->prepareImportExportActionControllerTestData(2);
        $this->repository->create(array_values($data)$this->context);

        foreach ($data as $entry) {
            $client = $this->getBrowser();
            $client->request(
                'POST',
                '/api/_action/import-export/prepare',
                ['profileId' => $entry['id'], 'expireDate' => date('Y-m-d H:i:s')],
                ['file' => $this->getUploadFile('text/html', 'test.xml')],
                ['Content-Type' => 'multipart/formdata']
            );

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