Last active
September 3, 2016 16:46
-
-
Save tolleiv/5520430 to your computer and use it in GitHub Desktop.
TYPO3 CI Scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
require_once '###path###/t3/typo3/sysext/core/Classes/Core/Bootstrap.php'; | |
define('TYPO3_MODE', 'BE'); | |
define('TYPO3_cliMode', TRUE); | |
unset($_SERVER['argv'][0]); | |
$_ENV['_'] = '###path###/t3/i.php'; | |
require_once '###path###/t3/typo3/sysext/core/Classes/Core/CliBootstrap.php'; | |
\TYPO3\CMS\Core\Core\CliBootstrap::checkEnvironmentOrDie(); | |
require_once '###path###/t3/typo3/sysext/core/Classes/Core/Bootstrap.php'; | |
\TYPO3\CMS\Core\Core\Bootstrap::getInstance() | |
->baseSetup('') | |
->loadConfigurationAndInitialize() | |
->loadTypo3LoadedExtAndExtLocalconf(FALSE) | |
->applyAdditionalConfigurationSettings() | |
->initializeTypo3DbGlobal(TRUE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED | E_WARNING)); | |
define('TYPO3_MODE','BE'); | |
define('TYPO3_cliMode', TRUE); | |
unset($_SERVER['argv'][0]); | |
define('TYPO3_OS', stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':''); | |
define('PATH_thisScript', __DIR__.'/t3/typo3'); | |
define('PATH_site', __DIR__.'/t3/'); // the path to the website folder (see init.php) | |
define('PATH_t3lib', PATH_site.'t3lib/'); | |
define('PATH_typo3conf', PATH_site.'typo3conf/'); | |
define('TYPO3_mainDir', 'typo3/'); // This is the directory of the backend administration for the sites of this TYPO3 installation. | |
define('PATH_typo3', PATH_site.TYPO3_mainDir); | |
define('PATH_tslib', PATH_site.'typo3/sysext/cms/tslib/'); | |
global $TYPO3_CONF_VARS,$TYPO3_DB; | |
// ****************** | |
// Including config | |
// ****************** | |
require_once(PATH_t3lib.'class.t3lib_div.php'); | |
require_once(PATH_t3lib.'class.t3lib_extmgm.php'); | |
require(PATH_t3lib.'config_default.php'); | |
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "aoe/ci-testing", | |
"description": "description_text", | |
"minimum-stability": "stable", | |
"authors": [ | |
{ | |
"name": "Tolleiv Nietsch", | |
"email": "[email protected]" | |
} | |
], | |
"require-dev": { | |
"phpunit/phpunit": "*", | |
"whatthejeff/nyancat-phpunit-resultprinter": "1.0.*@dev" | |
}, | |
"minimum-stability": "dev" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright 2013 - Tolleiv Nietsch <[email protected]> | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$typo_db_username = 'nothing'; | |
$typo_db_password = 'nothing'; | |
$typo_db_host = '###path###/db.sqlite'; | |
$typo_db = 'nothing'; | |
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = 'cms,setup,install,rsaauth,saltedpasswords,extbase,fluid,version,workspaces,phpunit,###ext###'; | |
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extList_FE'] = 'cms,setup,install,rsaauth,saltedpasswords,extbase,fluid,version,workspaces,phpunit,###ext###'; | |
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'] = FALSE; | |
$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = '1'; | |
$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog'] = FALSE; | |
$GLOBALS['TYPO3_CONF_VARS']['SYS']['useCachingFramework'] = FALSE; | |
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching'] = array( | |
'cacheConfigurations' => array( | |
'cache_hash' => array( | |
'frontend' => 't3lib_cache_frontend_VariableFrontend', | |
'backend' => 't3lib_cache_backend_NullBackend', | |
'options' => array(), | |
), | |
'cache_pages' => array( | |
'frontend' => 't3lib_cache_frontend_VariableFrontend', | |
'backend' => 't3lib_cache_backend_NullBackend', | |
'options' => array(), | |
), | |
'cache_pagesection' => array( | |
'frontend' => 't3lib_cache_frontend_VariableFrontend', | |
'backend' => 't3lib_cache_backend_NullBackend', | |
'options' => array(), | |
), | |
'cache_phpcode' => array( | |
'frontend' => 't3lib_cache_frontend_PhpFrontend', | |
'backend' => 't3lib_cache_backend_NullBackend', | |
'options' => array(), | |
), | |
'cache_runtime' => array( | |
'frontend' => 't3lib_cache_frontend_VariableFrontend', | |
'backend' => 't3lib_cache_backend_NullBackend', | |
'options' => array(), | |
), | |
), | |
); | |
$TYPO3_CONF_VARS['EXTCONF']['dbal'] = array( | |
'handlerCfg' => array( | |
'_DEFAULT' => array( | |
'type' => 'adodb', | |
'config' => array( | |
'database' => TRUE, | |
'driver' => 'sqlite://'.$typo_db_host | |
) | |
) | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'DB' => array( | |
'database' => 'nothing', 'host' => '###path###/db.sqlite', 'password' => 'nothing', 'username' => 'nothing', | |
), | |
'EXT' => array( | |
'extListArray' => array( | |
'filelist','version','tsconfig_help','context_help','extra_page_cm_options','impexp','belog','about', | |
'cshmanual','aboutmodules','setup','opendocs','install','dbal','adodb','extbase', | |
'phpunit', | |
'###ext###' | |
) | |
), | |
'EXTCONF' => array( | |
'dbal' => array( | |
'handlerCfg' => array( | |
'_DEFAULT' => array( | |
'type' => 'adodb', | |
'config' => array( | |
'database' => TRUE, | |
'driver' => 'sqlite://###path###/db.sqlite' | |
) | |
) | |
) | |
) | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export test_typo3_branch | |
export test_no_tests_flag test_quiet_flag test_install_extbase_flag test_install_fluid_flag test_miau_flag | |
qprint() { | |
if (( ${test_quiet_flag:-0} == 0 )) ; then | |
echo $1 | |
fi | |
} | |
run() { | |
qprint "Preparing tests" | |
CWD=`pwd` | |
prepare_files $CWD $1 | |
curl -sS https://getcomposer.org/installer | php | |
php -d apc.enable_cli=Off composer.phar install --dev | |
cloneorupdate "${CWD}/Core" "git://git.typo3.org/Packages/TYPO3.CMS.git" "${2}" | |
cloneorupdate "${CWD}/t3/typo3conf/ext/phpunit" "git://git.typo3.org/TYPO3v4/Extensions/phpunit.git" "master" | |
cd t3; | |
[ ! -e typo3_src ] && ln -s ../Core typo3_src | |
[ ! -e typo3 ] && ln -s typo3_src/typo3 | |
[ ! -e t3lib ] && ln -s typo3_src/t3lib | |
[ ! -e index.php ] && ln -s typo3/index.php | |
touch i.php | |
if (( ${test_no_tests_flag:-0} == 1 )) ; then | |
qprint "Preparation done" | |
else | |
qprint "Running the actual tests" | |
cd $CWD | |
vendor/bin/phpunit --verbose --testsuite "${1}_all" | |
fi | |
} | |
usage() { | |
printf "%b" " | |
You're doing it wrong. | |
Usage | |
run.sh [options] [version] | |
Options | |
[version] - Supports "4.7", "6.0", "6.1" and "master" for now | |
--extension=<name> - The extension which should be tested | |
--quiet - Avoid too much output | |
--no-tests - Prepare everything but do not trigger the tests | |
--install-extbase - Not implemented yet | |
--install-fluid - Not implemented yet | |
" | |
} | |
cloneorupdate() { | |
if [ ! -d $1 ] ; then | |
git clone --recursive --quiet --branch $3 $2 $1 | |
else | |
bash -c "cd $1 && git stash >/dev/null && git pull >/dev/null && git submodule update >/dev/null" | |
fi | |
} | |
prepare_files() { | |
mkdir -p "${1}/t3/typo3conf/ext" | |
############################ phpunit.xml ############################## | |
cat > "${1}/phpunit.xml" <<EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit backupGlobals="false" backupStaticAttributes="false" processIsolation="false" | |
stopOnFailure="false" syntaxCheck="true" bootstrap="autoload.php" | |
EOF | |
if (( ${test_miau_flag:-0} == 1 )) ; then | |
cat >> "${1}/phpunit.xml" <<EOF | |
colors="true" | |
printerFile="vendor/whatthejeff/nyancat-phpunit-resultprinter/src/NyanCat/PHPUnit/ResultPrinter.php" | |
printerClass="NyanCat\PHPunit\ResultPrinter" | |
EOF | |
fi | |
cat >> "${1}/phpunit.xml" <<EOF | |
><testsuites> | |
<testsuite name="${2}_all"> | |
<directory suffix="Test.php">t3/typo3conf/ext/${2}/Tests/Unit</directory> | |
</testsuite> | |
</testsuites> | |
</phpunit> | |
EOF | |
########################################################## | |
\curl -sSL https://raw.github.com/tolleiv/typo3-ext-ci/master/raw/composer.json > "${1}/composer.json" | |
\curl -sSL https://raw.github.com/tolleiv/typo3-ext-ci/master/raw/LocalConfiguration.php > "${1}/t3/typo3conf/LocalConfiguration.php" | |
\curl -sSL https://raw.github.com/tolleiv/typo3-ext-ci/master/raw/localconf.php > "${1}/t3/typo3conf/localconf.php" | |
case "$test_typo3_branch" in | |
TYPO3_4-7|TYPO3_4-6|TYPO3_4-5) | |
\curl -sSL https://raw.github.com/tolleiv/typo3-ext-ci/master/raw/autoload_4.7.php > "${1}/autoload.php" ;; | |
*) | |
\curl -sSL https://raw.github.com/tolleiv/typo3-ext-ci/master/raw/autoload.php > "${1}/autoload.php" ;; | |
esac | |
sed -i -e "s~###path###~${1}~g" "${1}/t3/typo3conf/LocalConfiguration.php" | |
sed -i -e "s~###path###~${1}~g" "${1}/t3/typo3conf/localconf.php" | |
sed -i -e "s~###path###~${1}~g" "${1}/autoload.php" | |
sed -i -e "s~###ext###~${2}~g" "${1}/t3/typo3conf/LocalConfiguration.php" | |
sed -i -e "s~###ext###~${2}~g" "${1}/t3/typo3conf/localconf.php" | |
########################################################## | |
} | |
# Parse CLI arguments. | |
while (( $# > 0 )) ; do | |
token="${1#--}" | |
shift | |
case "$token" in | |
extension=*) | |
export "test_extension"="${token/extension=/}" | |
;; | |
no-tests|quiet|install-extbase|install-fluid|miau) | |
export "test_${token/-/_}_flag"=1 | |
;; | |
4.5|4.6|4.7|6.0|6.1) | |
export "test_typo3_branch"="TYPO3_${token/\./-}" | |
;; | |
master) | |
export "test_typo3_branch"="${token}" | |
;; | |
*) | |
usage | |
exit 1 | |
;; | |
esac | |
done | |
run "$test_extension" "$test_typo3_branch" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment