Skip to content

Commit eaac598

Browse files
authored
Configure symfony harness (#394)
1 parent 6b6be5b commit eaac598

27 files changed

+597
-43
lines changed

Diff for: deploy-preview

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44
set -x
55

6-
HARNESSES=(akeneo)
6+
HARNESSES=(symfony)
77

88
function main()
99
{

Diff for: src/_base/harness/attributes/common.yml

+2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ attributes.default:
205205
database:
206206
# possible platforms are mysql, postgres or ~ for none
207207
platform: mysql
208+
platform_version: 5.7
208209
host: mysql
210+
port: 3306
209211
user: app
210212
pass: app
211213
name: app

Diff for: src/_base/harness/attributes/docker-base.yml

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ attributes:
66
APP_NAME: = @('workspace.name')
77
APP_HOST: = @('hostname')
88
DB_PLATFORM: = @('database.platform')
9+
DB_PLATFORM_VERSION: = @('database.platform_version')
910
DB_HOST: = @('database.host')
11+
DB_PORT: = @('database.port')
1012
DB_USER: = @('database.user')
1113
DB_NAME: = @('database.name')
1214
ELASTICSEARCH_HOST: = @('elasticsearch.host')

Diff for: src/symfony/.ci/sample-dynamic/harnesses.json

-8
This file was deleted.

Diff for: src/symfony/.ci/sample-dynamic/workspace.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,9 @@ workspace('ci-symfony-sample-dynamic'):
22
description: generated local workspace for ci-symfony-sample.
33
harness: inviqa/symfony
44

5-
harness.repository.source('name'): ./harnesses.json
6-
75
attribute('aws.bucket'): null
86
attribute('app.repository'): null
97
attribute('aws.id'): null
108
attribute('aws.key'): null
119

12-
before('harness.install'): |
13-
#!bash(workspace:/)|@
14-
if [ ! -d web/ ]; then
15-
mkdir web
16-
fi
17-
if [ ! -d vendor/ ]; then
18-
mkdir vendor
19-
fi
20-
if [ ! -f web/index.php ]; then
21-
echo "<?php echo('Hello, @('workspace.name')');" > web/index.php
22-
fi
10+
attribute('composer.auth.github'): = decrypt("YTozOntpOjA7czo3OiJkZWZhdWx0IjtpOjE7czoyNDoiZfbsRN210rxOzGyHhH74tuXtFxak6prxIjtpOjI7czo1Njoi7NjB2oXZJ3/wQsccea2VPeYEjU72koVub89ezkdQzAzOaaFwD2Rm1pbhWXR7aYgpUdXmNmO8g5YiO30=")

Diff for: src/symfony/.ci/sample-static/harnesses.json

-8
This file was deleted.

Diff for: src/symfony/.ci/sample-static/workspace.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,11 @@ workspace('ci-symfony-sample-static'):
22
description: generated local workspace for ci-symfony-sample.
33
harness: inviqa/symfony
44

5-
harness.repository.source('name'): ./harnesses.json
6-
75
attribute('app.build'): static
86

97
attribute('aws.bucket'): null
108
attribute('app.repository'): null
119
attribute('aws.id'): null
1210
attribute('aws.key'): null
1311

14-
before('harness.install'): |
15-
#!bash(workspace:/)|@
16-
if [ ! -d web/ ]; then
17-
mkdir web
18-
fi
19-
if [ ! -d vendor/ ]; then
20-
mkdir vendor
21-
fi
22-
if [ ! -f web/index.php ]; then
23-
echo "<?php echo('Hello, @('workspace.name')');" > web/index.php
24-
fi
12+
attribute('composer.auth.github'): = decrypt("YTozOntpOjA7czo3OiJkZWZhdWx0IjtpOjE7czoyNDoiZfbsRN210rxOzGyHhH74tuXtFxak6prxIjtpOjI7czo1Njoi7NjB2oXZJ3/wQsccea2VPeYEjU72koVub89ezkdQzAzOaaFwD2Rm1pbhWXR7aYgpUdXmNmO8g5YiO30=")

Diff for: src/symfony/application/overlay/phpcs.xml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Symfony">
3+
<description>PHPCS ruleset for Symfony</description>
4+
<file>./src</file>
5+
<rule ref="PSR2" />
6+
<rule ref="Generic.Files.LineLength">
7+
<properties>
8+
<property name="lineLimit" value="180" />
9+
<property name="absoluteLineLimit" value="250" />
10+
</properties>
11+
</rule>
12+
</ruleset>

Diff for: src/symfony/application/overlay/phpmd.xml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Inviqa"
3+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
6+
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
7+
8+
<description>Inviqa ruleset</description>
9+
10+
<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>
11+
<rule ref="rulesets/codesize.xml/NPathComplexity"/>
12+
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity"/>
13+
<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>
14+
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>
15+
<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
16+
<rule ref="rulesets/codesize.xml/TooManyMethods"/>
17+
18+
<rule ref="rulesets/controversial.xml/Superglobals"/>
19+
20+
<rule ref="rulesets/design.xml/EvalExpression"/>
21+
<rule ref="rulesets/design.xml/ExitExpression"/>
22+
<rule ref="rulesets/design.xml/GotoStatement"/>
23+
<rule ref="rulesets/design.xml/DevelopmentCodeFragment"/>
24+
25+
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass"/>
26+
<rule ref="rulesets/naming.xml/ShortMethodName"/>
27+
<rule ref="rulesets/naming.xml/ConstantNamingConventions"/>
28+
29+
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
30+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
31+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
32+
</ruleset>

Diff for: src/symfony/application/skeleton/.gitignore

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
###> symfony/framework-bundle ###
3+
/.env.local
4+
/.env.local.php
5+
/.env.*.local
6+
/config/secrets/prod/prod.decrypt.private.php
7+
/public/bundles/
8+
/src/preload.php
9+
/var/
10+
/vendor/
11+
###< symfony/framework-bundle ###
12+
13+
###> symfony/phpunit-bridge ###
14+
.phpunit
15+
.phpunit.result.cache
16+
/phpunit.xml
17+
###< symfony/phpunit-bridge ###
18+
19+
# Directories
20+
/.my127ws
21+
/bin/*
22+
/.docker-sync/
23+
/tools/assets/
24+
/vendor/
25+
26+
# Files
27+
/.dockerignore
28+
/auth.json
29+
/docker-compose.yml
30+
/docker-sync.yml
31+
/env.sh
32+
/mutagen.yml
33+
/mutagen.yml.lock
34+
/phpcs.xml
35+
/phpmd.xml
36+
/phpunit.xml
37+
/phpunit.xml.dist
38+
/workspace.override.yml
39+
40+
# Exclusions
41+
!/bin/console

Diff for: src/symfony/application/skeleton/behat.yml.twig

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
default:
2+
suites:
3+
web_with_mink:
4+
paths:
5+
- features/web
6+
contexts:
7+
- Inviqa\Acceptance\Context\WebWithMinkContext
8+
9+
web_with_page_objects_first:
10+
paths:
11+
- features/web
12+
contexts:
13+
- Inviqa\Acceptance\Context\WebWithPageObjectsWithFactoryInjectionContext
14+
15+
web_with_page_objects_second:
16+
paths:
17+
- features/web
18+
contexts:
19+
- Inviqa\Acceptance\Context\WebWithPageObjectsWithConstructorInjectionContext
20+
21+
extensions:
22+
Behat\MinkExtension:
23+
base_url: 'https://{{ @('hostname') }}'
24+
default_session: goutte
25+
javascript_session: chrome
26+
sessions:
27+
goutte:
28+
goutte:
29+
guzzle_parameters:
30+
verify: false
31+
chrome:
32+
chrome:
33+
api_url: "http://chrome:9222"
34+
validate_certificate: false
35+
local_chrome:
36+
chrome:
37+
api_url: "http://host.docker.internal:9222"
38+
SensioLabs\Behat\PageObjectExtension:
39+
namespaces:
40+
page: [Inviqa\Acceptance\Page]
41+
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
42+
43+
local: # (google-chrome-stable --remote-debugging-port=9221 &) && socat tcp-l:9222,fork TCP4:127.0.0.1:9221
44+
extensions:
45+
Behat\MinkExtension\ServiceContainer\MinkExtension:
46+
default_session: local_chrome
47+
javascript_session: local_chrome

Diff for: src/symfony/application/skeleton/composer.json.twig

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"name": "{{ @('workspace.name')|lower }}/symfony",
3+
"type": "project",
4+
"license": "proprietary",
5+
"require": {
6+
"php": ">=7.2.5",
7+
"ext-ctype": "*",
8+
"ext-iconv": "*",
9+
"symfony/console": "5.1.*",
10+
"symfony/dotenv": "5.1.*",
11+
"symfony/flex": "^1.3.1",
12+
"symfony/framework-bundle": "5.1.*",
13+
"symfony/yaml": "5.1.*"
14+
},
15+
"require-dev": {
16+
"behat/behat": "^3.5",
17+
"behat/mink-extension": "^2.3",
18+
"behat/mink-goutte-driver": "^1.2",
19+
"behat/mink-browserkit-driver": "dev-master#90c1c9065ee2f41c134b54da1a3e72cc2cd18fd0",
20+
"dmore/behat-chrome-extension": "^1.3",
21+
"dmore/chrome-mink-driver": "^2.7",
22+
"phpcompatibility/php-compatibility": "dev-master",
23+
"phpmd/phpmd": "^2.7",
24+
"phpspec/phpspec": "^6.0",
25+
"phpstan/phpstan": "^0.12",
26+
"phpunit/phpunit": "^9.3",
27+
"sensiolabs/behat-page-object-extension": "^2.3",
28+
"slevomat/coding-standard": "^6.0",
29+
"squizlabs/php_codesniffer": "^3.5",
30+
"symfony/phpunit-bridge": "^5.1"
31+
},
32+
"config": {
33+
"bin-dir": "bin",
34+
"optimize-autoloader": true,
35+
"platform": {
36+
"php": "7.3.17"
37+
},
38+
"preferred-install": {
39+
"*": "dist"
40+
},
41+
"sort-packages": true
42+
},
43+
"autoload": {
44+
"psr-4": {
45+
"App\\": "src/"
46+
}
47+
},
48+
"autoload-dev": {
49+
"psr-4": {
50+
"App\\Tests\\": "tests/",
51+
"Inviqa\\Acceptance\\": "features/bootstrap"
52+
}
53+
},
54+
"replace": {
55+
"paragonie/random_compat": "2.*",
56+
"symfony/polyfill-ctype": "*",
57+
"symfony/polyfill-iconv": "*",
58+
"symfony/polyfill-php72": "*",
59+
"symfony/polyfill-php71": "*",
60+
"symfony/polyfill-php70": "*",
61+
"symfony/polyfill-php56": "*"
62+
},
63+
"scripts": {
64+
"auto-scripts": {
65+
"cache:clear": "symfony-cmd",
66+
"assets:install %PUBLIC_DIR%": "symfony-cmd"
67+
},
68+
"post-install-cmd": [
69+
"@auto-scripts"
70+
],
71+
"post-update-cmd": [
72+
"@auto-scripts"
73+
],
74+
"test": [
75+
"@test-production-quality",
76+
"@test-quality",
77+
"@test-unit",
78+
"@test-acceptance"
79+
],
80+
"test-production-quality": [
81+
"bash -e -o pipefail -c \"find src/ -type f -name '*.php' -print0 | xargs -0 --no-run-if-empty -n 1 -P 8 -i php -l {} | (grep -v 'No syntax errors detected' || echo OK)\""
82+
],
83+
"test-quality": [
84+
"phpcs -p",
85+
"phpstan analyse",
86+
"phpmd ./src text ./phpmd.xml"
87+
],
88+
"test-unit": [
89+
"phpspec run"
90+
],
91+
"test-acceptance": [
92+
"behat"
93+
],
94+
"fix-code": [
95+
"phpcbf -p"
96+
],
97+
"compatibility": "bin/phpcs -s --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility/ --runtime-set testVersion 7.3-"
98+
},
99+
"conflict": {
100+
"symfony/symfony": "*"
101+
},
102+
"extra": {
103+
"symfony": {
104+
"allow-contrib": false,
105+
"require": "5.1.*"
106+
}
107+
},
108+
"repositories": {
109+
"mink-browserkit-driver": {
110+
"type": "vcs",
111+
"url": "https://github.com/Daniel-Marynicz/MinkBrowserKitDriver.git"
112+
}
113+
},
114+
"minimum-stability": "stable"
115+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parameters:
2+
env(DATABASE_URL): "%env(DB_PLATFORM)%://%env(DB_USER)%:%env(DB_PASS)%@%env(DB_HOST)%:%env(DB_PORT)%/%env(DB_NAME)%?serverVersion=%env(DB_PLATFORM_VERSION)%"

Diff for: src/symfony/application/skeleton/config/routes.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
homepage:
2+
path: /
3+
controller: App\Controller\ExampleController::homepage
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Inviqa\Acceptance\Context;
4+
5+
use Behat\Behat\Context\Context;
6+
use Behat\Behat\Tester\Exception\PendingException;
7+
use Behat\MinkExtension\Context\MinkContext;
8+
9+
class WebWithMinkContext extends MinkContext
10+
{
11+
/**
12+
* @When I visit the home page
13+
*/
14+
public function iVisitTheHomePage()
15+
{
16+
$this->iAmOnHomepage();
17+
}
18+
19+
/**
20+
* @Then I should see the home page
21+
*/
22+
public function iShouldSeeTheHomePage()
23+
{
24+
$this->assertHomepage();
25+
$this->assertResponseStatus(200);
26+
}
27+
}

0 commit comments

Comments
 (0)