Skip to content

Commit 3932607

Browse files
nikophilsebastianbergmann
authored andcommitted
test(baseline): ensure with a test that baseline can be in another directory
1 parent b40323f commit 3932607

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../../../phpunit.xsd"
4+
cacheResult="false"
5+
>
6+
<testsuites>
7+
<testsuite name="default">
8+
<directory>tests</directory>
9+
</testsuite>
10+
</testsuites>
11+
12+
<source baseline="tests/baseline.xml">
13+
<include>
14+
<directory>src</directory>
15+
</include>
16+
</source>
17+
</phpunit>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
declare(strict_types=1);
3+
/*
4+
* This file is part of PHPUnit.
5+
*
6+
* (c) Sebastian Bergmann <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
namespace PHPUnit\TestFixture\Baseline;
12+
13+
use const E_USER_DEPRECATED;
14+
use function trigger_error;
15+
use PHPUnit\Framework\TestCase;
16+
17+
final class Test extends TestCase
18+
{
19+
public function testDeprecation(): void
20+
{
21+
trigger_error('deprecation', E_USER_DEPRECATED);
22+
23+
$this->assertTrue(true);
24+
}
25+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<files version="1">
3+
<file path="Test.php">
4+
<line number="21" hash="a1022fb62c4705938dd2c6df5ff35b2621f9e97d">
5+
<issue><![CDATA[deprecation]]></issue>
6+
</line>
7+
</file>
8+
</files>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
phpunit --configuration ../_files/baseline/use-baseline-in-another-directory/phpunit.xml --generate-baseline
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
6+
$_SERVER['argv'][] = '--do-not-cache-result';
7+
$_SERVER['argv'][] = '--configuration';
8+
$_SERVER['argv'][] = __DIR__ . '/../_files/baseline/use-baseline-in-another-directory/phpunit.xml';
9+
10+
require_once __DIR__ . '/../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
Runtime: %s
18+
Configuration: %s
19+
20+
. 1 / 1 (100%)
21+
22+
Time: %s, Memory: %s
23+
24+
OK (1 test, 1 assertion)
25+
26+
1 issue was ignored by baseline.

0 commit comments

Comments
 (0)