-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd" | ||
bootstrap="src/Foo.php"> | ||
<testsuites> | ||
<testsuite name="default"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\TestFixture\CoversUsesFiltering; | ||
|
||
final class Foo | ||
{ | ||
public function bar(): bool | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\TestFixture\CoversUsesFiltering; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
#[CoversClass(Foo::class)] | ||
final class CoversTest extends TestCase | ||
{ | ||
public function testOne(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\TestFixture\CoversUsesFiltering; | ||
|
||
use PHPUnit\Framework\Attributes\UsesClass; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
#[UsesClass(Foo::class)] | ||
final class UsesTest extends TestCase | ||
{ | ||
public function testOne(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--TEST-- | ||
phpunit --covers PHPUnit\TestFixture\CoversUsesFiltering\Foo | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = tempnam(sys_get_temp_dir(), __FILE__); | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--no-output'; | ||
$_SERVER['argv'][] = '--log-events-text'; | ||
$_SERVER['argv'][] = $traceFile; | ||
$_SERVER['argv'][] = '--covers'; | ||
$_SERVER['argv'][] = \PHPUnit\TestFixture\CoversUsesFiltering\Foo::class; | ||
$_SERVER['argv'][] = __DIR__ . '/../../_files/covers-uses'; | ||
|
||
require_once __DIR__ . '/../../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
print file_get_contents($traceFile); | ||
|
||
unlink($traceFile); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using %s) | ||
Test Runner Configured | ||
Test Suite Loaded (2 tests) | ||
Event Facade Sealed | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Suite Filtered (1 test) | ||
Test Runner Execution Started (1 test) | ||
Test Suite Started (CLI Arguments, 1 test) | ||
Test Suite Started (PHPUnit\TestFixture\CoversUsesFiltering\CoversTest, 1 test) | ||
Test Preparation Started (PHPUnit\TestFixture\CoversUsesFiltering\CoversTest::testOne) | ||
Test Prepared (PHPUnit\TestFixture\CoversUsesFiltering\CoversTest::testOne) | ||
Test Passed (PHPUnit\TestFixture\CoversUsesFiltering\CoversTest::testOne) | ||
Test Finished (PHPUnit\TestFixture\CoversUsesFiltering\CoversTest::testOne) | ||
Test Suite Finished (PHPUnit\TestFixture\CoversUsesFiltering\CoversTest, 1 test) | ||
Test Suite Finished (CLI Arguments, 1 test) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--TEST-- | ||
phpunit --uses PHPUnit\TestFixture\CoversUsesFiltering\Foo | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = tempnam(sys_get_temp_dir(), __FILE__); | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--no-output'; | ||
$_SERVER['argv'][] = '--log-events-text'; | ||
$_SERVER['argv'][] = $traceFile; | ||
$_SERVER['argv'][] = '--uses'; | ||
$_SERVER['argv'][] = \PHPUnit\TestFixture\CoversUsesFiltering\Foo::class; | ||
$_SERVER['argv'][] = __DIR__ . '/../../_files/covers-uses'; | ||
|
||
require_once __DIR__ . '/../../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
print file_get_contents($traceFile); | ||
|
||
unlink($traceFile); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using %s) | ||
Test Runner Configured | ||
Test Suite Loaded (2 tests) | ||
Event Facade Sealed | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Suite Filtered (1 test) | ||
Test Runner Execution Started (1 test) | ||
Test Suite Started (CLI Arguments, 1 test) | ||
Test Suite Started (PHPUnit\TestFixture\CoversUsesFiltering\UsesTest, 1 test) | ||
Test Preparation Started (PHPUnit\TestFixture\CoversUsesFiltering\UsesTest::testOne) | ||
Test Prepared (PHPUnit\TestFixture\CoversUsesFiltering\UsesTest::testOne) | ||
Test Passed (PHPUnit\TestFixture\CoversUsesFiltering\UsesTest::testOne) | ||
Test Finished (PHPUnit\TestFixture\CoversUsesFiltering\UsesTest::testOne) | ||
Test Suite Finished (PHPUnit\TestFixture\CoversUsesFiltering\UsesTest, 1 test) | ||
Test Suite Finished (CLI Arguments, 1 test) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 0) |