Skip to content

Commit

Permalink
Merge branch 'master' into clover-html-formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
siad007 authored Nov 19, 2020
2 parents 26ba82c + f5ddaa1 commit 4acb8a8
Show file tree
Hide file tree
Showing 31 changed files with 80 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
git config --global user.email "travis-ci-build@phing.info"
git config --global user.name "Phing Travis Builder"
echo "=== RUN TESTS ==="
../bin/phing -debug -Dtests.codecoverage=false -listener "phing.listener.StatisticsListener"
../bin/phing -verbose -Dtests.codecoverage=false -listener "phing.listener.StatisticsListener"
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ os: linux
php:
- 7.3
- 7.4
- 8.0snapshot
- master

env:
Expand Down Expand Up @@ -42,26 +43,27 @@ before_install:
install:
- |
if [[ "$DEPS" == "LOW" ]]; then
composer install --prefer-dist --no-progress --no-interaction --no-suggest;
composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest --prefer-lowest;
composer install --prefer-dist --no-progress --no-interaction;
composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --prefer-lowest;
else
composer install --optimize-autoloader --prefer-dist --no-progress --no-interaction --no-suggest;
composer install --optimize-autoloader --prefer-dist --no-progress --no-interaction;
fi
script:
- echo "=== TESTING PHING ==="
- cd test
- ../bin/phing -debug -Dtests.codecoverage=false -listener "phing.listener.StatisticsListener"
- ../bin/phing -verbose -Dtests.codecoverage=false -listener "phing.listener.StatisticsListener"
- cd ..

jobs:
allow_failures:
- php: 8.0snapshot
- php: master
- php: nightly
include:
- php: nightly
env: DEPS="IGNORE"
install: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest --ignore-platform-reqs
install: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --ignore-platform-reqs

- stage: test with coverage
php: 7.4
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<h1><img width="30" src="https://github.com/phingofficial/phing-github-action/main/action.svg"/>P H I N G</h1>

