Skip to content

Commit

Permalink
Merge branch '8.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 23, 2019
2 parents 19fa73f + de6eb8c commit 5ac49d1
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Lint XML configuration files
uses: ./.docker/lint-xml-configuration
with:
args: bash ./build/lint-xml-configuration
args: bash ./build/scripts/lint-xml-configuration

tests:
name: Tests
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
run: ${{ matrix.php-binary }} ./tools/composer update --no-ansi --no-interaction --no-progress --no-suggest

- name: Run sanity check
run: PHP_BINARY=${{ matrix.php-binary }} bash ./build/sanity-check
run: PHP_BINARY=${{ matrix.php-binary }} bash ./build/scripts/sanity-check

- name: Run tests with phpunit
run: ${{ matrix.php-binary }} -d assert.exception=1 -d zend.assertions=1 ./phpunit --coverage-clover=coverage.xml
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
/.php_cs
/.php_cs.cache
/.psalm/cache
/build/documentation
/build/logfiles
/build/artifacts
/build/phar
/build/phar-scoped
/build/phpdox
/build/*.phar
/build/*.phar.asc
/build/binary-phar-autoload.php
Expand Down
43 changes: 18 additions & 25 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,15 @@
<delete dir="${basedir}/bin"/>
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/composer.lock"/>
<delete dir="${basedir}/build/documentation"/>
<delete dir="${basedir}/build/logfiles"/>
<delete dir="${basedir}/build/artifacts"/>
<delete dir="${basedir}/build/phar"/>
<delete dir="${basedir}/build/phar-scoped"/>
<delete>
<fileset dir="${basedir}/build">
<include name="**/phpunit*.phar"/>
<include name="**/phpunit*.phar.asc"/>
</fileset>
</delete>

<property name="clean.done" value="true"/>
</target>

<target name="prepare" unless="prepare.done" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/documentation"/>
<mkdir dir="${basedir}/build/logfiles"/>
<mkdir dir="${basedir}/build/artifacts/logfiles"/>
<property name="prepare.done" value="true"/>
</target>

Expand Down Expand Up @@ -134,12 +126,13 @@
</target>

<target name="-phar-prepare" depends="clean,install-dependencies">
<mkdir dir="${basedir}/build/artifacts"/>
<mkdir dir="${basedir}/build/phar"/>
<mkdir dir="${basedir}/build/phar-scoped"/>

<copy file="${basedir}/phpunit.xsd" tofile="${basedir}/build/phar/phpunit.xsd"/>

<exec executable="${basedir}/build/phar-manifest.php" output="${basedir}/build/phar/manifest.txt" failonerror="true"/>
<exec executable="${basedir}/build/scripts/phar-manifest.php" output="${basedir}/build/phar/manifest.txt" failonerror="true"/>

<copy file="${basedir}/vendor/phpunit/php-code-coverage/LICENSE" tofile="${basedir}/build/phar/php-code-coverage/LICENSE"/>
<copy todir="${basedir}/build/phar/php-code-coverage">
Expand Down Expand Up @@ -352,7 +345,7 @@
</fileset>
</copy>

<exec executable="${basedir}/build/phar-version.php" outputproperty="_version" failonerror="true">
<exec executable="${basedir}/build/scripts/phar-version.php" outputproperty="_version" failonerror="true">
<arg value="${version}"/>
<arg value="${type}"/>
</exec>
Expand All @@ -362,7 +355,7 @@
<arg value="--no-ansi" />
<arg value="--force" />
<arg value="--config" />
<arg path="${basedir}/build/scoper.inc.php" />
<arg path="${basedir}/build/config/php-scoper.php" />
<arg value="--no-interaction" />
<arg value="--stop-on-failure" />
<arg value="--output-dir" />
Expand All @@ -386,13 +379,13 @@
<arg value="--hash" />
<arg value="SHA-1" />
<arg value="--output" />
<arg path="${basedir}/build/phpunit-library-${_version}.phar" />
<arg path="${basedir}/build/artifacts/phpunit-library-${_version}.phar" />
<arg value="--template" />
<arg path="${basedir}/build/library-phar-autoload.php.in" />
<arg path="${basedir}/build/templates/library-phar-autoload.php.in" />
<arg path="${basedir}/build/phar-scoped" />
</exec>

