Skip to content
This repository was archived by the owner on Dec 6, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
349 changes: 347 additions & 2 deletions assets/root-files/phpunit.xml.dist

Large diffs are not rendered by default.

370 changes: 370 additions & 0 deletions assets/root-files/phpunit.xml.travis

Large diffs are not rendered by default.

80 changes: 0 additions & 80 deletions assets/test-files/Bootstrap.php

This file was deleted.

490 changes: 0 additions & 490 deletions assets/test-files/TestConfiguration.php.dist

This file was deleted.

62 changes: 0 additions & 62 deletions assets/test-files/TestConfiguration.php.travis

This file was deleted.

34 changes: 34 additions & 0 deletions assets/test-files/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* @link http://github.com/zendframework/zend-{COMPONENT} for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/*
* Set error reporting to the level to which Zend Framework code must comply.
*/
error_reporting(E_ALL | E_STRICT);

if (class_exists('PHPUnit_Runner_Version', true)) {
$phpUnitVersion = PHPUnit_Runner_Version::id();
if ('@package_version@' !== $phpUnitVersion && version_compare($phpUnitVersion, '4.0.0', '<')) {
echo 'This version of PHPUnit (' . PHPUnit_Runner_Version::id() . ') is not supported'
. ' in the zend-{COMPONENT} unit tests. Supported is version 4.0.0 or higher.'
. ' See also the CONTRIBUTING.md file in the component root.' . PHP_EOL;
exit(1);
}
unset($phpUnitVersion);
}

/**
* Setup autoloading
*/
require __DIR__ . '/../vendor/autoload.php';

/**
* Start output buffering, if enabled
*/
if (defined('TESTS_ZEND_OB_ENABLED') && constant('TESTS_ZEND_OB_ENABLED')) {
ob_start();
}
4 changes: 2 additions & 2 deletions bin/composer-rewriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
unset($composer['autoload']['psr-0']);
}

// Ensure we have a PSR-4 autload section
// Ensure we have a PSR-4 autoload section
if (! isset($composer['autoload']['psr-4']) || empty($composer['autoload']['psr-4'])) {
$composer['autoload']['psr-4'] = [
'Zend\\' . $component . '\\' => 'src/',
Expand All @@ -37,7 +37,7 @@
// Setup development autoloading rules
$composer['autoload-dev'] = [
'psr-4' => [
'ZendTest\\' . $component . '\\' => 'test/' . $component . '/',
'ZendTest\\' . $component . '\\' => 'test/',
],
];

Expand Down
88 changes: 36 additions & 52 deletions bin/split-component.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
echo "ZF2 Component Split Tool, v0.1.0"
echo

# General variables
ZF2_REPO="git://github.com/zendframework/zf2"
ROOT_DIR=$(readlink -f $(dirname $0)/..)
TMP_DIR=${ROOT_DIR}/tmp

# Variables to set via options
ZF2_PATH=zf2-migrate
PHP_EXEC=$(which php)
COMPONENT=
PHPUNIT_DIST=
TEST_CONFIG_DIST=
TEST_CONFIG_TRAVIS=
PHPCS_CONFIG=
TRAVIS_CONFIG=
PHPUNIT_TRAVIS=
ZF2_PATH=zf2-migrate
PHPCS_CONFIG=${ROOT_DIR}/assets/root-files/php_cs
TRAVIS_CONFIG=${ROOT_DIR}/assets/root-files/travis.yml
README=
PHP_EXEC=$(which php)

# Functions
function help {
Expand All @@ -21,16 +25,15 @@ function help {
fi

echo "Usage:"
echo "-h Help; this message"
echo "-c <Component> Component to split out"
echo "-z <ZF2 path> Path in which to clone ZF2; defaults to 'zf2-migrate'"
echo "-p <PHP executable> PHP executable to use (for composer rewrite); defaults to /usr/bin/env php"
echo "-u <phpunit.xml.dist> Path to phpunit.xml.dist to use for this component; a template is used by default"
echo "-t <TestConfiguration.php.dist> Path to the component's TestConfiguration.php.dist file"
echo "-i <TestConfiguration.php.travis> Path to the component's TestConfiguration.php.travis file"
echo "-s <.php_cs> Path to the component-specific .php_cs file, if any"
echo "-T <.travis.yml> Path to the component-specific .travis.yml file, if any"
echo "-r <README.md> Path to the component-specific README.md file; a template is used by default"
echo "-h Help; this message"
echo "-c <Component> Component to split out (REQUIRED)"
echo "-u <phpunit.xml.dist> Path to phpunit.xml.dist to use for this component (REQUIRED)"
echo "-t <phpunit.xml.travis> Path to the component's TestConfiguration.php.dist file (REQUIRED)"
echo "-z <ZF2 path> Path in which to clone ZF2; defaults to 'zf2-migrate'"
echo "-s <.php_cs> Path to the component-specific .php_cs file, if any"
echo "-T <.travis.yml> Path to the component-specific .travis.yml file, if any"
echo "-r <README.md> Path to the component-specific README.md file; a template is used by default"
echo "-p <PHP executable> PHP executable to use (for composer rewrite); defaults to /usr/bin/env php"

exit $STATUS
}
Expand All @@ -44,20 +47,14 @@ while getopts ":hc:z:p:u:t:i:s:T:r:" opt ;do
c)
COMPONENT=$OPTARG
;;
z)
ZF2_PATH=$OPTARG
;;
p)
PHP_EXEC=$OPTARG
;;
u)
PHPUNIT_DIST=$OPTARG
;;
t)
TEST_CONFIG_DIST=$OPTARG
PHPUNIT_TRAVIS=$OPTARG
;;
i)
TEST_CONFIG_TRAVIS=$OPTARG
z)
ZF2_PATH=$OPTARG
;;
s)
PHPCS_CONFIG=$OPTARG
Expand All @@ -68,6 +65,9 @@ while getopts ":hc:z:p:u:t:i:s:T:r:" opt ;do
r)
README=$OPTARG
;;
p)
PHP_EXEC=$OPTARG
;;
\?)
echo "Invalid option!"
help 1
Expand All @@ -84,26 +84,17 @@ ERROR=0
if [[ $COMPONENT = "" ]]; then
echo "-c <COMPONENT> is REQUIRED" >&2
ERROR=1
help 1
fi

