Skip to content

Commit 2359c29

Browse files
Also test JUnit XML logger with PHPT tests
1 parent 6986222 commit 2359c29

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

tests/_files/failure.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--TEST--
2+
failure
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
print 'failure';
6+
--EXPECT--
7+
success

tests/_files/success.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--TEST--
2+
success
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
print 'success';
6+
--EXPECT--
7+
success

tests/end-to-end/data-provider/log-junit.phpt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ $_SERVER['argv'][] = '--log-junit';
1111
$_SERVER['argv'][] = $logfile;
1212
$_SERVER['argv'][] = __DIR__ . '/../../_files/DataProviderTest.php';
1313
$_SERVER['argv'][] = __DIR__ . '/../../_files/DataProviderWithStringKeysTest.php';
14+
$_SERVER['argv'][] = __DIR__ . '/../../_files/success.phpt';
15+
$_SERVER['argv'][] = __DIR__ . '/../../_files/failure.phpt';
1416

1517
require_once __DIR__ . '/../../bootstrap.php';
1618

@@ -22,7 +24,7 @@ unlink($logfile);
2224
--EXPECTF--
2325
<?xml version="1.0" encoding="UTF-8"?>
2426
<testsuites>
25-
<testsuite name="CLI Arguments" tests="8" assertions="8" errors="0" failures="2" skipped="0" time="%s">
27+
<testsuite name="CLI Arguments" tests="10" assertions="10" errors="0" failures="3" skipped="0" time="%s">
2628
<testsuite name="PHPUnit\TestFixture\DataProviderTest" file="%sDataProviderTest.php" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%s">
2729
<testsuite name="PHPUnit\TestFixture\DataProviderTest::testAdd" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%s">
2830
<testcase name="testAdd with data set #0" file="%sDataProviderTest.php" line="%d" class="PHPUnit\TestFixture\DataProviderTest" classname="PHPUnit.TestFixture.DataProviderTest" assertions="1" time="%s"/>
@@ -49,5 +51,16 @@ Failed asserting that 2 matches expected 3.
4951
<testcase name="testAdd with data set &quot;1 + 0 = 1&quot;" file="%sDataProviderWithStringKeysTest.php" line="%d" class="PHPUnit\TestFixture\DataProviderWithStringKeysTest" classname="PHPUnit.TestFixture.DataProviderWithStringKeysTest" assertions="1" time="%s"/>
5052
</testsuite>
5153
</testsuite>
54+
<testcase name="success.phpt" file="%ssuccess.phpt" assertions="1" time="%s"/>
55+
<testcase name="failure.phpt" file="%sfailure.phpt" assertions="1" time="%s">
56+
<failure type="PHPUnit\Framework\PhptAssertionFailedError">failure.phptFailed asserting that two strings are equal.%A
57+
--- Expected
58+
+++ Actual
59+
@@ @@
60+
-'success'
61+
+'failure'
62+
%A
63+
%s:%d</failure>
64+
</testcase>
5265
</testsuite>
5366
</testsuites>

0 commit comments

Comments
 (0)