<copy file="${basedir}/build/binary-phar-autoload.php.in" tofile="${basedir}/build/binary-phar-autoload.php"/>
<copy file="${basedir}/build/templates/binary-phar-autoload.php.in" tofile="${basedir}/build/binary-phar-autoload.php"/>
<replace file="${basedir}/build/binary-phar-autoload.php" token="X.Y.Z" value="${_version}"/>

<exec executable="${basedir}/tools/phpab" taskname="phpab" failonerror="true">
Expand All @@ -403,25 +396,25 @@
<arg value="--hash" />
<arg value="SHA-1" />
<arg value="--output" />
<arg path="${basedir}/build/phpunit-${_version}.phar" />
<arg path="${basedir}/build/artifacts/phpunit-${_version}.phar" />
<arg value="--template" />
<arg path="${basedir}/build/binary-phar-autoload.php" />
<arg path="${basedir}/build/phar-scoped" />
</exec>

<chmod file="${basedir}/build/phpunit-${_version}.phar" perm="ugo+rx"/>
<chmod file="${basedir}/build/artifacts/phpunit-${_version}.phar" perm="ugo+rx"/>

<delete dir="${basedir}/build/phar"/>
<delete dir="${basedir}/build/phar-scoped"/>
<delete file="${basedir}/build/binary-phar-autoload.php"/>
</target>

<target name="-phar-determine-version">
<exec executable="${basedir}/build/version.php" outputproperty="version" failonerror="true" />
<exec executable="${basedir}/build/scripts/version.php" outputproperty="version" failonerror="true" />
</target>

<target name="generate-project-documentation" depends="-phploc,-checkstyle,-phpunit">
<exec executable="${basedir}/tools/phpdox" dir="${basedir}/build" taskname="phpdox"/>
<exec executable="${basedir}/tools/phpdox" dir="${basedir}/build/config" taskname="phpdox"/>
</target>

<target name="update-tools">
Expand All @@ -436,7 +429,7 @@
</target>

<target name="generate-global-assert-wrappers" description="Generate global function wrappers for static methods in Assert and TestCase that are commonly used">
<exec executable="${basedir}/build/generate_global_assert_wrappers.php" taskname="generate-global-assert-wrappers" failonerror="true"/>
<exec executable="${basedir}/build/scripts/generate-global-assert-wrappers.php" taskname="generate-global-assert-wrappers" failonerror="true"/>
<exec executable="${basedir}/tools/php-cs-fixer" taskname="php-cs-fixer" failonerror="true">
<arg value="fix"/>
<arg path="${basedir}/src/Framework/Assert/Functions.php"/>
Expand All @@ -447,14 +440,14 @@
<exec executable="${basedir}/tools/phploc" output="/dev/null" taskname="phploc">
<arg value="--count-tests"/>
<arg value="--log-xml"/>
<arg path="${basedir}/build/logfiles/phploc.xml"/>
<arg path="${basedir}/build/artifacts/logfiles/phploc.xml"/>
<arg path="${basedir}/src"/>
<arg path="${basedir}/tests"/>
</exec>
</target>