if [[ "$PHPUNIT_DIST" != "" ]]; then
PHPUNIT_DIST=$(readlink -f "$PHPUNIT_DIST" 2>&1)
if [[ "$PHPUNIT_DIST" = "" ]]; then
echo "-u <phpunit.xml.dist> MUST be a valid filename" >&2
ERROR=1
fi
fi

TEST_CONFIG_DIST=$(readlink -f "$TEST_CONFIG_DIST" 2>&1)
if [[ "$TEST_CONFIG_DIST" = "" ]]; then
echo "-t <TestConfiguration.php.dist> is REQUIRED, and must be a valid filename" >&2
PHPUNIT_DIST=$(readlink -f "${PHPUNIT_DIST}" 2>&1)
if [[ "${PHPUNIT_DIST}" = "" ]]; then
echo "-u <phpunit.xml.dist> MUST be a valid filename and is REQUIRED" >&2
ERROR=1
fi

TEST_CONFIG_TRAVIS=$(readlink -f "$TEST_CONFIG_TRAVIS" 2>&1)
if [[ "$TEST_CONFIG_TRAVIS" = "" ]]; then
echo "-t <TestConfiguration.php.travis> is REQUIRED, and must be a valid filename" >&2
PHPUNIT_TRAVIS=$(readlink -f "${PHPUNIT_TRAVIS}" 2>&1)
if [[ "${PHPUNIT_TRAVIS}" = "" ]]; then
echo "-t <phpunit.xml.travis> MUST be a valid filename and is REQUIRED" >&2
ERROR=1
fi

Expand Down Expand Up @@ -141,19 +132,13 @@ echo "Splitting component ${COMPONENT}"
echo "Using:"
echo " PHP: ${PHP_EXEC}"
echo " ZF2 path: ${ZF2_PATH}"
echo " TestConfiguration.php.dist: ${TEST_CONFIG_DIST}"
echo " TestConfiguration.php.travis: ${TEST_CONFIG_TRAVIS}"
if [[ "" != "${PHPUNIT_DIST}" ]]; then echo " phpunit.xml.dist: ${PHPUNIT_DIST}" ; fi
echo " phpunit.xml.dist: ${PHPUNIT_DIST}"
echo " phpunit.xml.travis: ${PHPUNIT_TRAVIS}"
if [[ "" != "${PHPCS_CONFIG}" ]]; then echo " .php_cs: ${PHPCS_CONFIG}" ; fi
if [[ "" != "${TRAVIS_CONFIG}" ]]; then echo " .travis.yml: ${TRAVIS_CONFIG}" ; fi
if [[ "" != "${README}" ]]; then echo " README.md: ${README}" ; fi
echo

# Script-specific variables
ZF2_REPO="git://github.com/zendframework/zf2"
ROOT_DIR=$(readlink -f $(dirname $0)/..)
TMP_DIR=${ROOT_DIR}/tmp

# Clone the ZF2 repo
if [[ -d "${ZF2_PATH}" ]]; then
rm -Rf ${ZF2_PATH} ;
Expand Down Expand Up @@ -186,12 +171,11 @@ cp "${ZF2_PATH}/library/Zend/${COMPONENT}/composer.json" "${TMP_DIR}/composer.js
${COMPONENT} \
${ROOT_DIR} \
${PHP_EXEC} \
${PHPUNIT_DIST} \
${PHPUNIT_TRAVIS} \
${README:='(none)'} \
${TRAVIS_CONFIG:='(none)'} \
${PHPCS_CONFIG:='(none)'} \
${TEST_CONFIG_DIST} \
${TEST_CONFIG_TRAVIS} \
${PHPUNIT_DIST:='(none)'}
${PHPCS_CONFIG:='(none)'}
" --msg-filter "
sed -re 's/(^|[^a-zA-Z])(\#[1-9][0-9]*)/\1zendframework\/zf2\2/g'
" --tag-name-filter cat release-2.0.0rc3..HEAD ;
Expand Down
Loading