diff --git a/src/Phing/Filter/Token.php b/src/Phing/Filter/Token.php
index 6942fb115b..e278edfb3f 100644
--- a/src/Phing/Filter/Token.php
+++ b/src/Phing/Filter/Token.php
@@ -54,18 +54,9 @@ public function setKey($key)
*
* @param string $value The value for this token. Must not be null
.
*/
- public function setValue($value)
+ public function setValue(string $value)
{
- // special case for bool values
- if (is_bool($value)) {
- if ($value) {
- $this->value = 'true';
- } else {
- $this->value = 'false';
- }
- } else {
- $this->value = (string) $value;
- }
+ $this->value = $value;
}
/**
diff --git a/tests/Phing/Test/Regression/ReplaceTokenBooleanTest.php b/tests/Phing/Test/Filter/ReplaceTokensTest.php
similarity index 68%
rename from tests/Phing/Test/Regression/ReplaceTokenBooleanTest.php
rename to tests/Phing/Test/Filter/ReplaceTokensTest.php
index f1577c718a..444ab9b27b 100644
--- a/tests/Phing/Test/Regression/ReplaceTokenBooleanTest.php
+++ b/tests/Phing/Test/Filter/ReplaceTokensTest.php
@@ -18,7 +18,7 @@
* .
*/
-namespace Phing\Test\Regression;
+namespace Phing\Test\Filter;
use Phing\Test\Support\BuildFileTest;
@@ -28,16 +28,27 @@
*
* @internal
*/
-class ReplaceTokenBooleanTest extends BuildFileTest
+class ReplaceTokensTest extends BuildFileTest
{
public function setUp(): void
{
- $this->configureProject(PHING_TEST_BASE . '/etc/regression/376/build.xml');
+ $this->configureProject(PHING_TEST_BASE . '/etc/filters/replacetokens.xml');
}
- public function testCustomTask(): void
+ public function tearDown(): void
{
- $this->executeTarget('main');
+ $this->executeTarget('cleanup');
+ }
+
+ public function testLiteralBooleans(): void
+ {
+ $this->executeTarget('testLiteralBooleans');
$this->assertInLogs('Replaced "@TOKEN_KEY_TRUE@" with "true"');
}
+
+ public function testLiteralsThatShouldNotBeConvertedToBooleans(): void
+ {
+ $this->executeTarget('testLiteralsThatShouldNotBeConvertedToBooleans');
+ $this->assertInLogs('Replaced "@TOKEN_KEY_TRUE@" with "1"');
+ }
}
diff --git a/tests/etc/regression/376/testfile b/tests/etc/filters/expected/replacetokens.test
similarity index 100%
rename from tests/etc/regression/376/testfile
rename to tests/etc/filters/expected/replacetokens.test
diff --git a/tests/etc/filters/replacetokens.xml b/tests/etc/filters/replacetokens.xml
new file mode 100644
index 0000000000..89ae881705
--- /dev/null
+++ b/tests/etc/filters/replacetokens.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/etc/regression/376/build.xml b/tests/etc/regression/376/build.xml
deleted file mode 100644
index 453745ac22..0000000000
--- a/tests/etc/regression/376/build.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-