From d7062bc09a76e6ae381718ebc2181742352f66c2 Mon Sep 17 00:00:00 2001
From: Thorsten Reiser <tr@dinited.com>
Date: Wed, 4 Sep 2019 02:54:03 +0200
Subject: [PATCH 1/3] run travis on application

---
 .travis.yml    | 32 ++++++++++++++++++++++++++++++++
 travis.php.ini |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 .travis.yml
 create mode 100644 travis.php.ini

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..789aa21249
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,32 @@
+dist: xenial
+
+language: php
+
+branches:
+  only:
+    - master
+    - /^\d+\.\d+$/
+
+php:
+    - 7.1.26
+
+env:
+  - COMPOSER=travis.json
+
+cache:
+  directories:
+    - $HOME/.composer
+
+before_script:
+  - phpenv config-rm xdebug.ini
+  - phpenv config-add travis.php.ini
+  - composer self-update
+  - cp dev.json travis.json # avoid dev.lock file and composer.json with a stable version
+  - travis_retry travis_wait composer install --prefer-dist --optimize-autoloader --no-interaction  --no-suggest
+  - set +e; DIFF=$(git diff --name-only --diff-filter=ACMR $TRAVIS_COMMIT_RANGE | grep -e ".*\.php$"); set -e;
+
+script:
+  - ./vendor/bin/phpunit
+  - ./vendor/bin/phpcs ./src -p --encoding=utf-8 --extensions=php --standard=PSR2
+  - ./vendor/bin/php-cs-fixer fix --dry-run --config=./build/.php_cs --path-mode=intersection ./src
+  - if [[ $DIFF ]]; then ./vendor/bin/phpmd ${DIFF//$'\n'/,} text ./build/phpmd.xml --suffixes php; fi
diff --git a/travis.php.ini b/travis.php.ini
new file mode 100644
index 0000000000..7999e96156
--- /dev/null
+++ b/travis.php.ini
@@ -0,0 +1 @@
+memory_limit = -1

From 7d81a8582021fac5a14c058055d5995f9877f286 Mon Sep 17 00:00:00 2001
From: Thorsten Reiser <tr@dinited.com>
Date: Wed, 4 Sep 2019 03:31:59 +0200
Subject: [PATCH 2/3] added missing phpmd and php_cs

---
 .travis.yml     |  6 +++---
 build/.php_cs   | 53 +++++++++++++++++++++++++++++++++++++++++++++++++
 build/phpmd.xml | 40 +++++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+), 3 deletions(-)
 create mode 100644 build/.php_cs
 create mode 100644 build/phpmd.xml

diff --git a/.travis.yml b/.travis.yml
index 789aa21249..42a9a2a782 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,7 +26,7 @@ before_script:
   - set +e; DIFF=$(git diff --name-only --diff-filter=ACMR $TRAVIS_COMMIT_RANGE | grep -e ".*\.php$"); set -e;
 
 script:
-  - ./vendor/bin/phpunit
-  - ./vendor/bin/phpcs ./src -p --encoding=utf-8 --extensions=php --standard=PSR2
-  - ./vendor/bin/php-cs-fixer fix --dry-run --config=./build/.php_cs --path-mode=intersection ./src
+  - ./bin/phpunit
+  - ./bin/phpcs ./src -p --encoding=utf-8 --extensions=php --standard=PSR2
+  - ./bin/php-cs-fixer fix --dry-run --config=./build/.php_cs --path-mode=intersection ./src
   - if [[ $DIFF ]]; then ./vendor/bin/phpmd ${DIFF//$'\n'/,} text ./build/phpmd.xml --suffixes php; fi
diff --git a/build/.php_cs b/build/.php_cs
new file mode 100644
index 0000000000..6c40d222f3
--- /dev/null
+++ b/build/.php_cs
@@ -0,0 +1,53 @@
+#!/usr/bin/env php
+<?php
+
+$finder = PhpCsFixer\Finder::create()
+    ->in([__DIR__.'/../..'])
+    ->notPath('doctrine-extensions')
+    ->files()
+    ->name('*.php')
+    ->notName('*.php.twig')
+    ->notName('OroKernel.php');
+
+// https://github.com/mlocati/php-cs-fixer-configurator
+return PhpCsFixer\Config::create()
+    ->setRules(
+        [
+            // generic PSRs
+            '@PSR1' => true,
+            '@PSR2' => true,
+            'psr0' => true,
+            'psr4' => true,
+
+            // imports
+            'ordered_imports' => true,
+            'no_unused_imports' => true,
+            'no_extra_consecutive_blank_lines' => ['use'],
+            'php_unit_namespaced' => ['target' => '6.0'],
+            'php_unit_expectation' => true,
+
+            // Symfony, but exclude Oro cases
+//            '@Symfony' => true,
+//            '@Symfony:risky' => true,
+//            'yoda_style' => false,
+
+//            '@DoctrineAnnotation' => true,
+//            'align_multiline_comment' => ['comment_type' => 'phpdocs_only'],
+//            'array_syntax' => ['syntax' => 'short'],
+//            'binary_operator_spaces' => false,
+//            'blank_line_before_return' => true,
+//            'declare_strict_types' => false,
+//            'increment_style' => false,
+//            'list_syntax' => ['syntax' => 'short'],
+//            'multiline_comment_opening_closing' => false,
+//            'space_after_semicolon' => true,
+//            'no_empty_statement' => true,
+//            'phpdoc_add_missing_param_annotation' => true,
+//            'phpdoc_align' => ['tags' => ['param']],
+//            'phpdoc_order' => true,
+//            'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
+        ]
+    )
+    ->setFinder($finder)
+    ->setRiskyAllowed(true)
+    ->setCacheFile(__DIR__.DIRECTORY_SEPARATOR.'.php_cs.cache');
diff --git a/build/phpmd.xml b/build/phpmd.xml
new file mode 100644
index 0000000000..deb0db7a68
--- /dev/null
+++ b/build/phpmd.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<ruleset name="Custom rule set for Oro Projects"
+         xmlns="http://pmd.sf.net/ruleset/1.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
+         xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+    <description>
+        Custom rule set that is used to check the code of the Oro Projects...
+    </description>
+    <rule ref="rulesets/codesize.xml">
+        <exclude name="CyclomaticComplexity"/>
+        <exclude name="TooManyMethods"/>
+        <exclude name="TooManyPublicMethods"/>
+        <exclude name="TooManyFields"/>
+    </rule>
+    <rule ref="rulesets/codesize.xml/CyclomaticComplexity">
+        <priority>1</priority>
+        <properties>
+            <property name="reportLevel" value="15"/>
+        </properties>
+    </rule>
+    <rule ref="rulesets/codesize.xml/TooManyMethods">
+        <priority>1</priority>
+        <properties>
+            <property name="maxmethods" value="50"/>
+        </properties>
+    </rule>
+    <rule ref="rulesets/codesize.xml/TooManyPublicMethods">
+        <priority>1</priority>
+        <properties>
+            <property name="maxmethods" value="50"/>
+        </properties>
+    </rule>
+    <rule ref="rulesets/codesize.xml/TooManyFields">
+        <priority>1</priority>
+        <properties>
+            <property name="maxfields" value="25"/>
+        </properties>
+    </rule>
+</ruleset>

From b6550fb5374781b4a87d72a396944659cd043f2a Mon Sep 17 00:00:00 2001
From: Thorsten Reiser <tr@dinited.com>
Date: Wed, 4 Sep 2019 03:35:28 +0200
Subject: [PATCH 3/3] added travis snippet in readme to verify

---
 README.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/README.md b/README.md
index d17f3376b8..2f255a2d68 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
 OroPlatform Application
 =======================
 
+[![Travis CI build status](https://travis-ci.org/reiser/platform-application.svg?branch=master)](https://https://travis-ci.org/reiser/platform-application)
+
 What is OroPlatform?
 --------------------