Skip to content

Commit

Permalink
[PathConvert] Fixed validation on attributes. (#1319)
Browse files Browse the repository at this point in the history
  • Loading branch information
siad007 committed Apr 18, 2020
1 parent 77c655d commit 4062888
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
13 changes: 0 additions & 13 deletions classes/phing/tasks/system/PathConvert.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,19 +362,6 @@ private function validateSetup()
throw new BuildException("You must specify a path to convert");
}

if ($this->property === null) {
throw new BuildException("You must specify a property");
}

// Must either have a target OS or both a dirSep and pathSep

if ($this->targetOS == null && $this->pathSep == null && $this->dirSep == null) {
throw new BuildException(
"You must specify at least one of "
. "targetOS, dirSep, or pathSep"
);
}

// Determine the separator strings. The dirsep and pathsep attributes
// override the targetOS settings.
$dsep = FileUtils::getSeparator();
Expand Down
5 changes: 5 additions & 0 deletions test/classes/phing/tasks/system/PathConvertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public function testUnique()
$this->assertCount(6, $l, "6 after preserved duplicates");
}

public function testNoTargetOs()
{
$this->executeTarget('testnotargetos');
}

private function assertTarget(string $target)
{
$this->executeTarget($target);
Expand Down
4 changes: 4 additions & 0 deletions test/etc/tasks/system/PathConvertTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@
</pathconvert>
</target>

<target name="testnotargetos">
<pathconvert property="result" refid="testpath" />
</target>

</project>

0 comments on commit 4062888

Please sign in to comment.