<target name="-checkstyle" depends="prepare">
<exec executable="${basedir}/tools/php-cs-fixer" output="${basedir}/build/logfiles/checkstyle.xml" error="/dev/null" taskname="php-cs-fixer">
<exec executable="${basedir}/tools/php-cs-fixer" output="${basedir}/build/artifacts/logfiles/checkstyle.xml" error="/dev/null" taskname="php-cs-fixer">
<arg value="--diff"/>
<arg value="--dry-run"/>
<arg value="fix"/>
Expand All @@ -465,9 +458,9 @@
<target name="-phpunit" depends="setup">
<exec executable="${basedir}/phpunit" taskname="phpunit">
<arg value="--coverage-xml"/>
<arg path="${basedir}/build/logfiles/coverage"/>
<arg path="${basedir}/build/artifacts/logfiles/coverage"/>
<arg value="--log-junit"/>
<arg path="${basedir}/build/logfiles/junit.xml"/>
<arg path="${basedir}/build/artifacts/logfiles/junit.xml"/>
</exec>
</target>
</project>
Expand Down
5 changes: 2 additions & 3 deletions build/github-ci-fail.xml → build/config/github-ci-fail.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.4/phpunit.xsd"
bootstrap="../tests/bootstrap.php"
backupGlobals="false"
bootstrap="../../tests/bootstrap.php"
verbose="true">
<testsuites>
<testsuite name="small">
<directory suffix=".phpt">../tests/fail</directory>
<directory suffix=".phpt">../../tests/fail</directory>
</testsuite>
</testsuites>

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions build/phpdox.xml → build/config/phpdox.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpdox xmlns="http://xml.phpdox.net/config">
<project name="PHPUnit" source="../src" workdir="phpdox">
<project name="PHPUnit" source="../../src" workdir="../artifacts/phpdox">
<collector publiconly="false">
<include mask="*.php" />
</collector>

<generator output=".">
<enrich base="logfiles">
<enrich base="../artifacts/logfiles">
<source type="build" />
<source type="git" />
<source type="phploc" />
<source type="checkstyle" />
<source type="phpunit" />
</enrich>

<build engine="html" enabled="true" output="documentation">
<build engine="html" enabled="true" output="../artifacts/documentation">
<file extension="html" />
</build>
</generator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\Constraint\Constraint;

require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';

/** @var string[] $lines */
$lines = \file(__DIR__ . '/../src/Framework/Assert.php');
$lines = \file(__DIR__ . '/../../src/Framework/Assert.php');

$buffer = '<?php declare(strict_types=1);
/*
Expand Down Expand Up @@ -213,4 +213,4 @@ function onConsecutiveCalls(): ConsecutiveCallsStub
}
';

\file_put_contents(__DIR__ . '/../src/Framework/Assert/Functions.php', $buffer);
\file_put_contents(__DIR__ . '/../../src/Framework/Assert/Functions.php', $buffer);
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

print "\n";

$lock = \json_decode(\file_get_contents(__DIR__ . '/../composer.lock'));
$lock = \json_decode(\file_get_contents(__DIR__ . '/../../composer.lock'));

foreach ($lock->packages as $package) {
print $package->name . ': ' . $package->version;
Expand Down
4 changes: 2 additions & 2 deletions build/phar-version.php → build/scripts/phar-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
}

\file_put_contents(
__DIR__ . '/phar/phpunit/Runner/Version.php',
__DIR__ . '/../phar/phpunit/Runner/Version.php',
\str_replace(
'private static $pharVersion;',
'private static $pharVersion = "' . $argv[1] . '";',
\file_get_contents(__DIR__ . '/phar/phpunit/Runner/Version.php')
\file_get_contents(__DIR__ . '/../phar/phpunit/Runner/Version.php')
)
);

Expand Down
2 changes: 1 addition & 1 deletion build/sanity-check → build/scripts/sanity-check
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PHP_BINARY=${PHP_BINARY:-php}

${PHP_BINARY} -d assert.exception=On -d zend.assertions=1 ./phpunit --configuration ./build/github-ci-fail.xml
${PHP_BINARY} -d assert.exception=On -d zend.assertions=1 ./phpunit --configuration ./build/config/github-ci-fail.xml

if [ $? -eq 0 ]; then
echo "This test should have failed.";
Expand Down
6 changes: 3 additions & 3 deletions build/version.php → build/scripts/version.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env php
<?php declare(strict_types=1);

require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';

use SebastianBergmann\Version;

$buffer = \file_get_contents(__DIR__ . '/../src/Runner/Version.php');
$buffer = \file_get_contents(__DIR__ . '/../../src/Runner/Version.php');
$start = \strpos($buffer, 'new VersionId(\'') + \strlen('new VersionId(\'');
$end = \strpos($buffer, '\'', $start);
$version = \substr($buffer, $start, $end - $start);
$version = new Version($version, __DIR__ . '/../');
$version = new Version($version, __DIR__ . '/../../');

print $version->getVersion();
File renamed without changes.
File renamed without changes.

0 comments on commit 5ac49d1

Please sign in to comment.