diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index d3fcdc6..0000000 --- a/.editorconfig +++ /dev/null @@ -1,8 +0,0 @@ -root = true - -[*] -end_of_line = lf -insert_final_newline = true -indent_style = space -indent_size = 4 -charset = utf-8 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 1655bc1..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Build extension -on: - workflow_dispatch: - push: - branches: - - main - -jobs: - build: - uses: shopware/github-actions/.github/workflows/build-zip.yml@main - with: - extensionName: ${{ github.event.repository.name }} diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml deleted file mode 100644 index 0a9cee8..0000000 --- a/.github/workflows/js.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: JavaScript -on: - push: - paths: - - '**/*.js' - - '**/*.ts' - branches: - - main - pull_request: - paths: - - '**/*.js' - - '**/*.ts' - -jobs: - run: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Biome CLI - uses: biomejs/setup-biome@v2 - with: - version: latest - - - name: Run Biome - run: biome ci . diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml deleted file mode 100644 index 5008d0b..0000000 --- a/.github/workflows/php.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: PHP -on: - pull_request: - paths: - - '**/*.php' - - .github/workflows/php.yml - push: - paths: - - '**/*.php' - branches: - - main - workflow_dispatch: - schedule: - - cron: '0 3 * * *' - -jobs: - cs: - if: github.event_name != 'schedule' - uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main - phpstan: - uses: shopware/github-actions/.github/workflows/phpstan.yml@main - with: - extensionName: ${{ github.event.repository.name }} - shopwareVersion: 6.5.x - phpunit: - strategy: - fail-fast: false - matrix: - shopware-version: - - '6.5.x' - - 'v6.6.0.0-rc2' - uses: shopware/github-actions/.github/workflows/phpunit.yml@main - with: - extensionName: ${{ github.event.repository.name }} - shopwareVersion: ${{ matrix.shopware-version }} - uploadCoverage: true - secrets: - codecovToken: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7d0cd69..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Release to Store -on: - workflow_dispatch: -jobs: - build: - uses: shopware/github-actions/.github/workflows/store-release.yml@main - with: - extensionName: ${{ github.event.repository.name }} - secrets: - accountUser: ${{ secrets.SHOPWARE_CLI_ACCOUNT_EMAIL }} - accountPassword: ${{ secrets.SHOPWARE_CLI_ACCOUNT_PASSWORD }} - ghToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 9d1e742..0000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -.idea -*.phar -/.phpunit.result.cache -/composer.lock -/vendor -src/Resources/views/ -src/Resources/public/ -/.php-cs-fixer.cache diff --git a/.shopware-extension.yml b/.shopware-extension.yml deleted file mode 100644 index cddce5c..0000000 --- a/.shopware-extension.yml +++ /dev/null @@ -1,17 +0,0 @@ -changelog: - enabled: true - -build: - zip: - composer: - enabled: false - assets: - enabled: true - enable_es_build_for_admin: true - enable_es_build_for_storefront: true - pack: - excludes: - paths: - - .idea - - var - - .gitignore diff --git a/CHANGELOG_en-GB.md b/CHANGELOG_en-GB.md new file mode 100644 index 0000000..69af7ce --- /dev/null +++ b/CHANGELOG_en-GB.md @@ -0,0 +1,12 @@ +# 3.0.1 +- [chore: increase version](/c73a8bb) +- [ci: add js linting](/91c470e) +- [fix: unused imports](/0a9047f) +- [feat: add phpstan](/c942ee7) +- [fix: admin creating new mail template, fixes #57](/759ab95) +- [fix: improve injecting the language into mailer, fixes #43](/0a1379f) +- [ci: update workflows](/282f1b6) +- [ci: delete backporting](/0cf541d) +- [fix: restore 6.5 compatiblity](/76ff889) +- [Add configurable MJML server (#55)](/cb608fc) +- [ci: add backporting](/269fd74) \ No newline at end of file diff --git a/src/Resources/public/administration/css/frosh-platform-template-mail.css b/src/Resources/public/administration/css/frosh-platform-template-mail.css new file mode 100644 index 0000000..1b3fcb0 --- /dev/null +++ b/src/Resources/public/administration/css/frosh-platform-template-mail.css @@ -0,0 +1 @@ +.sw-mail-template-detail__options-info-wrapper .sw-field,.sw-mail-template-detail .sw-code-editor{margin-bottom:5px}.sw-mail-template-detail .sw-code-editor+.sw-label{margin-bottom:32px} diff --git a/src/Resources/public/administration/js/frosh-platform-template-mail.js b/src/Resources/public/administration/js/frosh-platform-template-mail.js new file mode 100644 index 0000000..0dc6940 --- /dev/null +++ b/src/Resources/public/administration/js/frosh-platform-template-mail.js @@ -0,0 +1,130 @@ +(()=>{var l=`{% block sw_mail_template_list_grid %} + + + + + + +{% endblock %} +`;Shopware.Component.override("sw-mail-template-list",{template:l,methods:{getListColumns(){let e=this.$super("getListColumns");return e.unshift({property:"froshTemplateMail",label:"sw-mail-template.list.columnTemplateMail",allowResize:!0},{property:"technicalName",label:"sw-mail-template.list.columnTechnicalName",allowResize:!0,visible:!1}),e},getFroshTooltip(e,t){return{message:t?this.$t(`sw-mail-template.frosh.${e}`,{folder:t}):this.$t("sw-mail-template.frosh.noTemplate")}}}});var a=`{% block sw_mail_template_options_form_subject_field %} + {% parent %} + + + +{% endblock %} + +{% block sw_mail_template_mail_text_form_content_plain_field %} + {% parent %} + + + +{% endblock %} + +{% block sw_mail_template_mail_text_form_content_html_field %} + {% parent %} + + + +{% endblock %} +`;Shopware.Component.override("sw-mail-template-detail",{template:a,methods:{getFroshTooltip(e,t){return{message:t?this.$t(`sw-mail-template.frosh.${e}`,{folder:t}):this.$t("sw-mail-template.frosh.noTemplate")}}}});})(); diff --git a/src/Resources/store/de.md b/src/Resources/store/de.md deleted file mode 100644 index daf8f9b..0000000 --- a/src/Resources/store/de.md +++ /dev/null @@ -1,20 +0,0 @@ -Mit Template Mail kannst du deine Mail-Templates aus der Administration in dein Theme auslagern. -Somit sind deine Mail-Templates versioniert, können voneinander erben und du profitierst von all den anderen tollen Dingen, die man in Twig machen kann. -Dieses Plugin stellt außerdem einen Loader bereit, der dafür sorgt, dass andere Plugins weitere Dateitypen hinzufügen können. Im Plugin selbst werden aktuell Twig, [MJML](https://mjml.io/) und [Inky](https://foundation.zurb.com/emails/docs/inky.html) unterstützt. - - -## Wie benutze ich das Plugin? -Durch die Installation ändert sich erst mal nichts für dich. Du kannst anfangen die ersten Templates in dein Theme auszulagern. - -### Beispiel Pfade für Twig, Zahlungsbestätigung (*order_transaction.state.paid*): -Ordner: custom/plugins/*MyTheme*/Resources/views/email/global/ - -- HTML-Inhalt der Zahlungsbestätigung: *order_transaction.state.paid*/html.twig -- PlainText-Inhalt der Zahlungsbestätigung: *order_transaction.state.paid*/plain.twig -- Betreff der Zahlungsbestätigung: *order_transaction.state.paid*/subject.twig - - -Das Plugin wird von der Github Organization [FriendsOfShopware](https://github.com/FriendsOfShopware/) entwickelt. -Maintainer des Plugin ist [Soner Sayakci](https://github.com/shyim). -Das Github Repository ist zu finden [hier](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail) -[Bei Fragen / Fehlern bitte ein Github Issue erstellen](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/issues/new) diff --git a/src/Resources/store/en.md b/src/Resources/store/en.md deleted file mode 100644 index 2dc5b2e..0000000 --- a/src/Resources/store/en.md +++ /dev/null @@ -1,19 +0,0 @@ -With Template Mail you can outsource your mail templates in the administration to your theme. -So your mail templates are versioned, can inherit from each other and all the other great things you can do in Twig. -The plugin also supports loaders. So other plugins can add file extensions where they can create the mail. -The plugin itself supports Twig and MJML by default. - -## How do I use the plugin? - -After installation nothing changes for you. You can now start to swap the first templates into your theme. - -Example paths: - -* custom/plugins/MyTheme/Resources/views/email/global/order_transaction.state.paid/html.twig - content of the sOrder in HTML form -* custom/plugins/MyTheme/Resources/views/email/global/order_transaction.state.paid/plain.twig - content of the sOrder in text form -* custom/plugins/MyTheme/Resources/views/email/global/order_transaction.state.paid/subject.twig - title of the sOrder Mailion) - -The plugin is provided by the Github Organization [FriendsOfShopware](https://github.com/FriendsOfShopware/). -Maintainer of the plugin is [Soner Sayakci](https://github.com/shyim). -You can find the Github Repository [here](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail) -[For questions / errors please create a Github Issue](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/issues/new) diff --git a/src/Resources/store/icon.png b/src/Resources/store/icon.png deleted file mode 100644 index 885856b..0000000 Binary files a/src/Resources/store/icon.png and /dev/null differ diff --git a/src/Resources/store/images/1.png b/src/Resources/store/images/1.png deleted file mode 100644 index b8591de..0000000 Binary files a/src/Resources/store/images/1.png and /dev/null differ diff --git a/tests/Command/ExportCommandTest.php b/tests/Command/ExportCommandTest.php deleted file mode 100644 index ce5dea5..0000000 --- a/tests/Command/ExportCommandTest.php +++ /dev/null @@ -1,47 +0,0 @@ -createMock(Connection::class); - $connection->method('fetchAllAssociative')->willReturn([ - [ - 'content_plain' => 'My content', - 'content_html' => '

