Skip to content

Commit 50cb32a

Browse files
authored
Feature migration sf5 (#109)
* Adding support sf5 * Removing support php5 * clean test
1 parent 6cff486 commit 50cb32a

File tree

23 files changed

+127
-97
lines changed

23 files changed

+127
-97
lines changed

.travis.yml

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
language: php
22

3-
sudo: false
3+
addons:
4+
chrome: stable
45

5-
php:
6-
- "5.4"
7-
- "5.5"
8-
- "5.6"
9-
- "7.0"
10-
- "7.1"
11-
- "7.2"
12-
- "nightly"
6+
sudo: false
137

148
env:
15-
matrix:
16-
- SYMFONY_VERSION=2
17-
- SYMFONY_VERSION=3
18-
- SYMFONY_VERSION=4
9+
global:
10+
- COMPOSER_MEMORY_LIMIT=-1
1911

2012
matrix:
2113
allow_failures:
2214
- php: nightly
2315
fast_finish: true
16+
include:
17+
- php: 7.1
18+
env: COMPOSER_FLAGS="--prefer-lowest"
19+
- php: 7.2
20+
- php: 7.3
21+
- php: 7.3
22+
env: SYMFONY_REQUIRE="3.4.*"
23+
- php: 7.3
24+
env: SYMFONY_REQUIRE="4.3.*"
25+
- php: 7.3
26+
env: SYMFONY_REQUIRE="4.4.*"
27+
- php: 7.4
28+
env: SYMFONY_REQUIRE="5.*"
2429

2530
cache:
2631
directories:
@@ -38,33 +43,30 @@ before_install:
3843

3944
- php -S localhost:8080 -t tests/web &> /dev/null &
4045
- ln -fs parameters.yml.dist tests/app/config/parameters.yml
41-
- test "$SYMFONY_VERSION" -eq 4 || composer require --no-update "symfony/lts:^$SYMFONY_VERSION"
46+
- composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
4247
- cd tests/
43-
- test "$SYMFONY_VERSION" -eq 4 || composer require --no-update "symfony/lts:^$SYMFONY_VERSION"
48+
- composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
4449
- cd ..
4550

4651
install:
47-
- echo 'memory_limit=-1' > travis.php.ini
48-
- phpenv config-add travis.php.ini
49-
50-
- composer update
51-
52+
- composer update -n --prefer-dist --prefer-stable $COMPOSER_FLAGS
5253
- cd tests/
53-
- composer update
54+
- composer update -n --prefer-dist --prefer-stable $COMPOSER_FLAGS
5455
- rm -rf vendor/pomm-project/pomm-bundle
5556
- ln -s ../../../ vendor/pomm-project/pomm-bundle
5657

5758
before_script:
58-
- |
59-
export CURRENT_SYMFONY_VERSION=$( \
60-
composer show --format=json \
61-
| jq '.installed[] | select(.name == "symfony/symfony") | .version' \
62-
| sed 's/^"v\([0-9]\+\)\.[^"]*"/\1/' \
63-
)
64-
- echo $CURRENT_SYMFONY_VERSION
59+
- CHROME_MAIN_VERSION=`google-chrome-stable --version | sed -E 's/(^Google Chrome |\.[0-9]+ )//g'`
60+
- CHROMEDRIVER_VERSION=`curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAIN_VERSION"`
61+
- curl "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" -O
62+
- unzip chromedriver_linux64.zip -d ~/bin
63+
64+
- wget "https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar" -O selenium.jar
65+
- java -jar selenium.jar &> /dev/null &
66+
6567

6668
script:
6769
- ../vendor/bin/phpcs --standard=psr2 --runtime-set ignore_warnings_on_exit true --report=summary ../sources
6870
- ./app/console pomm:generate:schema-all -d 'src/' -a 'AppBundle\Model' my_db1
69-
- ./bin/behat --tags "~@upper${CURRENT_SYMFONY_VERSION}lts"
71+
- ./bin/behat
7072
- ./app/console pomm:generate:schema-all default_session_builder

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.4.4",
19+
"php": ">=7.1",
2020
"jdorn/sql-formatter": "~1.2",
2121
"pomm-project/model-manager": "~2.0",
2222
"pomm-project/cli": "~2.0",
23-
"pomm-project/pomm-symfony-bridge": "~2.5",
24-
"symfony/framework-bundle": "~2.8|~3.0|~4.0"
23+
"pomm-project/pomm-symfony-bridge": "~2.5|~3.0",
24+
"symfony/framework-bundle": "^3.4|^4.3|^5.0"
2525
},
2626
"require-dev": {
27-
"symfony/console": "~2.6|~3.0|~4.0",
27+
"symfony/console": "^3.4|^4.3|^5.0",
2828
"squizlabs/php_codesniffer": "~2.7"
2929
},
3030
"suggest": {

sources/lib/DependencyInjection/Configuration.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ class Configuration implements ConfigurationInterface
3232
*/
3333
public function getConfigTreeBuilder()
3434
{
35-
$treeBuilder = new TreeBuilder();
36-
$rootNode = $treeBuilder->root('pomm');
35+
$treeBuilder = new TreeBuilder('pomm');
36+
$rootNode = method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('pomm');
37+
3738
$rootNode
3839
->children()
3940
->arrayNode('configuration')

tests/app/config/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ framework:
66
#translator: { fallback: "%locale%" }
77
secret: "%secret%"
88
router:
9-
resource: "%kernel.root_dir%/config/routing.yml"
9+
resource: "%kernel.project_dir%/app/config/routing.yml"
1010
strict_requirements: ~
1111
form: ~
1212
csrf_protection: ~
1313
validation: { enable_annotations: true }
14-
templating:
15-
engines: ['twig']
14+
1615
#assets_version: SomeVersionScheme
1716
default_locale: "%locale%"
1817
trusted_hosts: ~
@@ -30,6 +29,7 @@ framework:
3029
twig:
3130
debug: "%kernel.debug%"
3231
strict_variables: "%kernel.debug%"
32+
paths: ['%kernel.project_dir%/templates']
3333

3434
pomm:
3535
configuration:

tests/app/config/config_dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ imports:
33

44
framework:
55
router:
6-
resource: "%kernel.root_dir%/config/routing_dev.yml"
6+
resource: "%kernel.project_dir%/app/config/routing_dev.yml"
77
strict_requirements: true
88
profiler: { only_exceptions: false }
99

tests/app/console

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Symfony\Bundle\FrameworkBundle\Console\Application;
99
use Symfony\Component\Console\Input\ArgvInput;
10-
use Symfony\Component\Debug\Debug;
1110

1211
set_time_limit(0);
1312

@@ -18,7 +17,11 @@ $env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?:
1817
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
1918

2019
if ($debug) {
21-
Debug::enable();
20+
if (class_exists('\Symfony\Component\ErrorHandler\Debug')) {
21+
\Symfony\Component\ErrorHandler\Debug::enable();
22+
}else{
23+
\Symfony\Component\Debug\Debug::enable();
24+
}
2225
}
2326

2427
$kernel = new AppKernel($env, $debug);

tests/behat.yml.dist

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,19 @@ default:
66
- FeatureContext
77
- behatch:context:json
88
extensions:
9-
Behat\MinkExtension\ServiceContainer\MinkExtension:
9+
Behat\MinkExtension:
1010
base_url: 'http://localhost:8080'
11-
goutte: ~
11+
browser_name: chrome
12+
sessions:
13+
default:
14+
selenium2:
15+
wd_host: "http://localhost:4444/wd/hub"
16+
browser: chrome
17+
capabilities:
18+
extra_capabilities:
19+
chromeOptions:
20+
args:
21+
- "--headless"
22+
- "--disable-gpu"
23+
- "--no-sandbox"
1224
Behatch\Extension: ~

tests/composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{
22
"require": {
3-
"symfony/symfony": "~2.8|~3.0|~4.0",
3+
"symfony/symfony": "^3.4|^4.3|^5.0",
44
"symfony/monolog-bundle": "~3.0",
55
"twig/extensions": "~1.0",
6-
"sensio/framework-extra-bundle": "~3.0,>=3.0.2|~4.0",
6+
"sensio/framework-extra-bundle": "^3.4|^4.3|^5.0",
77
"pomm-project/cli": "~2.0",
88
"pomm-project/foundation": "~2.0",
99
"pomm-project/model-manager": "~2.0",
10-
"pomm-project/pomm-bundle": "dev-master",
11-
"pomm-project/pomm-symfony-bridge": "~2.5"
10+
"pomm-project/pomm-symfony-bridge": "~2.5|dev-master",
11+
"symfony/framework-bundle": "^3.4|^4.3|^5.0",
12+
"jdorn/sql-formatter": "~1.2"
1213
},
1314
"require-dev": {
14-
"behatch/contexts": "~2.7|~3.0",
15-
"behat/mink-extension": "~2.2",
16-
"behat/mink": "*@dev",
17-
"behat/mink-browserkit-driver": "*@dev",
18-
"behat/mink-goutte-driver": "*"
15+
"behatch/contexts": "~3.0",
16+
"behat/mink-selenium2-driver": "dev-master",
17+
"instaclick/php-webdriver": "1.4.7"
1918
},
2019
"autoload": {
2120
"psr-0": { "AppBundle\\": "src/" },
21+
"psr-4": { "PommProject\\PommBundle\\": "../sources/lib/" },
2222
"classmap": [ "app/AppKernel.php" ]
2323
},
2424
"autoload-dev": {

tests/src/AppBundle/Controller/AutowireController.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,28 @@
66
namespace AppBundle\Controller;
77
use AppBundle\Model\MyDb1\PublicSchema\ConfigModel;
88
use PommProject\Foundation\Pomm;
9-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
9+
use Symfony\Component\HttpFoundation\Response;
10+
use Twig\Environment;
11+
1012
/**
1113
* @author Mikael Paris <stood86@gmail.com>
1214
*/
13-
class AutowireController extends Controller
15+
class AutowireController
1416
{
15-
public function getAutowireAction($name, Pomm $pomm)
17+
public function getAutowireAction(
18+
$name,
19+
Pomm $pomm,
20+
Environment $engine
21+
)
1622
{
1723
$config = $pomm
1824
->getDefaultSession()
1925
->getModel(ConfigModel::class)
2026
->findByPk(['name' => $name]);
21-
return $this->render(
22-
'AppBundle:Front:get.html.twig',
27+
28+
return new Response($engine->render(
29+
'Front/get.html.twig',
2330
compact('config')
24-
);
31+
));
2532
}
2633
}

tests/src/AppBundle/Controller/IndexController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use \Symfony\Component\Serializer\Serializer;
1010
use \Symfony\Component\HttpFoundation\Response;
1111
use \Symfony\Component\Templating\EngineInterface;
12-
use \Symfony\Component\PropertyInfo\PropertyInfoExtractor;
12+
use \Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
1313

1414
class IndexController
1515
{
@@ -20,10 +20,10 @@ class IndexController
2020
private $serviceModel;
2121

2222
public function __construct(
23-
EngineInterface $templating,
23+
$templating,
2424
Session $pomm,
2525
Serializer $serializer,
26-
PropertyInfoExtractor $property,
26+
PropertyInfoExtractorInterface $property,
2727
Session $serviceSession,
2828
ServiceModel $serviceModel
2929
) {
@@ -42,7 +42,7 @@ public function indexAction()
4242

4343
return new Response(
4444
$this->templating->render(
45-
'AppBundle:Front:index.html.twig'
45+
'Front/index.html.twig'
4646
)
4747
);
4848
}
@@ -51,7 +51,7 @@ public function getAction(Config $config = null)
5151
{
5252
return new Response(
5353
$this->templating->render(
54-
'AppBundle:Front:get.html.twig',
54+
'Front/get.html.twig',
5555
compact('config')
5656
)
5757
);
@@ -66,7 +66,7 @@ public function getDefaultSessionAction(Config $config)
6666
{
6767
return new Response(
6868
$this->templating->render(
69-
'AppBundle:Front:get.html.twig',
69+
'Front/get.html.twig',
7070
compact('config')
7171
)
7272
);
@@ -81,7 +81,7 @@ public function getSessionAction(Config $config)
8181
{
8282
return new Response(
8383
$this->templating->render(
84-
'AppBundle:Front:get.html.twig',
84+
'Front/get.html.twig',
8585
compact('config')
8686
)
8787
);
@@ -96,7 +96,7 @@ public function getSession2Action(Config $config)
9696
{
9797
return new Response(
9898
$this->templating->render(
99-
'AppBundle:Front:get.html.twig',
99+
'Front/get.html.twig',
100100
compact('config')
101101
)
102102
);
@@ -143,7 +143,7 @@ public function propertyListAction()
143143

144144
return new Response(
145145
$this->templating->render(
146-
'AppBundle:Front:properties.html.twig',
146+
'Front/properties.html.twig',
147147
compact('info')
148148
)
149149
);
@@ -155,7 +155,7 @@ public function propertyTypeAction($property)
155155

156156
return new Response(
157157
$this->templating->render(
158-
'AppBundle:Front:property.html.twig',
158+
'Front/property.html.twig',
159159
compact('info')
160160
)
161161
);

0 commit comments

Comments
 (0)