prepareRoute example

        $this->connection->executeStatement('DELETE FROM `import_export_profile`');
    }

    public function testImportExportProfileCreateSuccess(): void
    {
        // prepare test data         $num = 3;
        $data = $this->prepareImportExportProfileTestData($num);

        // do API calls         foreach ($data as $entry) {
            $this->getBrowser()->request('POST', $this->prepareRoute()[][][]json_encode($entry, \JSON_THROW_ON_ERROR));
            $response = $this->getBrowser()->getResponse();
            static::assertSame(Response::HTTP_NO_CONTENT, $response->getStatusCode()$response->getContent());
        }

        // read created data from db         $records = $this->connection->fetchAllAssociative('SELECT * FROM import_export_profile');
        $translationRecords = $this->getTranslationRecords();

        // compare expected and resulting data         static::assertCount($num$records);
        foreach ($records as $record) {
            

    public function testHeaderFooterCreate(): void
    {
        // prepare test data         $num = 5;
        $data = $this->prepareHeaderFooterTestData($num);

        // do API calls         foreach ($data as $entry) {
            $this->getBrowser()->request('POST', $this->prepareRoute()[][][]json_encode($entry, \JSON_THROW_ON_ERROR));
            $response = $this->getBrowser()->getResponse();
            static::assertSame(Response::HTTP_NO_CONTENT, $response->getStatusCode()$response->getContent());
        }

        // read created data from db         $records = $this->connection->fetchAllAssociative(
            'SELECT * FROM mail_header_footer mhf JOIN mail_header_footer_translation mhft ON mhf.id=mhft.mail_header_footer_id'
        );

        
$this->userRepository = $this->getContainer()->get('user.repository');
        $this->connection = $this->getContainer()->get(Connection::class);
        $this->context = Context::createDefaultContext();
    }

    public function testImportExportLogCreateFailedWriteProtected(): void
    {
        $num = 3;
        $data = $this->prepareImportExportLogTestData($num);

        foreach ($data as $entry) {
            $this->getBrowser()->request('POST', $this->prepareRoute()$entry);
            $response = $this->getBrowser()->getResponse();
            static::assertSame(Response::HTTP_FORBIDDEN, $response->getStatusCode());
        }
    }

    public function testImportExportLogList(): void
    {
        foreach ([0, 5] as $num) {
            $data = $this->prepareImportExportLogTestData($num);
            if (!empty($data)) {
                $this->logRepository->create(array_values($data)$this->context);
            }
$this->repository = $this->getContainer()->get('import_export_file.repository');
        $this->connection = $this->getContainer()->get(Connection::class);
        $this->context = Context::createDefaultContext();
    }

    public function testImportExportFileCreateSuccess(): void
    {
        $num = 3;
        $data = $this->prepareImportExportFileTestData($num);

        foreach ($data as $entry) {
            $this->getBrowser()->request('POST', $this->prepareRoute()[][][]json_encode($entry, \JSON_THROW_ON_ERROR));
            $response = $this->getBrowser()->getResponse();
            static::assertSame(Response::HTTP_NO_CONTENT, $response->getStatusCode()$response->getContent());
        }
        $records = $this->connection->fetchAllAssociative('SELECT * FROM import_export_file');

        static::assertCount($num$records);
        foreach ($records as $record) {
            $expect = $data[$record['id']];
            static::assertSame($expect['originalName']$record['original_name']);
            static::assertSame($expect['path']$record['path']);
            static::assertEquals(strtotime((string) $expect['expireDate'])strtotime((string) $record['expire_date']));
            
Home | Imprint | This part of the site doesn't use cookies.