diff --git a/composer.json b/composer.json index 49955de..51b9e1c 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ }, "require-dev": { "phpstan/phpstan": "^1.10.25", - "phpunit/phpunit": "^10.2.5" + "phpunit/phpunit": "^10.2.6" }, "scripts": { "test": ["@putenv XDEBUG_MODE=coverage", "phpunit --configuration=etc/phpunit.xml"] diff --git a/composer.lock b/composer.lock index 7cee2c1..843179e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "93f75ee837ff5206fe2df37546bf4568", + "content-hash": "91b42f8c5d97ad724d4744cee3861d2b", "packages": [], "packages-dev": [ { @@ -617,16 +617,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.2.5", + "version": "10.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "15a89f123d8ca9c1e1598d6d87a56a8bf28c72cd" + "reference": "1c17815c129f133f3019cc18e8d0c8622e6d9bcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/15a89f123d8ca9c1e1598d6d87a56a8bf28c72cd", - "reference": "15a89f123d8ca9c1e1598d6d87a56a8bf28c72cd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c17815c129f133f3019cc18e8d0c8622e6d9bcd", + "reference": "1c17815c129f133f3019cc18e8d0c8622e6d9bcd", "shasum": "" }, "require": { @@ -698,7 +698,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.6" }, "funding": [ { @@ -714,7 +714,7 @@ "type": "tidelift" } ], - "time": "2023-07-14T04:18:47+00:00" + "time": "2023-07-17T12:08:28+00:00" }, { "name": "sebastian/cli-parser", diff --git a/src/FunctionData.php b/src/FunctionData.php index e99513a..2582db3 100644 --- a/src/FunctionData.php +++ b/src/FunctionData.php @@ -18,7 +18,7 @@ function __construct(public string $functionName = "", public int $lineNumber = * @return string The string representation of this object. */ final function __toString(): string { - return $this->toString(); + return implode(PHP_EOL, [$this->toString(true), $this->toString(false)]); } /** diff --git a/test/BranchCoverageTest.php b/test/BranchCoverageTest.php index 1255167..c138598 100644 --- a/test/BranchCoverageTest.php +++ b/test/BranchCoverageTest.php @@ -1,17 +1,18 @@ data, isEmpty()); @@ -29,7 +30,8 @@ function testFromJson(): void { assertThat($data->lineNumber, equalTo(127)); } - #[TestDox("->__toString()")] + #[Test] + #[TestDox("__toString()")] function testToString(): void { // It should return a format like 'BRF:\\nBRH:'. assertThat((string) new BranchCoverage, equalTo(str_replace("{eol}", PHP_EOL, "BRF:0{eol}BRH:0"))); diff --git a/test/BranchDataTest.php b/test/BranchDataTest.php index 6ed59db..3b8e18e 100644 --- a/test/BranchDataTest.php +++ b/test/BranchDataTest.php @@ -1,17 +1,18 @@ blockNumber, equalTo(0)); @@ -27,7 +28,8 @@ function testFromJson(): void { assertThat($data->taken, equalTo(1)); } - #[TestDox("->__toString()")] + #[Test] + #[TestDox("__toString()")] function testToString(): void { // It should return a format like 'BRDA:,,,'. assertThat((string) new BranchData, equalTo("BRDA:0,0,0,-")); diff --git a/test/FunctionCoverageTest.php b/test/FunctionCoverageTest.php index d149203..5e627c6 100644 --- a/test/FunctionCoverageTest.php +++ b/test/FunctionCoverageTest.php @@ -1,17 +1,18 @@ data, isEmpty()); @@ -29,12 +30,14 @@ function testFromJson(): void { assertThat($data->lineNumber, equalTo(127)); } - #[TestDox("->__toString()")] + #[Test] + #[TestDox("__toString()")] function testToString(): void { // It should return a format like 'FNF:\\nFNH:'. assertThat((string) new FunctionCoverage, equalTo(str_replace("{eol}", PHP_EOL, "FNF:0{eol}FNH:0"))); - $coverage = new FunctionCoverage(data: [new FunctionData(executionCount: 3, functionName: "main", lineNumber: 127)], found: 23, hit: 11); + $data = new FunctionData(executionCount: 3, functionName: "main", lineNumber: 127); + $coverage = new FunctionCoverage(data: [$data], found: 23, hit: 11); assertThat((string) $coverage, equalTo(str_replace("{eol}", PHP_EOL, "FN:127,main{eol}FNDA:3,main{eol}FNF:23{eol}FNH:11"))); } } diff --git a/test/FunctionDataTest.php b/test/FunctionDataTest.php index 7b32930..49b636f 100644 --- a/test/FunctionDataTest.php +++ b/test/FunctionDataTest.php @@ -1,17 +1,18 @@ executionCount, equalTo(0)); @@ -25,7 +26,8 @@ function testFromJson(): void { assertThat($data->lineNumber, equalTo(127)); } - #[TestDox("->toString()")] + #[Test] + #[TestDox("toString()")] function testToString(): void { // It should return a format like 'FN:,' when used as definition. assertThat((new FunctionData)->toString(true), equalTo("FN:0,")); diff --git a/test/LineCoverageTest.php b/test/LineCoverageTest.php index d9461bb..4290620 100644 --- a/test/LineCoverageTest.php +++ b/test/LineCoverageTest.php @@ -1,17 +1,18 @@ data, isEmpty()); @@ -29,12 +30,14 @@ function testFromJson(): void { assertThat($data->lineNumber, equalTo(127)); } - #[TestDox("->__toString()")] + #[Test] + #[TestDox("__toString()")] function testToString(): void { // It should return a format like 'LF:\\nLH:'. assertThat((string) new LineCoverage, equalTo(str_replace("{eol}", PHP_EOL, "LF:0{eol}LH:0"))); $data = new LineData(executionCount: 3, lineNumber: 127); - assertThat((string) new LineCoverage(data: [$data], found: 23, hit: 11), equalTo(str_replace("{eol}", PHP_EOL, "$data{eol}LF:23{eol}LH:11"))); + $coverage = new LineCoverage(data: [$data], found: 23, hit: 11); + assertThat((string) $coverage, equalTo(str_replace("{eol}", PHP_EOL, "$data{eol}LF:23{eol}LH:11"))); } } diff --git a/test/LineDataTest.php b/test/LineDataTest.php index 5257b27..883096f 100644 --- a/test/LineDataTest.php +++ b/test/LineDataTest.php @@ -1,17 +1,18 @@ checksum, isEmpty()); @@ -25,7 +26,8 @@ function testFromJson(): void { assertThat($data->lineNumber, equalTo(127)); } - #[TestDox("->__toString()")] + #[Test] + #[TestDox("__toString()")] function testToString(): void { // It should return a format like 'DA:,[,]'. assertThat((string) new LineData, equalTo("DA:0,0")); diff --git a/test/ReportTest.php b/test/ReportTest.php index bb84c82..900a769 100644 --- a/test/ReportTest.php +++ b/test/ReportTest.php @@ -1,17 +1,18 @@ sourceFiles, isEmpty()); @@ -24,8 +25,9 @@ function testFromJson(): void { assertThat($report->testName, equalTo("LcovTest")); } - #[TestDox("::parse()")] - function testParse(): void { + #[Test] + #[TestDox("parse()")] + function parse(): void { $report = Report::parse(file_get_contents("share/lcov.info") ?: ""); // It should have a test name. @@ -76,7 +78,8 @@ function testParse(): void { Report::parse("TN:Example"); } - #[TestDox("->__toString()")] + #[Test] + #[TestDox("__toString()")] function testToString(): void { // It should return a format like 'TN:'. assertThat((string) new Report(""), isEmpty()); diff --git a/test/SourceFileTest.php b/test/SourceFileTest.php index 18f2c82..dbbf6a0 100644 --- a/test/SourceFileTest.php +++ b/test/SourceFileTest.php @@ -1,17 +1,18 @@ branches, isNull()); @@ -33,7 +34,8 @@ function testFromJson(): void { assertThat($sourceFile->path, equalTo("/home/cedx/lcov.php")); } - #[TestDox("->__toString()")] + #[Test] + #[TestDox("__toString()")] function testToString(): void { // It should return a format like 'SF:\\nend_of_record'. assertThat((string) new SourceFile(""), equalTo(str_replace("{eol}", PHP_EOL, "SF:{eol}end_of_record")));