Skip to content

Commit

Permalink
Rename files
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Sep 16, 2024
1 parent 1442f63 commit 795f456
Show file tree
Hide file tree
Showing 20 changed files with 49 additions and 82 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Acme
Copyright (c) 2024 Setono

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
55 changes: 11 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,20 @@
# Setono Sylius Plugin Skeleton
# Sylius Mailer Plugin

[![Latest Version][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE)
[![Build Status][ico-github-actions]][link-github-actions]
[![Code Coverage][ico-code-coverage]][link-code-coverage]
[![Mutation testing][ico-infection]][link-infection]

[Setono](https://setono.com) have made a bunch of [plugins for Sylius](https://github.com/Setono?q=plugin&sort=stargazers), and we have some guidelines
which we try to follow when developing plugins. These guidelines are used in this repository, and it gives you a very
solid base when developing plugins.
Enhance your Sylius store's mailing capabilities with this plugin. For now the plugin provides a logging mechanism for all emails sent from your store.

Enjoy!
[ico-version]: https://poser.pugx.org/setono/sylius-mailer-plugin/v/stable
[ico-license]: https://poser.pugx.org/setono/sylius-mailer-plugin/license
[ico-github-actions]: https://github.com/Setono/sylius-mailer-plugin/workflows/build/badge.svg
[ico-code-coverage]: https://codecov.io/gh/Setono/sylius-mailer-plugin/branch/master/graph/badge.svg
[ico-infection]: https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FSetono%2Fsylius-mailer-plugin%2Fmaster

## Quickstart

1. Run
```shell
composer create-project --prefer-source --no-install --remove-vcs setono/sylius-plugin-skeleton:1.12.x-dev ProjectName
```
or just click the `Use this template` button at the right corner of this repository.
2. Run
```shell
cd ProjectName && composer install
```
3. From the plugin skeleton root directory, run the following commands:

```bash
php init
(cd tests/Application && yarn install)
(cd tests/Application && yarn build)
(cd tests/Application && bin/console assets:install)
(cd tests/Application && bin/console doctrine:database:create)
(cd tests/Application && bin/console doctrine:schema:create)
(cd tests/Application && bin/console sylius:fixtures:load -n)
```

4. Start your local PHP server: `symfony serve` (see https://symfony.com/doc/current/setup/symfony_server.html for docs)

To be able to set up a plugin's database, remember to configure you database credentials in `tests/Application/.env` and `tests/Application/.env.test`.
[ico-version]: https://poser.pugx.org/setono/sylius-plugin-skeleton/v/stable
[ico-license]: https://poser.pugx.org/setono/sylius-plugin-skeleton/license
[ico-github-actions]: https://github.com/Setono/SyliusPluginSkeleton/workflows/build/badge.svg
[ico-code-coverage]: https://codecov.io/gh/Setono/SyliusPluginSkeleton/branch/1.12.x/graph/badge.svg
[ico-infection]: https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FSetono%2FSyliusPluginSkeleton%2F1.12.x
[link-packagist]: https://packagist.org/packages/setono/sylius-plugin-skeleton
[link-github-actions]: https://github.com/Setono/SyliusPluginSkeleton/actions
[link-code-coverage]: https://codecov.io/gh/Setono/SyliusPluginSkeleton
[link-infection]: https://dashboard.stryker-mutator.io/reports/github.com/Setono/SyliusPluginSkeleton/1.12.x
[link-packagist]: https://packagist.org/packages/setono/sylius-mailer-plugin
[link-github-actions]: https://github.com/Setono/sylius-mailer-plugin/actions
[link-code-coverage]: https://codecov.io/gh/Setono/sylius-mailer-plugin
[link-infection]: https://dashboard.stryker-mutator.io/reports/github.com/Setono/sylius-mailer-plugin/master
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setono/sylius-plugin-skeleton",
"description": "Acme example plugin for Sylius.",
"name": "setono/sylius-mailer-plugin",
"description": "Setono example plugin for Sylius.",
"license": "MIT",
"type": "sylius-plugin",
"keywords": [
Expand Down Expand Up @@ -41,12 +41,12 @@
"prefer-stable": true,
"autoload": {
"psr-4": {
"Acme\\SyliusExamplePlugin\\": "src/"
"Setono\\SyliusMailerPlugin\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Acme\\SyliusExamplePlugin\\Tests\\": "tests/"
"Setono\\SyliusMailerPlugin\\Tests\\": "tests/"
},
"classmap": [
"tests/Application/Kernel.php"
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</include>
</coverage>
<testsuites>
<testsuite name="AcmeSyliusExamplePlugin Test Suite">
<testsuite name="SetonoSyliusMailerPlugin Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin\DependencyInjection;
namespace Setono\SyliusMailerPlugin\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand All @@ -12,7 +12,7 @@ final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('acme_sylius_example');
$treeBuilder = new TreeBuilder('setono_sylius_mailer');

/** @var ArrayNodeDefinition $rootNode */
$rootNode = $treeBuilder->getRootNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin\DependencyInjection;
namespace Setono\SyliusMailerPlugin\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

final class AcmeSyliusExampleExtension extends Extension
final class SetonoSyliusMailerExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container): void
{
Expand All @@ -21,7 +21,7 @@ public function load(array $configs, ContainerBuilder $container): void
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

$container->setParameter('acme_sylius_example.option', $config['option']);
$container->setParameter('setono_sylius_mailer.option', $config['option']);

$loader->load('services.xml');
}
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/config/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
acme_sylius_example_shop:
resource: "@AcmeSyliusExamplePlugin/Resources/config/routes/shop.yaml"
setono_sylius_mailer_shop:
resource: "@SetonoSyliusMailerPlugin/Resources/config/routes/shop.yaml"
prefix: /{_locale}
requirements:
_locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$

acme_sylius_example_admin:
resource: "@AcmeSyliusExamplePlugin/Resources/config/routes/admin.yaml"
setono_sylius_mailer_admin:
resource: "@SetonoSyliusMailerPlugin/Resources/config/routes/admin.yaml"
prefix: /admin
8 changes: 4 additions & 4 deletions src/Resources/config/routes_no_locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# localized URLs (see https://docs.sylius.com/en/latest/cookbook/shop/disabling-localised-urls.html).
# To accommodate this in your plugin, provide a routes file for non localized stores and tell this in the README.md

acme_sylius_example_shop:
resource: "@AcmeSyliusExamplePlugin/Resources/config/routes/shop.yaml"
setono_sylius_mailer_shop:
resource: "@SetonoSyliusMailerPlugin/Resources/config/routes/shop.yaml"

acme_sylius_example_admin:
resource: "@AcmeSyliusExamplePlugin/Resources/config/routes/admin.yaml"
setono_sylius_mailer_admin:
resource: "@SetonoSyliusMailerPlugin/Resources/config/routes/admin.yaml"
prefix: /admin
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin;
namespace Setono\SyliusMailerPlugin;

use Sylius\Bundle\CoreBundle\Application\SyliusPluginTrait;
use Symfony\Component\HttpKernel\Bundle\Bundle;

final class AcmeSyliusExamplePlugin extends Bundle
final class SetonoSyliusMailerPlugin extends Bundle
{
use SyliusPluginTrait;
}
2 changes: 1 addition & 1 deletion tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ APP_SECRET=EDITME
# Format described at https://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=mysql://[email protected]/acme_sylius_example_%kernel.environment%?serverVersion=5.7
DATABASE_URL=mysql://[email protected]/setono_sylius_mailer_%kernel.environment%?serverVersion=5.7
###< doctrine/doctrine-bundle ###

###> lexik/jwt-authentication-bundle ###
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/.env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
APP_SECRET='ch4mb3r0f5ecr3ts'

KERNEL_CLASS='Acme\SyliusExamplePlugin\Tests\Application\Kernel'
KERNEL_CLASS='Setono\SyliusMailerPlugin\Tests\Application\Kernel'
2 changes: 1 addition & 1 deletion tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin\Tests\Application;
namespace Setono\SyliusMailerPlugin\Tests\Application;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php

use Acme\SyliusExamplePlugin\Tests\Application\Kernel;
use Setono\SyliusMailerPlugin\Tests\Application\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\ErrorHandler\Debug;
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true],
Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
Acme\SyliusExamplePlugin\AcmeSyliusExamplePlugin::class => ['all' => true],
Setono\SyliusMailerPlugin\SetonoSyliusMailerPlugin::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
acme_sylius_example:
setono_sylius_mailer:
option: Option value
2 changes: 0 additions & 2 deletions tests/Application/config/routes/acme_sylius_example.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions tests/Application/config/routes/setono_sylius_mailer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
setono_sylius_mailer:
resource: "@SetonoSyliusMailerPlugin/Resources/config/routes.yaml"
2 changes: 1 addition & 1 deletion tests/Application/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use Acme\SyliusExamplePlugin\Tests\Application\Kernel;
use Setono\SyliusMailerPlugin\Tests\Application\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

Expand Down
6 changes: 3 additions & 3 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin\Tests\DependencyInjection;
namespace Setono\SyliusMailerPlugin\Tests\DependencyInjection;

use Acme\SyliusExamplePlugin\DependencyInjection\Configuration;
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
use PHPUnit\Framework\TestCase;
use Setono\SyliusMailerPlugin\DependencyInjection\Configuration;

/**
* See examples of tests and configuration options here: https://github.com/SymfonyTest/SymfonyConfigTest
Expand All @@ -29,7 +29,7 @@ public function values_are_invalid_if_required_value_is_not_provided(): void
[
[], // no values at all
],
'/The child (config|node) "option" (under|at path) "acme_sylius_example" must be configured/',
'/The child (config|node) "option" (under|at path) "setono_sylius_mailer" must be configured/',
true,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

declare(strict_types=1);

namespace Acme\SyliusExamplePlugin\Tests\DependencyInjection;
namespace Setono\SyliusMailerPlugin\Tests\DependencyInjection;

use Acme\SyliusExamplePlugin\DependencyInjection\AcmeSyliusExampleExtension;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
use Setono\SyliusMailerPlugin\DependencyInjection\SetonoSyliusMailerExtension;

/**
* See examples of tests and configuration options here: https://github.com/SymfonyTest/SymfonyDependencyInjectionTest
*/
final class AcmeSyliusExampleExtensionTest extends AbstractExtensionTestCase
final class SetonoSyliusMailerExtensionTest extends AbstractExtensionTestCase
{
protected function getContainerExtensions(): array
{
return [
new AcmeSyliusExampleExtension(),
new SetonoSyliusMailerExtension(),
];
}

Expand All @@ -33,6 +33,6 @@ public function after_loading_the_correct_parameter_has_been_set(): void
{
$this->load();

$this->assertContainerBuilderHasParameter('acme_sylius_example.option', 'option_value');
$this->assertContainerBuilderHasParameter('setono_sylius_mailer.option', 'option_value');
}
}

0 comments on commit 795f456

Please sign in to comment.