diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 6d0a12e..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Build extension -on: - workflow_dispatch: - push: - branches: - - main - -jobs: - build: - uses: FriendsOfShopware/actions/.github/workflows/store-shopware-cli.yml@main - with: - extensionName: ${{ github.event.repository.name }} - secrets: - accountUser: ${{ secrets.ACCOUNT_USER }} - accountPassword: ${{ secrets.ACCOUNT_PASSWORD }} - ghToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml deleted file mode 100644 index 7a271bd..0000000 --- a/.github/workflows/unit.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: PHPUnit -on: - push: - branches: - - 'main' - tags-ignore: - - '*' - pull_request: - -jobs: - phpunit: - name: Run tests - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - shopware-version: - - 'v6.5.2.0' - - 'v6.5.3.2' - - 'trunk' - steps: - - name: Setup Shopware - uses: FriendsOfShopware/setup-shopware@main - with: - shopware-version: ${{ matrix.shopware-version }} - php-version: 8.1 - - - name: Checkout - uses: actions/checkout@v3 - with: - path: custom/plugins/FroshPlatformTemplateMail - - - name: Run Tests - run: php -d pcov.enabled=1 ./vendor/bin/phpunit -c custom/plugins/FroshPlatformTemplateMail/phpunit.xml --coverage-clover clover.xml - - - name: Upload coverage - uses: codecov/codecov-action@v1 - with: - file: ./clover.xml diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 9ad6d93..0000000 --- a/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.idea -*.phar -/.phpunit.result.cache -/composer.lock -/vendor -src/Resources/views/ -src/Resources/public/ 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..0898589 --- /dev/null +++ b/CHANGELOG_en-GB.md @@ -0,0 +1,36 @@ +# 2.0.2 +- [fix: tag a new version](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/2df85b6) +- [fix: admin error in mail template module, fixes #50 (#53)](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/4695b4d) +- [run ci (#52)](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/480e658) +- [Update TestBootstrap.php](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/a9f15c3) +- [fix: mail template module in administration in production mode](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/ab92c00) +- [ci: update ci config](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/5d341cf) +- [chore: prepare release](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/b04a844) +- [refactor: add more code coverage](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/9ece7fd) +- [fix: phpunit tests](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/4002436) +- [feat: shopware 6.5](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/b0a6640) +- [fix: build assets while build](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/775844d) +- [feat: remove subscriber generator](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/6f39ec5) +- [Update unit.yml](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/fe2b62e) +- [Update build.yml](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/1d7ecce) +- [Add tests](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/da29f95) +- [fix for store](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/e7e1ff3) +- [increase version](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/f1cba40) +- [fix tests](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/c84eb30) +- [remove qodana](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/49e8bb7) +- [simplify command](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/926c515) +- [remove qodana](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/a8f35aa) +- [Update .gitpod.yml](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/8722ceb) +- [add gitpod badge](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/5113ee7) +- [add basic dev environment](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/bb8a786) +- [Changed SQL to work with prepared statements](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/6a05042) +- [Added code cleanup](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/4440dce) +- [Added adaptions for new features of mail theme and for review](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/6f79e91) +- [Fixed semantics](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/be8e24c) +- [Added sort to load mail templates from selected theme first, if exists](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/791f733) +- [improved mail template component to show if a template is loaded from the theme](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/b4eaa0f) +- [Implement command to export existing mail templates to disk.](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/a7d1b41) +- [fix: getSalesChannelId usage, fixes #33](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/01e73cd) +- [chore: add .shopware-extension.yml](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/84f4a0e) +- [chore: release 0.4.4](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/4d14e99) +- [chore: update workflow](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/commit/b578b92) \ 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..cf214b3 --- /dev/null +++ b/src/Resources/public/administration/js/frosh-platform-template-mail.js @@ -0,0 +1,127 @@ +(()=>{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 d0583b1..0000000 --- a/tests/Command/ExportCommandTest.php +++ /dev/null @@ -1,45 +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/DependencyInjection/CacheCompilerPassTest.php b/tests/DependencyInjection/CacheCompilerPassTest.php deleted file mode 100644 index da99edd..0000000 --- a/tests/DependencyInjection/CacheCompilerPassTest.php +++ /dev/null @@ -1,42 +0,0 @@ -buildContainer(); - $c->setParameter('kernel.environment', 'dev'); - $c->compile(); - - static::assertFalse($c->hasDefinition(CachedMailFinderService::class)); - } - - public function testCacheStaysInProd(): void - { - $c = $this->buildContainer(); - $c->compile(); - - static::assertTrue($c->hasDefinition(CachedMailFinderService::class)); - } - - private function buildContainer(): ContainerBuilder - { - $container = new ContainerBuilder(); - $container->addCompilerPass(new CacheCompilerPass()); - $d = new Definition(); - $d->setPublic(true); - $container->setDefinition(CachedMailFinderService::class, $d); - $container->setParameter('kernel.environment', 'prod'); - - return $container; - } -} diff --git a/tests/Extension/MailTemplateExtensionTest.php b/tests/Extension/MailTemplateExtensionTest.php deleted file mode 100644 index 9138364..0000000 --- a/tests/Extension/MailTemplateExtensionTest.php +++ /dev/null @@ -1,40 +0,0 @@ -getMockBuilder(FieldCollection::class) - ->disableOriginalConstructor() - ->onlyMethods(['add']) - ->getMock(); - - $collection - ->expects(static::once()) - ->method('add') - ->withConsecutive( - [ - (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 0c2e6d3..0000000 --- a/tests/Integration/OrderTest.php +++ /dev/null @@ -1,181 +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); - } - - 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 92bf77d..0000000 --- a/tests/Integration/SetupExampleTemplatesTrait.php +++ /dev/null @@ -1,51 +0,0 @@ - '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 ccc76cd..0000000 --- a/tests/Services/MailLoader/CachedMailFinderServiceTest.php +++ /dev/null @@ -1,26 +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 36fe495..0000000 --- a/tests/Services/MailLoader/MjmlLoaderTest.php +++ /dev/null @@ -1,57 +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(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']])), - ]); - - $handlerStack = HandlerStack::create($mock); - $client = new Client(['handler' => $handlerStack]); - - $loader = new MjmlLoader(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 bd06253..0000000 --- a/tests/Services/MailLoader/TwigLoaderTest.php +++ /dev/null @@ -1,19 +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 509cf31..0000000 --- a/tests/Services/SearchPathProviderTest.php +++ /dev/null @@ -1,78 +0,0 @@ -setId(Defaults::LANGUAGE_SYSTEM); - $locale = new LocaleEntity(); - $locale->setCode('en-GB'); - $language->setLocale($locale); - $repository = new StaticEntityRepository([new EntityCollection([$language])]); - - $provider = new SearchPathProvider($repository); - static::assertSame($expectedPaths, $provider->buildPaths($event)); - } - - public function eventProvider(): iterable - { - // Without sales channel source - - yield [ - $this->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 [ - $this->createEvent(true), - [ - '98432def39fc4624b33213a56b8c944d/en-GB', // Sales channel and language combo - '98432def39fc4624b33213a56b8c944d', // Sales channel - 'en-GB', // Language code - '2fbb5fe2e29a4d70aa5854ce7ce3e20b', // Language id - 'global', // Global - ], - ]; - } - - private 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 8ec3625..0000000 --- a/tests/Services/StringTemplateRendererTest.php +++ /dev/null @@ -1,29 +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 b797011..0000000 --- a/tests/Subscriber/FlowSubscriberTest.php +++ /dev/null @@ -1,33 +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)); - $subscriber->onFlowSendMailActionEvent(new FlowSendMailActionEvent(new DataBag([]), new MailTemplateEntity(), new StorableFlow('test', Context::createDefaultContext()))); - } -} diff --git a/tests/TestBootstrap.php b/tests/TestBootstrap.php deleted file mode 100644 index 89c7d5b..0000000 --- a/tests/TestBootstrap.php +++ /dev/null @@ -1,11 +0,0 @@ -addCallingPlugin() - ->addActivePlugins('FroshPlatformTemplateMail') - ->bootstrap() - ->getClassLoader(); - -$loader->addPsr4('Frosh\\TemplateMail\\Tests\\', __DIR__);