diff --git a/.travis.yml b/.travis.yml index 903de1e1..e089c764 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,111 +1,79 @@ language: php -dist: trusty +os: linux + +dist: bionic php: - - 7.2 + - '7.3' + - '7.4' + +services: + - mysql + +addons: + apt: + sources: + - google-chrome + packages: + - google-chrome-stable + chrome: stable + +cache: + yarn: true + directories: + - ~/.composer/cache/files + - $SYLIUS_CACHE_DIR env: global: - APP_ENV=test - -jobs: - include: - - &test - stage: test - name: "Build" - - sudo: false - - env: SYLIUS_CACHE_DIR=$HOME/.sylius-cache SYLIUS_BUILD_DIR=etc/build - - cache: - yarn: true - directories: - - ~/.composer/cache/files - - $SYLIUS_CACHE_DIR - - services: - - memcached - - mysql - - before_install: - - phpenv config-rm xdebug.ini || true - - - echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - - mkdir -p tests/Application/public/media/image/ - - cp migrations/* tests/Application/src/Migrations/ - - install: - - composer update --no-interaction --prefer-dist - - (cd tests/Application && yarn install) - - before_script: - - (cd tests/Application && bin/console doctrine:database:create -vvv) - - (cd tests/Application && bin/console doctrine:migrations:migrate -n -vvv -q) - - (cd tests/Application && bin/console assets:install -vvv) - - (cd tests/Application && bin/console cache:warmup -vvv) - - (cd tests/Application && yarn build) - - # Configure display - - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16 - - export DISPLAY=:99 - - # Download Symfony command - - wget https://get.symfony.com/cli/installer -O - | bash - - # Download and configure ChromeDriver - - | - if [ ! -f $SYLIUS_CACHE_DIR/chromedriver ] || [ "$($SYLIUS_CACHE_DIR/chromedriver --version | grep -c 2.34)" = "0" ]; then - curl http://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip > chromedriver.zip - unzip chromedriver.zip - chmod +x chromedriver - mv chromedriver $SYLIUS_CACHE_DIR - fi - # Run ChromeDriver - - $SYLIUS_CACHE_DIR/chromedriver > /dev/null 2>&1 & - - # Download and configure Selenium - - | - if [ ! -f $SYLIUS_CACHE_DIR/selenium.jar ] || [ "$(java -jar $SYLIUS_CACHE_DIR/selenium.jar --version | grep -c 3.4.0)" = "0" ]; then - curl http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar > selenium.jar - mv selenium.jar $SYLIUS_CACHE_DIR - fi - # Run Selenium - - java -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver -jar $SYLIUS_CACHE_DIR/selenium.jar > /dev/null 2>&1 & - - # Run webserver - - (cd tests/Application && /home/travis/.symfony/bin/symfony server:start --port=8080 --dir=public --allow-http --no-tls --force-php-discovery --daemon) - - script: - - composer validate --strict - - composer analyse - - - vendor/bin/phpunit - - vendor/bin/behat --strict -vvv --no-interaction --tags="~@todo" || vendor/bin/behat --strict -vvv --no-interaction --rerun --tags="~@todo" - - after_failure: - - vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles "${SYLIUS_BUILD_DIR}/*.log" - - - - stage: test - name: "PHPSpec (with code coverage)" - - sudo: false - - services: - - memcached - - before_install: - - phpenv config-rm xdebug.ini || true - - - echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - install: - - composer update --no-interaction --prefer-dist - - script: - - phpdbg -qrr vendor/bin/phpspec run + - SYLIUS_CACHE_DIR=$HOME/.sylius-cache + - SYLIUS_BUILD_DIR=etc/build + +before_install: + - phpenv config-rm xdebug.ini + - echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - mkdir -p "${SYLIUS_CACHE_DIR}" + +install: + - composer install --no-interaction --prefer-dist + - (cd tests/Application && yarn install) + +before_script: + - (cd tests/Application && bin/console doctrine:database:create -vvv) + - (cd tests/Application && bin/console doctrine:migrations:migrate -n -vvv -q) + - (cd tests/Application && bin/console assets:install public -vvv) + - (cd tests/Application && bin/console cache:warmup -vvv) + - (cd tests/Application && yarn build) + + # Running fixtures to be sure they're not failing + - (cd tests/Application && bin/console sylius:fixtures:load -n --env test) + + # Download Symfony CLI + - | + if [ ! -f $SYLIUS_CACHE_DIR/symfony ]; then + wget https://get.symfony.com/cli/installer -O - | bash + mv ~/.symfony/bin/symfony $SYLIUS_CACHE_DIR + fi + php -v | head -n 1 | awk '{ print $2 }' > .php-version + + # Install certificates + - $SYLIUS_CACHE_DIR/symfony server:ca:install + + # Run Chrome Headless + - google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & + + # Run webserver + - (cd tests/Application && $SYLIUS_CACHE_DIR/symfony server:start --port=8080 --dir=public --daemon) + +script: + - composer validate --strict + - composer analyse + + - vendor/bin/phpunit tests/ + - phpdbg -qrr vendor/bin/phpspec run + - vendor/bin/behat --strict -vvv --no-interaction || vendor/bin/behat --strict -vvv --no-interaction --rerun + +after_failure: + - vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles "${SYLIUS_BUILD_DIR}/*.log" diff --git a/behat.yml.dist b/behat.yml.dist index a302827b..e44792f2 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -4,6 +4,8 @@ imports: default: extensions: + DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~ + Lakion\Behat\MinkDebugExtension: directory: etc/build clean_start: false @@ -11,12 +13,16 @@ default: Behat\MinkExtension: files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" - base_url: "http://localhost:8080/" + base_url: "https://127.0.0.1:8080/" default_session: symfony - javascript_session: chrome + javascript_session: chrome_headless sessions: symfony: symfony: ~ + chrome_headless: + chrome: + api_url: http://127.0.0.1:9222 + validate_certificate: false chrome: selenium2: browser: chrome @@ -30,6 +36,12 @@ default: - "start-fullscreen" - "start-maximized" - "no-sandbox" + extra_capabilities: + acceptSslCerts: true + acceptInsecureCerts: true + unexpectedAlertBehaviour: accept + goog:chromeOptions: + w3c: false # https://github.com/Sylius/Sylius/issues/10561 firefox: selenium2: browser: firefox diff --git a/composer.json b/composer.json index fdeabb95..e9018f71 100644 --- a/composer.json +++ b/composer.json @@ -19,41 +19,38 @@ } ], "require": { - "php": "^7.2", - "knplabs/knp-snappy-bundle": "^1.5", + "php": "^7.3", + "knplabs/knp-snappy-bundle": "^1.7", "myclabs/php-enum": "^1.7", "sylius/resource-bundle": "^1.6", - "sylius/sylius": "^1.5", - "symfony/messenger": "^4.3" + "sylius/sylius": "^1.8", + "symfony/messenger": "^4.4" }, "require-dev": { - "behat/behat": "^3.4", - "behat/mink": "^1.7@dev", + "behat/behat": "^3.6", + "behat/mink": "^1.8", "behat/mink-browserkit-driver": "^1.3", - "behat/mink-extension": "^2.2", - "behat/mink-selenium2-driver": "^1.3", + "behat/mink-extension": "^2.3", + "behat/mink-selenium2-driver": "^1.4", + "dmore/behat-chrome-extension": "^1.3", + "dmore/chrome-mink-driver": "^2.7", "friends-of-behat/page-object-extension": "^0.3", "friends-of-behat/suite-settings-extension": "^1.0", - "friends-of-behat/symfony-extension": "^2.0", - "friends-of-behat/variadic-extension": "^1.1", + "friends-of-behat/symfony-extension": "^2.1", + "friends-of-behat/variadic-extension": "^1.3", + "friends-of-phpspec/phpspec-code-coverage": "^4.3", "lakion/mink-debug-extension": "^1.2.3", - "leanphp/phpspec-code-coverage": "^4.2", - "phpspec/phpspec": "^4.0", - "phpstan/phpstan-shim": "^0.11", - "phpstan/phpstan-webmozart-assert": "^0.11", - "phpunit/phpunit": "^6.5", - "sylius-labs/coding-standard": "^2.0", - "symfony/browser-kit": "^4.3", - "symfony/debug-bundle": "^4.3", - "symfony/dotenv": "^4.2", - "symfony/framework-bundle": "^4.3", - "symfony/intl": "^4.3", - "symfony/web-profiler-bundle": "^4.3", - "symfony/web-server-bundle": "^4.3" - }, - "conflict": { - "symfony/doctrine-bridge": "4.3.0", - "symfony/framework-bundle": "4.3.0" + "phpspec/phpspec": "^6.0", + "phpstan/phpstan": "0.12.29", + "phpstan/phpstan-webmozart-assert": "0.12.6", + "phpunit/phpunit": "^8.5", + "sylius-labs/coding-standard": "^3.2", + "symfony/browser-kit": "^4.4", + "symfony/debug-bundle": "^4.4", + "symfony/dotenv": "^4.4", + "symfony/intl": "^4.4", + "symfony/web-profiler-bundle": "^4.4", + "symfony/web-server-bundle": "^4.4" }, "autoload": { "psr-4": { diff --git a/phpspec.yml.dist b/phpspec.yml.dist index 84e37a49..0c7953e7 100644 --- a/phpspec.yml.dist +++ b/phpspec.yml.dist @@ -4,7 +4,7 @@ suites: psr4_prefix: Sylius\RefundPlugin extensions: - LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension: + FriendsOfPhpSpec\PhpSpec\CodeCoverage\CodeCoverageExtension: blacklist: - src/Action #controllers should not be unit tests, as they only translates request to response (with some operations in the meantime) - src/DependencyInjection #configuration diff --git a/phpstan.neon b/phpstan.neon index 5fb202c1..4f8c4715 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,6 +2,9 @@ includes: - vendor/phpstan/phpstan-webmozart-assert/extension.neon parameters: + checkMissingIterableValueType: false + checkGenericClassInNonGenericObjectType: false + excludes_analyse: # Makes PHPStan crash - 'src/DependencyInjection/Configuration.php' diff --git a/src/Calculator/UnitRefundTotalCalculator.php b/src/Calculator/UnitRefundTotalCalculator.php index 3f4b4718..10b88bf9 100644 --- a/src/Calculator/UnitRefundTotalCalculator.php +++ b/src/Calculator/UnitRefundTotalCalculator.php @@ -17,7 +17,7 @@ public function __construct(RemainingTotalProviderInterface $remainingTotalProvi $this->remainingTotalProvider = $remainingTotalProvider; } - public function calculateForUnitWithIdAndType(int $id, RefundType $refundType, ?float $amount = null) + public function calculateForUnitWithIdAndType(int $id, RefundType $refundType, ?float $amount = null): int { if ($amount !== null) { return (int) round($amount * 100); diff --git a/src/Calculator/UnitRefundTotalCalculatorInterface.php b/src/Calculator/UnitRefundTotalCalculatorInterface.php index 5a0e9dc1..09727335 100644 --- a/src/Calculator/UnitRefundTotalCalculatorInterface.php +++ b/src/Calculator/UnitRefundTotalCalculatorInterface.php @@ -8,5 +8,5 @@ interface UnitRefundTotalCalculatorInterface { - public function calculateForUnitWithIdAndType(int $id, RefundType $refundType, ?float $amount = null); + public function calculateForUnitWithIdAndType(int $id, RefundType $refundType, ?float $amount = null): int; } diff --git a/src/DependencyInjection/SyliusRefundExtension.php b/src/DependencyInjection/SyliusRefundExtension.php index 325f0bd8..ba744426 100644 --- a/src/DependencyInjection/SyliusRefundExtension.php +++ b/src/DependencyInjection/SyliusRefundExtension.php @@ -7,9 +7,10 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; +use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -final class SyliusRefundExtension extends Extension +final class SyliusRefundExtension extends Extension implements PrependExtensionInterface { /** * {@inheritdoc} @@ -21,4 +22,23 @@ public function load(array $config, ContainerBuilder $container): void $loader->load('services.xml'); } + + public function prepend(ContainerBuilder $container): void + { + if (!$container->hasExtension('doctrine_migrations') || !$container->hasExtension('sylius_labs_doctrine_migrations_extra')) { + return; + } + + $container->prependExtensionConfig('doctrine_migrations', [ + 'migrations_paths' => [ + 'Sylius\RefundPlugin\Migrations' => __DIR__ . '/../Migrations', + ], + ]); + + $container->prependExtensionConfig('sylius_labs_doctrine_migrations_extra', [ + 'migrations' => [ + 'Sylius\RefundPlugin\Migrations' => ['Sylius\Bundle\CoreBundle\Migrations'], + ], + ]); + } } diff --git a/src/Form/Type/ChannelFilterType.php b/src/Form/Type/ChannelFilterType.php index 70573057..10f28475 100644 --- a/src/Form/Type/ChannelFilterType.php +++ b/src/Form/Type/ChannelFilterType.php @@ -20,7 +20,7 @@ public function __construct(ChannelRepositoryInterface $channelRepository) $this->channelRepository = $channelRepository; } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('channel', ChoiceType::class, [ 'choices' => $this->getChannelsList(), diff --git a/src/Generator/SequentialNumberGenerator.php b/src/Generator/SequentialNumberGenerator.php index 7d3d0d9e..dfbc5fd2 100644 --- a/src/Generator/SequentialNumberGenerator.php +++ b/src/Generator/SequentialNumberGenerator.php @@ -71,9 +71,8 @@ private function generateNumber(int $index): string private function getSequence(): CreditMemoSequenceInterface { - /** @var CreditMemoSequenceInterface $sequence */ + /** @var CreditMemoSequenceInterface|null $sequence */ $sequence = $this->sequenceRepository->findOneBy([]); - if (null !== $sequence) { return $sequence; } diff --git a/migrations/Version20180704112314.php b/src/Migrations/Version20180704112314.php similarity index 87% rename from migrations/Version20180704112314.php rename to src/Migrations/Version20180704112314.php index 5b384b3a..bff4b5bb 100644 --- a/migrations/Version20180704112314.php +++ b/src/Migrations/Version20180704112314.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; final class Version20180704112314 extends AbstractMigration { - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -17,7 +17,7 @@ public function up(Schema $schema) : void $this->addSql('CREATE TABLE sylius_refund_refund (id INT AUTO_INCREMENT NOT NULL, orderNumber VARCHAR(255) NOT NULL, amount INT NOT NULL, refundedUnitId INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB'); } - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/migrations/Version20180718125528.php b/src/Migrations/Version20180718125528.php similarity index 89% rename from migrations/Version20180718125528.php rename to src/Migrations/Version20180718125528.php index 0cd99d76..563ca343 100644 --- a/migrations/Version20180718125528.php +++ b/src/Migrations/Version20180718125528.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; final class Version20180718125528 extends AbstractMigration { - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -18,7 +18,7 @@ public function up(Schema $schema) : void $this->addSql('CREATE UNIQUE INDEX UNIQ_DEF86A0EE8F826668CDE5729 ON sylius_refund_refund (refunded_unit_id, type)'); } - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/migrations/Version20180817130113.php b/src/Migrations/Version20180817130113.php similarity index 91% rename from migrations/Version20180817130113.php rename to src/Migrations/Version20180817130113.php index e4b4b543..5a1b0c3f 100644 --- a/migrations/Version20180817130113.php +++ b/src/Migrations/Version20180817130113.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -12,7 +12,7 @@ */ final class Version20180817130113 extends AbstractMigration { - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -21,7 +21,7 @@ public function up(Schema $schema) : void $this->addSql('ALTER TABLE sylius_refund_payment ADD CONSTRAINT FK_EFA5A4B25AA1164F FOREIGN KEY (payment_method_id) REFERENCES sylius_payment_method (id)'); } - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/migrations/Version20180820132147.php b/src/Migrations/Version20180820132147.php similarity index 87% rename from migrations/Version20180820132147.php rename to src/Migrations/Version20180820132147.php index f5b0a26a..affd7bb5 100644 --- a/migrations/Version20180820132147.php +++ b/src/Migrations/Version20180820132147.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -12,7 +12,7 @@ */ final class Version20180820132147 extends AbstractMigration { - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -20,7 +20,7 @@ public function up(Schema $schema) : void $this->addSql('ALTER TABLE sylius_refund_payment DROP number'); } - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/migrations/Version20180829090832.php b/src/Migrations/Version20180829090832.php similarity index 86% rename from migrations/Version20180829090832.php rename to src/Migrations/Version20180829090832.php index 6e9fe2c0..b46e3f11 100644 --- a/migrations/Version20180829090832.php +++ b/src/Migrations/Version20180829090832.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; final class Version20180829090832 extends AbstractMigration { - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -17,7 +17,7 @@ public function up(Schema $schema) : void $this->addSql('DROP INDEX UNIQ_DEF86A0EE8F826668CDE5729 ON sylius_refund_refund'); } - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/migrations/Version20190207125150.php b/src/Migrations/Version20190207125150.php similarity index 92% rename from migrations/Version20190207125150.php rename to src/Migrations/Version20190207125150.php index f8a9f547..cf2e5823 100644 --- a/migrations/Version20190207125150.php +++ b/src/Migrations/Version20190207125150.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; final class Version20190207125150 extends AbstractMigration { - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -18,7 +18,7 @@ public function up(Schema $schema) : void $this->addSql('CREATE TABLE sylius_refund_credit_memo (id VARCHAR(255) NOT NULL, number VARCHAR(255) NOT NULL, orderNumber VARCHAR(255) NOT NULL, total INT NOT NULL, units LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', currencyCode VARCHAR(255) NOT NULL, localeCode VARCHAR(255) NOT NULL, comment LONGTEXT NOT NULL, issued_at DATETIME DEFAULT NULL, channel_code VARCHAR(255) NOT NULL, channel_name VARCHAR(255) NOT NULL, channel_color VARCHAR(255) NOT NULL, INDEX IDX_5C4F3331989A8203 (orderNumber), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB'); } - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/migrations/Version20190215154028.php b/src/Migrations/Version20190215154028.php similarity index 92% rename from migrations/Version20190215154028.php rename to src/Migrations/Version20190215154028.php index 9be13535..e3c8325f 100644 --- a/migrations/Version20190215154028.php +++ b/src/Migrations/Version20190215154028.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; final class Version20190215154028 extends AbstractMigration { - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -17,7 +17,7 @@ public function up(Schema $schema) : void $this->addSql('ALTER TABLE sylius_refund_credit_memo ADD from_customerName VARCHAR(255) NOT NULL, ADD from_street VARCHAR(255) NOT NULL, ADD from_postcode VARCHAR(255) NOT NULL, ADD from_countryCode VARCHAR(255) NOT NULL, ADD from_city VARCHAR(255) NOT NULL, ADD from_company VARCHAR(255) DEFAULT NULL, ADD from_provinceName VARCHAR(255) DEFAULT NULL, ADD from_provinceCode VARCHAR(255) DEFAULT NULL, ADD to_company VARCHAR(255) DEFAULT NULL, ADD to_taxId VARCHAR(255) DEFAULT NULL, ADD to_countryCode VARCHAR(255) DEFAULT NULL, ADD to_street VARCHAR(255) DEFAULT NULL, ADD to_city VARCHAR(255) DEFAULT NULL, ADD to_postcode VARCHAR(255) DEFAULT NULL'); } - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/migrations/Version20190517064223.php b/src/Migrations/Version20190517064223.php similarity index 96% rename from migrations/Version20190517064223.php rename to src/Migrations/Version20190517064223.php index 24f6685d..598d8a9e 100644 --- a/migrations/Version20190517064223.php +++ b/src/Migrations/Version20190517064223.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20190928200659.php b/src/Migrations/Version20190928200659.php similarity index 99% rename from migrations/Version20190928200659.php rename to src/Migrations/Version20190928200659.php index c14422e2..b26d22fc 100644 --- a/migrations/Version20190928200659.php +++ b/src/Migrations/Version20190928200659.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20191217075815.php b/src/Migrations/Version20191217075815.php similarity index 92% rename from migrations/Version20191217075815.php rename to src/Migrations/Version20191217075815.php index b079ac1a..fe6a3500 100644 --- a/migrations/Version20191217075815.php +++ b/src/Migrations/Version20191217075815.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; final class Version20191217075815 extends AbstractMigration { - public function up(Schema $schema) : void + public function up(Schema $schema): void { $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -19,7 +19,7 @@ public function up(Schema $schema) : void $this->addSql('ALTER TABLE sylius_refund_refund CHANGE ordernumber order_number VARCHAR(255) NOT NULL'); } - public function down(Schema $schema) : void + public function down(Schema $schema): void { $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/migrations/Version20191230121402.php b/src/Migrations/Version20191230121402.php similarity index 98% rename from migrations/Version20191230121402.php rename to src/Migrations/Version20191230121402.php index 17c6d6a0..71103b0f 100644 --- a/migrations/Version20191230121402.php +++ b/src/Migrations/Version20191230121402.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20200113091731.php b/src/Migrations/Version20200113091731.php similarity index 94% rename from migrations/Version20200113091731.php rename to src/Migrations/Version20200113091731.php index 2a710901..b0ace7c5 100644 --- a/migrations/Version20200113091731.php +++ b/src/Migrations/Version20200113091731.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20200125182414.php b/src/Migrations/Version20200125182414.php similarity index 98% rename from migrations/Version20200125182414.php rename to src/Migrations/Version20200125182414.php index 62d16520..e7617fae 100644 --- a/migrations/Version20200125182414.php +++ b/src/Migrations/Version20200125182414.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20200131082149.php b/src/Migrations/Version20200131082149.php similarity index 97% rename from migrations/Version20200131082149.php rename to src/Migrations/Version20200131082149.php index 89c22fd5..c0381b93 100644 --- a/migrations/Version20200131082149.php +++ b/src/Migrations/Version20200131082149.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20200304172851.php b/src/Migrations/Version20200304172851.php similarity index 96% rename from migrations/Version20200304172851.php rename to src/Migrations/Version20200304172851.php index 1cef5a32..bc1c5e1d 100644 --- a/migrations/Version20200304172851.php +++ b/src/Migrations/Version20200304172851.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20200306145439.php b/src/Migrations/Version20200306145439.php similarity index 96% rename from migrations/Version20200306145439.php rename to src/Migrations/Version20200306145439.php index f8a6ac65..23189f16 100644 --- a/migrations/Version20200306145439.php +++ b/src/Migrations/Version20200306145439.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20200306153205.php b/src/Migrations/Version20200306153205.php similarity index 97% rename from migrations/Version20200306153205.php rename to src/Migrations/Version20200306153205.php index f78a171b..a820bbb1 100644 --- a/migrations/Version20200306153205.php +++ b/src/Migrations/Version20200306153205.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20200310094633.php b/src/Migrations/Version20200310094633.php similarity index 96% rename from migrations/Version20200310094633.php rename to src/Migrations/Version20200310094633.php index 2ce5cd14..2b5786c9 100644 --- a/migrations/Version20200310094633.php +++ b/src/Migrations/Version20200310094633.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/migrations/Version20200310185620.php b/src/Migrations/Version20200310185620.php similarity index 95% rename from migrations/Version20200310185620.php rename to src/Migrations/Version20200310185620.php index bc0ba755..1746b995 100644 --- a/migrations/Version20200310185620.php +++ b/src/Migrations/Version20200310185620.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DoctrineMigrations; +namespace Sylius\RefundPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/tests/Application/.env b/tests/Application/.env index e394551c..716bf2a3 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -25,3 +25,9 @@ MAILER_URL=smtp://localhost ###> knplabs/knp-snappy-bundle ### WKHTMLTOPDF_PATH=%kernel.project_dir%/etc/wkhtmltopdf ###< knplabs/knp-snappy-bundle ### + +###> lexik/jwt-authentication-bundle ### +JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem +JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem +JWT_PASSPHRASE=66d45daf91b2ed1031e62d81c81dba2e +###< lexik/jwt-authentication-bundle ### diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index a7640ae1..2ac911a9 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -31,9 +31,7 @@ Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true], - Sonata\CoreBundle\SonataCoreBundle::class => ['all' => true], Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true], - Sonata\IntlBundle\SonataIntlBundle::class => ['all' => true], Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true], JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], FOS\RestBundle\FOSRestBundle::class => ['all' => true], @@ -44,7 +42,6 @@ Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], - Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true], Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true], Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true], Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true], @@ -58,4 +55,8 @@ Sylius\RefundPlugin\SyliusRefundPlugin::class => ['all' => true], Knp\Bundle\SnappyBundle\KnpSnappyBundle::class => ['all' => true], FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], + ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], + Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], + Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], + SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/jwt/private-test.pem b/tests/Application/config/jwt/private-test.pem new file mode 100644 index 00000000..b5a5246d --- /dev/null +++ b/tests/Application/config/jwt/private-test.pem @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +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 +-----END RSA PRIVATE KEY----- diff --git a/tests/Application/config/jwt/public-test.pem b/tests/Application/config/jwt/public-test.pem new file mode 100644 index 00000000..e21c0559 --- /dev/null +++ b/tests/Application/config/jwt/public-test.pem @@ -0,0 +1,14 @@ +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxuS1SudSNkjTQcP4H5Sj +zrdO29upko9KYZgUH6z5n+weDtIo5tysdm7xY3nNAU9ixo7wrBvttuf7T1fDCVJj +hzqX5iewaCZks7q9kYygCbvmrAocbx5D9EPZPH0sQQoa9gMuNou2nqWpVdTYCMAj +xzVpqa2krioUzkBJzaWGDYiijv9qKbjWvRUUoYFNOFIFXHFFDrK5ISBC155XiETK +yBYhB1wZVWX1tHe1nDW609BHAAsr1Ve3uiodzYzQ7S9Rw9Q6RCRSRgZRzFV1GTJE +uyMpCCD51DA4otYeEPQf+8hvV3aKbSNydzrQICY95kfB0p9HxorBPh8QHq0qKZOI +le1Aglp0UV3OWgXLWncNc0m8e8hT2I55lYkLio99/4PGfalAdJBPhKtTzbJllaER +HOnlMkEvwk7eggkbbXEN/Ay6usi0R8mRaxhMkS9i8MxubgQBDsOomtegRqA1EzSG +U/FJMS5g/I/gO9bjFu2l2LJwd6B4t/FZt/9mAIGYbIj5/Ykd0E1WIKYAIRUoyW1g +TrGe70yxdHEPEILnZZMRVJzDbkVYfgKAFUpAUqbHTtS+YI6p9tjFuxBrc6GZR/kp +pL/MkEARDX0ZX3n4sPLQf/vdR7+Ks8Yqws1IqsZ3h8iP8WpykbEwnd1w49A1ZBBi +nIXU3idf41EtQgawbpK5Oy0CAwEAAQ== +-----END PUBLIC KEY----- diff --git a/tests/Application/config/packages/doctrine_migrations.yaml b/tests/Application/config/packages/doctrine_migrations.yaml index c0a12026..cdbc01ae 100644 --- a/tests/Application/config/packages/doctrine_migrations.yaml +++ b/tests/Application/config/packages/doctrine_migrations.yaml @@ -1,5 +1,4 @@ doctrine_migrations: - dir_name: "%kernel.project_dir%/src/Migrations" - - # Namespace is arbitrary but should be different from App\Migrations as migrations classes should NOT be autoloaded - namespace: DoctrineMigrations + storage: + table_storage: + table_name: sylius_migrations diff --git a/tests/Application/config/packages/lexik_jwt_authentication.yaml b/tests/Application/config/packages/lexik_jwt_authentication.yaml new file mode 100644 index 00000000..edfb69dc --- /dev/null +++ b/tests/Application/config/packages/lexik_jwt_authentication.yaml @@ -0,0 +1,4 @@ +lexik_jwt_authentication: + secret_key: '%env(resolve:JWT_SECRET_KEY)%' + public_key: '%env(resolve:JWT_PUBLIC_KEY)%' + pass_phrase: '%env(JWT_PASSPHRASE)%' diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml index 830b03df..19bc2a62 100644 --- a/tests/Application/config/packages/security.yaml +++ b/tests/Application/config/packages/security.yaml @@ -1,7 +1,13 @@ parameters: - sylius.security.admin_regex: "^/admin" + sylius.security.admin_regex: "^/%sylius_admin.path_name%" sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!admin|api/.*|api$|media/.*)[^/]++" + sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" + sylius.security.new_api_route: "/new-api" + sylius.security.new_api_regex: "^%sylius.security.new_api_route%" + sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" + sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" + sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" + sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" security: providers: @@ -9,8 +15,15 @@ security: id: sylius.admin_user_provider.email_or_name_based sylius_shop_user_provider: id: sylius.shop_user_provider.email_or_name_based + sylius_api_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_api_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + sylius_api_chain_provider: + chain: + providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] encoders: - Sylius\Component\User\Model\UserInterface: sha512 + Sylius\Component\User\Model\UserInterface: argon2i firewalls: admin: switch_user: true @@ -30,7 +43,7 @@ security: csrf_token_id: admin_authenticate remember_me: secret: "%env(APP_SECRET)%" - path: /admin + path: "/%sylius_admin.path_name%" name: APP_ADMIN_REMEMBER_ME lifetime: 31536000 remember_me_parameter: _remember_me @@ -39,6 +52,45 @@ security: target: sylius_admin_login anonymous: true + new_api_admin_user: + pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" + provider: sylius_admin_user_provider + stateless: true + anonymous: true + json_login: + check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + guard: + authenticators: + - lexik_jwt_authentication.jwt_token_authenticator + + new_api_shop_user: + pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" + provider: sylius_shop_user_provider + stateless: true + anonymous: true + json_login: + check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + guard: + authenticators: + - lexik_jwt_authentication.jwt_token_authenticator + + new_api: + pattern: "%sylius.security.new_api_regex%/*" + provider: sylius_api_chain_provider + stateless: true + anonymous: lazy + guard: + authenticators: + - lexik_jwt_authentication.jwt_token_authenticator + oauth_token: pattern: "%sylius.security.api_regex%/oauth/v2/token" security: false @@ -100,3 +152,6 @@ security: - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/packages/sonata_core.yaml b/tests/Application/config/packages/sonata_core.yaml deleted file mode 100644 index e9a6e895..00000000 --- a/tests/Application/config/packages/sonata_core.yaml +++ /dev/null @@ -1,4 +0,0 @@ -sonata_core: - form: - mapping: - enabled: false diff --git a/tests/Application/config/packages/test_cached/doctrine.yaml b/tests/Application/config/packages/test_cached/doctrine.yaml index 49528606..2f16f0fd 100644 --- a/tests/Application/config/packages/test_cached/doctrine.yaml +++ b/tests/Application/config/packages/test_cached/doctrine.yaml @@ -1,16 +1,31 @@ doctrine: orm: - entity_managers: - default: - result_cache_driver: - type: memcached - host: localhost - port: 11211 - query_cache_driver: - type: memcached - host: localhost - port: 11211 - metadata_cache_driver: - type: memcached - host: localhost - port: 11211 + metadata_cache_driver: + type: service + id: doctrine.system_cache_provider + query_cache_driver: + type: service + id: doctrine.system_cache_provider + result_cache_driver: + type: service + id: doctrine.result_cache_provider + +services: + doctrine.result_cache_provider: + class: Symfony\Component\Cache\DoctrineProvider + public: false + arguments: + - '@doctrine.result_cache_pool' + doctrine.system_cache_provider: + class: Symfony\Component\Cache\DoctrineProvider + public: false + arguments: + - '@doctrine.system_cache_pool' + +framework: + cache: + pools: + doctrine.result_cache_pool: + adapter: cache.app + doctrine.system_cache_pool: + adapter: cache.system diff --git a/tests/Application/config/packages/twig.yaml b/tests/Application/config/packages/twig.yaml index 3b315dcc..8545473d 100644 --- a/tests/Application/config/packages/twig.yaml +++ b/tests/Application/config/packages/twig.yaml @@ -2,3 +2,11 @@ twig: paths: ['%kernel.project_dir%/templates'] debug: '%kernel.debug%' strict_variables: '%kernel.debug%' + +services: + _defaults: + public: false + autowire: true + autoconfigure: true + + Twig\Extra\Intl\IntlExtension: ~ diff --git a/tests/Application/config/packages/twig_extensions.yaml b/tests/Application/config/packages/twig_extensions.yaml deleted file mode 100644 index 0881cc95..00000000 --- a/tests/Application/config/packages/twig_extensions.yaml +++ /dev/null @@ -1,11 +0,0 @@ -services: - _defaults: - public: false - autowire: true - autoconfigure: true - - # Uncomment any lines below to activate that Twig extension - #Twig\Extensions\ArrayExtension: ~ - #Twig\Extensions\DateExtension: ~ - #Twig\Extensions\IntlExtension: ~ - #Twig\Extensions\TextExtension: ~ diff --git a/tests/Application/config/routes/sylius_api.yaml b/tests/Application/config/routes/sylius_api.yaml new file mode 100644 index 00000000..ae01ffce --- /dev/null +++ b/tests/Application/config/routes/sylius_api.yaml @@ -0,0 +1,3 @@ +sylius_api: + resource: "@SyliusApiBundle/Resources/config/routing.yml" + prefix: "%sylius.security.new_api_route%" diff --git a/tests/Application/package.json b/tests/Application/package.json index 14072b2b..9271063f 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,11 +1,14 @@ { "dependencies": { "babel-polyfill": "^6.26.0", + "chart.js": "^2.9.3", "jquery": "^3.2.0", "lightbox2": "^2.9.0", - "semantic-ui-css": "^2.2.0" + "semantic-ui-css": "^2.2.0", + "slick-carousel": "^1.8.1" }, "devDependencies": { + "@symfony/webpack-encore": "^0.28.0", "babel-core": "^6.26.3", "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-module-resolver": "^3.1.1", @@ -35,6 +38,7 @@ "rollup-plugin-inject": "^2.0.0", "rollup-plugin-node-resolve": "^3.3.0", "rollup-plugin-uglify": "^4.0.0", + "sass-loader": "^7.0.1", "upath": "^1.1.0", "yargs": "^6.4.0" },