My content

', - 'subject' => 'Test template', - 'technical_name' => 'test_template', - 'locale' => 'en', - ], - ]); - - $command = new ExportCommand($connection); - - $tester = new CommandTester($command); - $tester->execute(['directory' => sys_get_temp_dir()]); - - $htmlFile = sys_get_temp_dir() . '/en/test_template/html.twig'; - $plainFile = sys_get_temp_dir() . '/en/test_template/plain.twig'; - $subjectFile = sys_get_temp_dir() . '/en/test_template/subject.twig'; - - static::assertFileExists($htmlFile); - static::assertFileExists($plainFile); - static::assertFileExists($subjectFile); - - static::assertEquals('

My content

', file_get_contents($htmlFile)); - static::assertEquals('My content', file_get_contents($plainFile)); - static::assertEquals('Test template', file_get_contents($subjectFile)); - - static::assertSame(0, $tester->getStatusCode()); - static::assertStringContainsString('Files has been exported', $tester->getDisplay()); - } -} diff --git a/tests/Extension/MailTemplateExtensionTest.php b/tests/Extension/MailTemplateExtensionTest.php deleted file mode 100644 index 0e31d36..0000000 --- a/tests/Extension/MailTemplateExtensionTest.php +++ /dev/null @@ -1,38 +0,0 @@ -getMockBuilder(FieldCollection::class) - ->disableOriginalConstructor() - ->onlyMethods(['add']) - ->getMock(); - - $collection - ->expects(static::once()) - ->method('add') - ->with((new StringField('frosh_template_mail', 'froshTemplateMail'))->addFlags(new Runtime())); - - (new MailTemplateExtension())->extendFields($collection); - } - - public function testGetDefinitionClassReturnsMailTemplateDefinitionClass(): void - { - static::assertSame( - MailTemplateDefinition::class, - (new MailTemplateExtension())->getDefinitionClass() - ); - } -} diff --git a/tests/Integration/OrderTest.php b/tests/Integration/OrderTest.php deleted file mode 100644 index 5f9c41b..0000000 --- a/tests/Integration/OrderTest.php +++ /dev/null @@ -1,182 +0,0 @@ -orderService = $this->getContainer()->get(OrderService::class); - - $this->addCountriesToSalesChannel(); - - $contextFactory = $this->getContainer()->get(SalesChannelContextFactory::class); - $this->salesChannelContext = $contextFactory->create( - '', - TestDefaults::SALES_CHANNEL, - [SalesChannelContextService::CUSTOMER_ID => $this->createCustomer('Jon', 'Doe')] - ); - } - - public function testOrderConfirmationMail(): void - { - $eventDispatcher = $this->getContainer()->get('event_dispatcher'); - $mailSentEvent = null; - - $eventDispatcher->addListener(MailSentEvent::class, function (MailSentEvent $e) use (&$mailSentEvent): void { - $mailSentEvent = $e; - }); - - $this->performOrder(); - - static::assertNotNull($mailSentEvent, 'Mail did not sent'); - - static::assertSame( - [ - 'text/html' => 'HTML CONFIRM', - 'text/plain' => 'TEXT CONFIRM', - ], - $mailSentEvent->getContents() - ); - static::assertSame('SUBJECT CONFIRM', $mailSentEvent->getSubject()); - } - - private function fillCart(string $contextToken): void - { - $cart = $this->getContainer()->get(CartService::class)->createNew($contextToken); - - $productId = $this->createProduct(); - $cart->add(new LineItem('lineItem1', LineItem::PRODUCT_LINE_ITEM_TYPE, $productId)); - $cart->setTransactions($this->createTransaction()); - } - - private function createProduct(): string - { - $productId = Uuid::randomHex(); - - $product = [ - 'id' => $productId, - 'name' => 'Test product', - 'productNumber' => '123456789', - 'stock' => 1, - 'price' => [ - ['currencyId' => Defaults::CURRENCY, 'gross' => 19.99, 'net' => 10, 'linked' => false], - ], - 'manufacturer' => ['id' => $productId, 'name' => 'shopware AG'], - 'tax' => ['id' => $this->getValidTaxId(), 'name' => 'testTaxRate', 'taxRate' => 15], - 'categories' => [ - ['id' => $productId, 'name' => 'Test category'], - ], - 'visibilities' => [ - [ - 'id' => $productId, - 'salesChannelId' => TestDefaults::SALES_CHANNEL, - 'visibility' => ProductVisibilityDefinition::VISIBILITY_ALL, - ], - ], - ]; - - $this->getContainer()->get('product.repository')->create([$product], Context::createDefaultContext()); - - return $productId; - } - - private function createTransaction(): TransactionCollection - { - return new TransactionCollection([ - new Transaction( - new CalculatedPrice( - 13.37, - 13.37, - new CalculatedTaxCollection(), - new TaxRuleCollection() - ), - $this->getValidPaymentMethodId() - ), - ]); - } - - private function performOrder(): string - { - $data = new RequestDataBag(['tos' => true]); - $this->fillCart($this->salesChannelContext->getToken()); - - return $this->orderService->createOrder($data, $this->salesChannelContext); - } - - /** - * @param array $options - */ - private function createCustomer(string $firstName, string $lastName, array $options = []): string - { - $customerId = Uuid::randomHex(); - $salutationId = $this->getValidSalutationId(); - $paymentMethodId = $this->getValidPaymentMethodId(); - - $customer = [ - 'id' => $customerId, - 'salesChannelId' => TestDefaults::SALES_CHANNEL, - 'defaultShippingAddress' => [ - 'id' => $customerId, - 'firstName' => $firstName, - 'lastName' => $lastName, - 'city' => 'Schöppingen', - 'street' => 'Ebbinghoff 10', - 'zipcode' => '48624', - 'salutationId' => $salutationId, - 'countryId' => $this->getValidCountryId(), - ], - 'defaultBillingAddressId' => $customerId, - 'defaultPaymentMethodId' => $paymentMethodId, - 'groupId' => TestDefaults::FALLBACK_CUSTOMER_GROUP, - 'email' => Uuid::randomHex() . '@example.com', - 'password' => 'nott1234', - 'firstName' => $firstName, - 'lastName' => $lastName, - 'salutationId' => $salutationId, - 'customerNumber' => '12345', - ]; - - $customer = array_merge_recursive($customer, $options); - - $this->getContainer()->get('customer.repository')->create([$customer], Context::createDefaultContext()); - - return $customerId; - } -} diff --git a/tests/Integration/SetupExampleTemplatesTrait.php b/tests/Integration/SetupExampleTemplatesTrait.php deleted file mode 100644 index 197cc7e..0000000 --- a/tests/Integration/SetupExampleTemplatesTrait.php +++ /dev/null @@ -1,55 +0,0 @@ - - */ - private array $tplFiles = [ - 'global/order_confirmation_mail/html.twig' => 'HTML CONFIRM', - 'global/order_confirmation_mail/plain.twig' => 'TEXT CONFIRM', - 'global/order_confirmation_mail/subject.twig' => 'SUBJECT CONFIRM', - ]; - - /** - * @before - */ - public function setupTemplates(): void - { - $fs = new Filesystem(); - - $resources = $this->getResourcesFolder(); - foreach ($this->tplFiles as $tplFile => $content) { - $file = $resources . '/' . $tplFile; - $folder = \dirname($file); - $fs->mkdir($folder); - - $fs->dumpFile($file, $content); - } - } - - /** - * @after - */ - public function removeTemplates(): void - { - $fs = new Filesystem(); - - $resources = $this->getResourcesFolder(); - foreach ($this->tplFiles as $tplFile => $content) { - $file = $resources . '/' . $tplFile; - $fs->remove($file); - } - } - - private function getResourcesFolder(): string - { - return \dirname(__DIR__, 2) . '/src/Resources/views/email/'; - } -} diff --git a/tests/Services/MailLoader/CachedMailFinderServiceTest.php b/tests/Services/MailLoader/CachedMailFinderServiceTest.php deleted file mode 100644 index 815daf8..0000000 --- a/tests/Services/MailLoader/CachedMailFinderServiceTest.php +++ /dev/null @@ -1,27 +0,0 @@ -createMock(MailFinderService::class); - $mailFinder->method('findTemplateByTechnicalName')->willReturnCallback(fn() => (string) microtime(true)); - - $cachedMailFinder = new CachedMailFinderService($mailFinder, new ArrayAdapter()); - $context = new TemplateMailContext('1234', Context::createDefaultContext()); - - $time = $cachedMailFinder->findTemplateByTechnicalName('', '', $context); - static::assertSame($time, $cachedMailFinder->findTemplateByTechnicalName('', '', $context)); - } -} diff --git a/tests/Services/MailLoader/MjmlLoaderTest.php b/tests/Services/MailLoader/MjmlLoaderTest.php deleted file mode 100644 index 55f357c..0000000 --- a/tests/Services/MailLoader/MjmlLoaderTest.php +++ /dev/null @@ -1,58 +0,0 @@ -supportedExtensions()); - - $text = $loader->load(__DIR__ . '/_fixtures/test.mjml'); - static::assertStringContainsString('', $text); - static::assertStringContainsString('', $text); - } - - public function testApiIsNotAvailable(): void - { - $mock = new MockHandler([ - new ServerException('Error Communicating with Server', new Request('GET', 'test'), new Response(500)), - ]); - - $handlerStack = HandlerStack::create($mock); - $client = new Client(['handler' => $handlerStack]); - - $loader = new MjmlLoader('https://mjml.shyim.de', new NullLogger(), $client); - - static::assertSame('', $loader->load(__DIR__ . '/_fixtures/test.mjml')); - } - - public function testApiRespondsErrors(): void - { - $mock = new MockHandler([ - new Response(200, ['Content-Type' => 'application/json'], json_encode(['errors' => ['some error happend']], JSON_THROW_ON_ERROR)), - ]); - - $handlerStack = HandlerStack::create($mock); - $client = new Client(['handler' => $handlerStack]); - - $loader = new MjmlLoader('https://mjml.shyim.de', new NullLogger(), $client); - - static::expectException(MjmlCompileError::class); - $loader->load(__DIR__ . '/_fixtures/test.mjml'); - } -} diff --git a/tests/Services/MailLoader/TwigLoaderTest.php b/tests/Services/MailLoader/TwigLoaderTest.php deleted file mode 100644 index e7f2c8c..0000000 --- a/tests/Services/MailLoader/TwigLoaderTest.php +++ /dev/null @@ -1,20 +0,0 @@ -supportedExtensions()); - static::assertNotEmpty($loader->load($storefront->getPath() . '/Resources/views/storefront/base.html.twig')); - } -} diff --git a/tests/Services/MailLoader/_fixtures/test.inky b/tests/Services/MailLoader/_fixtures/test.inky deleted file mode 100644 index e514481..0000000 --- a/tests/Services/MailLoader/_fixtures/test.inky +++ /dev/null @@ -1,5 +0,0 @@ - - - Put content in me! - - diff --git a/tests/Services/MailLoader/_fixtures/test.mjml b/tests/Services/MailLoader/_fixtures/test.mjml deleted file mode 100644 index 004b668..0000000 --- a/tests/Services/MailLoader/_fixtures/test.mjml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - Hello World - - - - diff --git a/tests/Services/SearchPathProviderTest.php b/tests/Services/SearchPathProviderTest.php deleted file mode 100644 index 58c58fe..0000000 --- a/tests/Services/SearchPathProviderTest.php +++ /dev/null @@ -1,77 +0,0 @@ - $expectedPaths - * @dataProvider eventProvider - */ - public function testPaths(TemplateMailContext $event, array $expectedPaths): void - { - $language = new LanguageEntity(); - $language->setId(Defaults::LANGUAGE_SYSTEM); - $locale = new LocaleEntity(); - $locale->setCode('en-GB'); - $language->setLocale($locale); - $repository = new StaticEntityRepository([new LanguageCollection([$language])]); - - // @phpstan-ignore-next-line - $provider = new SearchPathProvider($repository); - static::assertSame($expectedPaths, $provider->buildPaths($event)); - } - - public static function eventProvider(): \Generator - { - // Without sales channel source - - yield [ - self::createEvent(), - [ - '98432def39fc4624b33213a56b8c944d/en-GB', // Sales channel and language combo - '98432def39fc4624b33213a56b8c944d', // Sales channel - 'en-GB', // Language code - '2fbb5fe2e29a4d70aa5854ce7ce3e20b', // Language id - 'global', // Global - ], - ]; - - // With sales channel source - - yield [ - self::createEvent(true), - [ - '98432def39fc4624b33213a56b8c944d/en-GB', // Sales channel and language combo - '98432def39fc4624b33213a56b8c944d', // Sales channel - 'en-GB', // Language code - '2fbb5fe2e29a4d70aa5854ce7ce3e20b', // Language id - 'global', // Global - ], - ]; - } - - private static function createEvent(bool $salesChannelSource = false): TemplateMailContext - { - $context = new Context( - $salesChannelSource ? new SalesChannelApiSource(TestDefaults::SALES_CHANNEL) : new SystemSource() - ); - - return new TemplateMailContext(TestDefaults::SALES_CHANNEL, $context); - } -} diff --git a/tests/Services/StringTemplateRendererTest.php b/tests/Services/StringTemplateRendererTest.php deleted file mode 100644 index 687f825..0000000 --- a/tests/Services/StringTemplateRendererTest.php +++ /dev/null @@ -1,30 +0,0 @@ -render('{{ text }}', ['text' => 'foo'], Context::createDefaultContext())); - } - - public function testInvalidString(): void - { - $renderer = new StringTemplateRenderer(new Environment(new ArrayLoader())); - - static::expectException(StringTemplateRenderingException::class); - - $renderer->render('{{ text() }}', [], Context::createDefaultContext()); - } -} diff --git a/tests/Subscriber/FlowSubscriberTest.php b/tests/Subscriber/FlowSubscriberTest.php deleted file mode 100644 index a55ce21..0000000 --- a/tests/Subscriber/FlowSubscriberTest.php +++ /dev/null @@ -1,41 +0,0 @@ - 'onFlowSendMailActionEvent', - ], FlowSubscriber::getSubscribedEvents()); - } - - public function testEmptyMailDoesNothing(): void - { - $mailTemplateTypeRepository = $this->createMock(EntityRepository::class); - $mailTemplateTypeRepository->expects(static::never())->method('search'); - - $subscriber = new FlowSubscriber( - $mailTemplateTypeRepository, - $this->createMock(MailFinderServiceInterface::class), - $this->createMock(AbstractTranslator::class), - $this->createMock(EntityRepository::class) - ); - - $subscriber->onFlowSendMailActionEvent(new FlowSendMailActionEvent(new DataBag([]), new MailTemplateEntity(), new StorableFlow('test', Context::createDefaultContext()))); - } -} diff --git a/tests/TestBootstraper.php b/tests/TestBootstraper.php deleted file mode 100644 index d589430..0000000 --- a/tests/TestBootstraper.php +++ /dev/null @@ -1,48 +0,0 @@ -setLoadEnvFile(true) - ->setForceInstallPlugins(true) - ->addActivePlugins('FroshPlatformTemplateMail') - ->bootstrap() - ->getClassLoader(); -} - -$paths = [ - '../../../../src/Core/TestBootstrapper.php', - '../vendor/shopware/core/TestBootstrapper.php', - '../../../../vendor/shopware/core/TestBootstrapper.php', -]; - -foreach ($paths as $path) { - $path = realpath(__DIR__ . '/' . $path); - - if (!\is_string($path)) { - continue; - } - - if (!\is_file($path)) { - continue; - } - - require $path; - - return (new TestBootstrapper()) - ->setPlatformEmbedded(false) - ->setLoadEnvFile(true) - ->setForceInstallPlugins(true) - ->addActivePlugins('FroshPlatformTemplateMail') - ->bootstrap() - ->getClassLoader(); -}