![Phing CI](https://github.com/phingofficial/phing/workflows/Phing%20CI/badge.svg?branch=master)
[![Build Status](https://travis-ci.com/phingofficial/phing.svg?branch=master)](https://travis-ci.com/phingofficial/phing)
[![Build status](https://ci.appveyor.com/api/projects/status/ws2xv6tuu36sere7/branch/master?svg=true)](https://ci.appveyor.com/project/mrook/phing/branch/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phingofficial/phing/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phingofficial/phing/?branch=master)
[![codecov](https://codecov.io/gh/phingofficial/phing/branch/master/graph/badge.svg)](https://codecov.io/gh/phingofficial/phing)
[![Build status](https://ci.appveyor.com/api/projects/status/ws2xv6tuu36sere7/branch/master?svg=true)](https://ci.appveyor.com/project/mrook/phing/branch/master)

Thank you for using PHING!

Expand Down
34 changes: 9 additions & 25 deletions classes/phing/IntrospectionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,8 @@ public function __construct($class)
);
}

$classname = null;

if (($hint = $params[0]->getClass()) !== null) {
$classname = $hint->getName();
}
/** @var \ReflectionType $hint */
$classname = (($hint = $params[0]->getType()) && !$hint->isBuiltin()) ? $hint->getName() : null;

if ($classname === null) {
throw new BuildException(
Expand Down Expand Up @@ -239,11 +236,8 @@ public function __construct($class)
);
}

$classname = null;

if (($hint = $params[0]->getClass()) !== null) {
$classname = $hint->getName();
}
/** @var \ReflectionType $hint */
$classname = (($hint = $params[0]->getType()) && !$hint->isBuiltin()) ? $hint->getName() : null;

// we don't use the classname here, but we need to make sure it exists before
// we later try to instantiate a non-existent class
Expand Down Expand Up @@ -326,16 +320,9 @@ public function setAttribute(Project $project, $element, $attributeName, &$value
$value = new Reference($project, $value);
} else {
$params = $method->getParameters();
$reflectedAttr = null;

// try to determine parameter type
if (($argType = $params[0]->getType()) !== null) {
/** @var ReflectionNamedType $argType */
$reflectedAttr = $argType->getName();
} elseif (($classType = $params[0]->getClass()) !== null) {
/** @var ReflectionClass $classType */
$reflectedAttr = $classType->getName();
}

/** @var \ReflectionType $hint */
$reflectedAttr = ($hint = $params[0]->getType()) ? $hint->getName() : null;

// value is a string representation of a boolean type,
// convert it to primitive
Expand Down Expand Up @@ -437,11 +424,8 @@ public function createElement(Project $project, $element, $elementName)
// exist and that method is using class hints
$params = $method->getParameters();

$classname = null;

if (($hint = $params[0]->getClass()) !== null) {
$classname = $hint->getName();
}
/** @var \ReflectionType $hint */
$classname = (($hint = $params[0]->getType()) && !$hint->isBuiltin()) ? $hint->getName() : null;

// create a new instance of the object and add it via $addMethod
$clazz = new ReflectionClass($classname);
Expand Down
17 changes: 2 additions & 15 deletions classes/phing/filters/StripPhpComments.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,13 @@
*/
class StripPhpComments extends BaseFilterReader implements ChainableReader
{
/**
* The read-ahead character, used for effectively pushing a single
* character back. -1 indicates that no character is in the buffer.
*/
private $readAheadCh = -1;

/**
* Whether or not the parser is currently in the middle of a string
* literal.
*
* @var boolean
*/
private $inString = false;

/**
* Returns the stream without Php comments.
*
* @param int $len
* @param int|null $len
* @return string the resulting stream, or -1
* if the end of the resulting stream has been reached
* @throws IOException
*/
public function read($len = null)
{
Expand Down
4 changes: 2 additions & 2 deletions classes/phing/system/io/OutputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public function close()
public function flush()
{
error_clear_last();
if (false === @fflush($this->stream)) {
if ($this->stream === null || false === @fflush($this->stream)) {
$lastError = error_get_last();
$errormsg = $lastError['message'];
$errormsg = $lastError['message'] ?? 'no stream';
throw new IOException("Could not flush stream: " . $errormsg);
}
}
Expand Down
9 changes: 0 additions & 9 deletions classes/phing/tasks/ext/phpunit/PHPUnitTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,13 @@ public function init()

private function loadPHPUnit()
{
/**
* Determine PHPUnit version number, try
* PEAR old-style, then composer, then PHAR
*/
@include_once 'PHPUnit/Runner/Version.php';
if (!class_exists('PHPUnit_Runner_Version')) {
@include_once 'phpunit/Runner/Version.php';
}
if (!empty($this->pharLocation)) {
$GLOBALS['_SERVER']['SCRIPT_NAME'] = '-';
ob_start();
@include $this->pharLocation;
ob_end_clean();
}

@include_once 'PHPUnit/Autoload.php';
if (!class_exists('PHPUnit\Runner\Version')) {
throw new BuildException("PHPUnitTask requires PHPUnit to be installed", $this->getLocation());
}
Expand Down
3 changes: 2 additions & 1 deletion classes/phing/tasks/system/DeleteTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ public function main()
foreach ($this->filelists as $fl) {
try {
$files = $fl->getFiles($this->project);
$this->removeFiles($fl->getDir($this->project), $files, $empty = []);
$empty = [];
$this->removeFiles($fl->getDir($this->project), $files, $empty);
} catch (BuildException $be) {
// directory doesn't exist or is not readable
if ($this->failonerror) {
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@
"aws/aws-sdk-php": "^3.112",
"guzzlehttp/guzzle": "^7.1",
"jawira/plantuml-encoding": "^1.0",
"mikey179/vfsstream": "^1.6",
"mikey179/vfsstream": "^1.6.8",
"monolog/monolog": "^1.25 || ^2.0",
"pdepend/pdepend": "^2.5.2",
"pear/archive_tar": "~1.4.7",
"pear/console_getopt": "^v1.4.3",
"pear/mail": "^1.4",
"pear/mail_mime": "^1.10",
"pear/net_growl": "dev-master",
"pear/pear-core-minimal": "~1.10.9",
"pear/pear-core-minimal": "^1.10.10",
"pear/versioncontrol_git": "dev-master",
"pear/versioncontrol_svn": "~0.5",
"pear/versioncontrol_svn": "^0.5.2",
"phploc/phploc": "^7.0",
"phpmd/phpmd": "~2.8",
"phpunit/phpunit": "^9.4",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/classes/phing/components/ExtensionPointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function testAddToExtensionPoint()

public function testExtensionPointMustBeEmpty()
{
$this->expectNotToPerformAssertions();
try {
$this->executeTarget(__FUNCTION__);
} catch (BuildException $e) {
Expand Down
4 changes: 2 additions & 2 deletions test/classes/phing/filters/util/StripPhpCommentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public function tearDown(): void
$this->executeTarget("cleanup");
}

public function testSortFilter()
public function testStripPhpComments()
{
$this->executeTarget("testStripPhpComments");
$this->executeTarget(__FUNCTION__);

$expectedFile = $this->getProject()->resolveFile("expected/stripphpcomments.test");
$resultFile = $this->getProject()->resolveFile("result/stripphpcomments.test");
Expand Down
1 change: 1 addition & 0 deletions test/classes/phing/regression/ExcludeZipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function setUp(): void

public function testZipTask()
{
$this->expectNotToPerformAssertions();
$this->executeTarget("main");

$expected = "Adding ./.git to archive.";
Expand Down
1 change: 1 addition & 0 deletions test/classes/phing/system/FileOutputStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function testWrite()

public function testFlush()
{
$this->expectNotToPerformAssertions();
$this->outStream->write("Some data");
$this->outStream->flush();
$this->outStream->close();
Expand Down
19 changes: 1 addition & 18 deletions test/classes/phing/tasks/PropertyTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ public function testPrefixFailure()
$this->expectException(BuildException::class);
$this->expectExceptionMessageMatches('/Prefix is only valid/');

// try {
// $this->executeTarget("prefix.fail");
// } catch (BuildException $e) {
// $this->assertContains("Prefix is only valid", $e->getMessage(), "Prefix allowed on non-resource/file load - ");
//
// return;
// }
// $this->fail("Did not throw exception on invalid use of prefix");

$this->executeTarget("prefix.fail");
}

Expand All @@ -91,15 +82,6 @@ public function testCircularDefinitionDetection($target)
$this->expectException(BuildException::class);
$this->expectExceptionMessageMatches('/was circularly defined/');

// try {
// $this->executeTarget($target);
// } catch (BuildException $e) {
// $this->assertContains("was circularly defined", $e->getMessage(), "Circular definition not detected - ");
//
// return;
// }
// $this->fail("Did not throw exception on circular exception");

$this->executeTarget($target);
}

Expand All @@ -114,6 +96,7 @@ public function testToString()
*/
public function testUsingPropertyTwiceInPropertyValueShouldNotThrowException()
{
$this->expectNotToPerformAssertions();
$this->executeTarget(__FUNCTION__);
}

Expand Down
4 changes: 4 additions & 0 deletions test/classes/phing/tasks/condition/PhingTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ public function test4b(): void

public function test5(): void
{
$this->expectNotToPerformAssertions();
$this->getProject()->executeTarget(__FUNCTION__);
}

public function test6(): void
{
$this->expectNotToPerformAssertions();
$this->getProject()->executeTarget(__FUNCTION__);
}

Expand Down Expand Up @@ -292,6 +294,7 @@ public function testReferenceNoInheritance(): void

public function testInheritPath(): void
{
$this->expectNotToPerformAssertions();
$this->getProject()->executeTarget('testInheritPath');
}

Expand Down Expand Up @@ -345,6 +348,7 @@ public function testOverrideWinsNoInheritAll()
*/
public function testInfiniteLoopViaDepends(): void
{
$this->markTestSkipped('infinite loop could occure');
// $this->expectBuildException('infinite-loop-via-depends', 'infinite loop');
}

Expand Down
1 change: 1 addition & 0 deletions test/classes/phing/tasks/ext/CoverageMergeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/**
* @author Siad Ardroumli <siad.ardroumli@gmail.com>
* @package phing.tasks.ext
* @requires extension xdebug
*/
class CoverageMergeTest extends BuildFileTest
{
Expand Down
1 change: 1 addition & 0 deletions test/classes/phing/tasks/ext/GitTasks/GitBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function testInitialization()
*/
public function testArguments()
{
$this->markTestIncomplete('needs investigation');
}

public function testMutators()
Expand Down
Loading

0 comments on commit 4acb8a8

Please sign in to comment.