Skip to content

Commit 0c5d317

Browse files
feature #115 Update to Sylius 1.4 (Zales0123)
This PR was merged into the 1.0-dev branch. Discussion ---------- Commits ------- 63eee2e Update to Sylius 1.4 a975ae2 Migrations fixes + supplement
2 parents 7181c57 + a975ae2 commit 0c5d317

20 files changed

+203
-182
lines changed

.travis.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ dist: trusty
55
php:
66
- 7.2
77

8+
env:
9+
global:
10+
- APP_ENV=test
11+
812
jobs:
913
include:
1014
- &test
@@ -31,20 +35,18 @@ jobs:
3135
- echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
3236
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
3337

34-
- cp tests/Application/.env.test.dist tests/Application/.env.test
35-
- set -a && source tests/Application/.env.test && set +a
36-
38+
- mkdir -p tests/Application/public/media/image/
3739
- cp migrations/* tests/Application/src/Migrations/
3840

3941
install:
4042
- composer update --no-interaction --prefer-dist
4143
- (cd tests/Application && yarn install)
4244

4345
before_script:
44-
- (cd tests/Application && bin/console doctrine:database:create --env=test -vvv)
45-
- (cd tests/Application && bin/console doctrine:migrations:migrate -n --env=test -vvv -q)
46-
- (cd tests/Application && bin/console assets:install --env=test -vvv)
47-
- (cd tests/Application && bin/console cache:warmup --env=test -vvv)
46+
- (cd tests/Application && bin/console doctrine:database:create -vvv)
47+
- (cd tests/Application && bin/console doctrine:migrations:migrate -n -vvv -q)
48+
- (cd tests/Application && bin/console assets:install -vvv)
49+
- (cd tests/Application && bin/console cache:warmup -vvv)
4850
- (cd tests/Application && yarn build)
4951

5052
# Configure display
@@ -72,7 +74,7 @@ jobs:
7274
- java -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver -jar $SYLIUS_CACHE_DIR/selenium.jar > /dev/null 2>&1 &
7375

7476
# Run webserver
75-
- (cd tests/Application && bin/console server:run 127.0.0.1:8080 --env=test --quiet > /dev/null 2>&1 &)
77+
- (cd tests/Application && bin/console server:run 127.0.0.1:8080 --quiet > /dev/null 2>&1 &)
7678

7779
script:
7880
- composer validate --strict

behat.yml.dist

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,43 @@
11
imports:
2-
- vendor/sylius/sylius/behat.yml.dist
2+
- vendor/sylius/sylius/src/Sylius/Behat/Resources/config/suites.yml
33
- tests/Behat/Resources/suites.yml
44

55
default:
66
extensions:
7-
FriendsOfBehat\ContextServiceExtension:
8-
imports:
9-
- vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml
10-
- tests/Behat/Resources/services.xml
7+
Lakion\Behat\MinkDebugExtension:
8+
directory: etc/build
9+
clean_start: false
10+
screenshot: true
11+
12+
Behat\MinkExtension:
13+
files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/"
14+
base_url: "http://localhost:8080/"
15+
default_session: symfony
16+
javascript_session: chrome
17+
sessions:
18+
symfony:
19+
symfony: ~
20+
chrome:
21+
selenium2:
22+
browser: chrome
23+
capabilities:
24+
browserName: chrome
25+
browser: chrome
26+
version: ""
27+
marionette: null # https://github.com/Behat/MinkExtension/pull/311
28+
chrome:
29+
switches:
30+
- "start-fullscreen"
31+
- "start-maximized"
32+
- "no-sandbox"
33+
firefox:
34+
selenium2:
35+
browser: firefox
36+
show_auto: false
1137

1238
FriendsOfBehat\SymfonyExtension:
13-
env_file: tests/Application/.env.test
39+
bootstrap: tests/Application/config/bootstrap.php
1440
kernel:
15-
env: test
16-
debug: true
1741
class: Tests\Sylius\RefundPlugin\Application\Kernel
18-
path: tests/Application/Kernel.php
19-
bootstrap: ~
2042

21-
Lakion\Behat\MinkDebugExtension:
22-
directory: etc/build
23-
clean_start: false
24-
screenshot: true
43+
FriendsOfBehat\VariadicExtension: ~

composer.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"require": {
2222
"php": "^7.2",
2323
"knplabs/knp-snappy-bundle": "^1.5",
24-
"sylius/sylius": "1.3.*",
24+
"sylius/sylius": "^1.4",
2525
"symfony/messenger": "^4.2"
2626
},
2727
"require-dev": {
@@ -30,11 +30,9 @@
3030
"behat/mink-browserkit-driver": "^1.3",
3131
"behat/mink-extension": "^2.2",
3232
"behat/mink-selenium2-driver": "^1.3",
33-
"friends-of-behat/context-service-extension": "^1.2",
34-
"friends-of-behat/cross-container-extension": "^1.1",
35-
"friends-of-behat/page-object-extension": "^0.2.0",
36-
"friends-of-behat/service-container-extension": "^1.0",
37-
"friends-of-behat/symfony-extension": "^1.2.1",
33+
"friends-of-behat/page-object-extension": "^0.3",
34+
"friends-of-behat/suite-settings-extension": "^1.0",
35+
"friends-of-behat/symfony-extension": "^2.0",
3836
"friends-of-behat/variadic-extension": "^1.1",
3937
"lakion/mink-debug-extension": "^1.2.3",
4038
"phpspec/phpspec": "^4.0",
@@ -44,7 +42,7 @@
4442
"sylius-labs/coding-standard": "^2.0",
4543
"symfony/browser-kit": "^4.1",
4644
"symfony/debug-bundle": "^4.1",
47-
"symfony/dotenv": "^4.1",
45+
"symfony/dotenv": "^4.2",
4846
"symfony/framework-bundle": "^4.1",
4947
"symfony/intl": "^4.1",
5048
"symfony/web-profiler-bundle": "^4.1",

tests/Application/.env.prod.dist

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/Application/.env.test.dist

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/Application/.gitignore

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
/var/*
2-
!/var/.gitignore
3-
41
/public/assets
5-
/public/bundles
62
/public/css
73
/public/js
8-
/public/media
4+
/public/media/*
5+
!/public/media/image/
6+
/public/media/image/*
7+
!/public/media/image/.gitignore
98

10-
/vendor
119
/node_modules
1210

13-
/.env
14-
/.env.prod
15-
/.env.staging
16-
/.env.test
17-
/.env.test_cached
11+
###> symfony/framework-bundle ###
12+
/.env.*.local
13+
/.env.local
14+
/.env.local.php
15+
/public/bundles
16+
/var/
17+
/vendor/
18+
###< symfony/framework-bundle ###
19+
20+
###> symfony/web-server-bundle ###
21+
/.web-server-pid
22+
###< symfony/web-server-bundle ###

tests/Application/bin/console

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,38 @@
11
#!/usr/bin/env php
22
<?php
33

4-
declare(strict_types=1);
5-
4+
use Tests\Sylius\RefundPlugin\Application\Kernel;
65
use Symfony\Bundle\FrameworkBundle\Console\Application;
76
use Symfony\Component\Console\Input\ArgvInput;
87
use Symfony\Component\Debug\Debug;
9-
use Symfony\Component\Dotenv\Dotenv;
10-
use Tests\Sylius\RefundPlugin\Application\Kernel;
118

129
set_time_limit(0);
1310

1411
require __DIR__.'/../../../vendor/autoload.php';
1512

1613
if (!class_exists(Application::class)) {
17-
throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
14+
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
1815
}
1916

20-
if (!isset($_SERVER['APP_ENV'])) {
21-
if (!class_exists(Dotenv::class)) {
22-
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
23-
}
17+
$input = new ArgvInput();
18+
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
19+
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
20+
}
2421

25-
$envFile = file_exists(__DIR__.'/../.env') ? __DIR__.'/../.env' : __DIR__.'/../.env.dist';
26-
(new Dotenv())->load($envFile);
22+
if ($input->hasParameterOption('--no-debug', true)) {
23+
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
2724
}
2825

29-
$input = new ArgvInput();
30-
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true);
31-
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true);
26+
require dirname(__DIR__).'/config/bootstrap.php';
3227

33-
if ($debug) {
28+
if ($_SERVER['APP_DEBUG']) {
3429
umask(0000);
3530

3631
if (class_exists(Debug::class)) {
3732
Debug::enable();
3833
}
3934
}
4035

41-
$kernel = new Kernel($env, $debug);
36+
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
4237
$application = new Application($kernel);
4338
$application->run($input);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
use Symfony\Component\Dotenv\Dotenv;
4+
5+
require dirname(__DIR__).'../../../vendor/autoload.php';
6+
7+
// Load cached env vars if the .env.local.php file exists
8+
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
9+
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
10+
$_SERVER += $env;
11+
$_ENV += $env;
12+
} elseif (!class_exists(Dotenv::class)) {
13+
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
14+
} else {
15+
// load all the .env files
16+
(new Dotenv())->loadEnv(dirname(__DIR__).'/.env');
17+
}
18+
19+
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
20+
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
21+
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

tests/Application/config/bundles.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@
5757
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
5858
Sylius\RefundPlugin\SyliusRefundPlugin::class => ['all' => true],
5959
Knp\Bundle\SnappyBundle\KnpSnappyBundle::class => ['all' => true],
60+
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true],
6061
];

0 commit comments

Comments
 (0)