Upload
aoe
View
996
Download
0
Embed Size (px)
Citation preview
November 14th, 2015
• Introduction
• Extension Development
• Travis CI
• Scrutinizer
• Examples
• Questions
November 14th, 2015
Tomas Norre Mikkelsen
• TYPO3 - 2004 (Version: 3.6)
• AOE - June 2013
• TYPO3.org, TER, Crawler, PHPUnit
• Golf, #t3runners
• @tomasnorre
•
November 14th, 2015
Some people might think that
extension development is hard,
but it does not need to be!
November 14th, 2015
Working with Open Source
• Pull request (patches) • Code Reviews • Code Tests / Validation
November 14th, 2015
• PHP Unit (Unit / Functional tests) • PHP Linting • JavaScript Linting • TypoScript Linting • XML Linting
Toolset
November 14th, 2015
The benefits of using Github
• “All” have an account • Public code • Pull requests • Get feedback • Issue tracking • Wiki page • Travis CI integration (free) • Scrutinizer integration (free)
November 14th, 2015
Extension t3ee_example
https://github.com/tomasnorre/t3ee_example
• Simple Domain Model • Unit / Functional Test Coverage • Xliff, TypoScript, JavaScript • Travis CI • Scrutinizer
November 14th, 2015
Version Metrics
PHP/ TYPO3 6.2.15 7.6 (LTS) dev-master
5.4 x - -
5.5 x x (c) ?
5.6 x x ?
7.0 ? ? ?
hhvm x x ?
November 14th, 2015
php:-5.4-5.5-5.6-7.0-hhvm
env:-TYPO3_VERSION=6.2.15COVERAGE=0-TYPO3_VERSION=7.6COVERAGE=0-TYPO3_VERSION=dev-masterCOVERAGE=0
Which versions to use?
November 14th, 2015
matrix:exclude:-env:TYPO3_VERSION=7.6COVERAGE=0php:5.4-env:TYPO3_VERSION=dev-masterCOVERAGE=0php:5.4include:-php:5.5env:TYPO3_VERSION=7.6COVERAGE=1allow_failures:-env:TYPO3_VERSION=dev-masterCOVERAGE=0-php:7.0
Exclude/Include matrix
November 14th, 2015
addons:apt:packages:-parallel-libxml2-utils-nodejs-npmcache:directories:-$HOME/.composer/cache
before_install:-composerself-update-composer--version
What do we need to run the planned test? 1/3
November 14th, 2015
before_script:-composerrequiretypo3/cms=$TYPO3_VERSION#InstallTypoScriptLinter-mkdir-pscripts-cdscripts-gitclonehttps://github.com/tomasnorre/typo3-typoscript-lint.gittslint-cdtslint-composerinstall-cd../../#Restorecomposer.json-gitcheckoutcomposer.json-exportTYPO3_PATH_WEB=$PWD/.Build/Web
What do we need to run the planned test? 2/3
November 14th, 2015
#Before-scriptcontinued#LocatingUnitTests.xml-export"UNIT_XML"=`find.-name'UnitTests.xml'-typef`#LocationFunctionalTests.xml-export"FUNCTIONAL_XML"=`find.-name'FunctionalTests.xml'-typef`
What do we need to run the planned test? 3/3
November 14th, 2015
echo;echo"Runningxmllint(Xliff)";findResources/Private/Language/-name’*.xlf'-typef|xargsxmllint--noout--schemaMisc/Validation/Xliff.xsd
Linting | Xliff
November 14th, 2015
echo;echo"Runningphplint";find.-name\*.php!-path"./.Build/*"!-path"./scripts/*"!-path"./typo3_src/*"|parallel--gnuphp-ddisplay_errors=stderr-l{}>/dev/null\;
Linting | PHP
November 14th, 2015
echo;echo"RunningJavaScriptlint";npminstall-gjslint;findResources/Public/JavaScript/-name'*.js'-typef|xargsjslint
Linting | JavaScript
November 14th, 2015
PHPUnit (Unit)
if[["$COVERAGE"=="1"]];thenecho;echo"Runningunittests";.Build/bin/phpunit--coverage-clover=unittest-coverage.clover--colors-c$UNIT_XMLTests/Unit/fi
November 14th, 2015
PHPUnit (Functional)
if[["$COVERAGE"=="1"]];thenecho;echo"Runningfunctionaltests";exporttypo3DatabaseName="typo3";exporttypo3DatabaseHost="localhost";exporttypo3DatabaseUsername="root";exporttypo3DatabasePassword="";find'Tests/Functional'-wholename'*Test.php'|parallel--gnu'echo;echo"Runningfunctionaltestsuite{}";.Build/bin/phpunit--coverage-clover={}functionaltest-coverage.clover--colors-c$FUNCTIONAL_XML{}'fi
November 14th, 2015
Scrutinizer Upload
if[["$COVERAGE"=="1"]];thenecho;echo"Uploadingcodecoverageresults";wgethttps://scrutinizer-ci.com/ocular.pharphpocular.pharcode-coverage:upload--format=php-cloverunittest-coverage.cloverfind'Tests/Functional'-wholename'*Test.php'-execphpocular.pharcode-coverage:upload--format=php-clover{}functionaltest-coverage.clover\;fi
November 14th, 2015
Scrutinizer (.scrutinizer.yml)
tools:external_code_coverage:timeout:700runs:1php_code_sniffer:enabled:trueconfig:standard:TYPO3CMSphp_cs_fixer:enabled:truephp_mess_detector:enabled:trueconfig:controversial_rules:superglobals:false
November 14th, 2015
PHP Unit • 15 Unit tests run • 1 Functional test run
Lint Tests • 15 Xliff Runs
• 15 PHP Runs
• 15 TypoScript Runs • 15 Javascript Runs
Total • 76 Test runs
Scrutinizer • Code Coverage
• Code Sniffer
• Mess Detection
Test coverage