-
-
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
1 parent
2c22732
commit ba61e62
Showing
12 changed files
with
171 additions
and
28 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
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
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
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
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
23 changes: 23 additions & 0 deletions
23
tests/end-to-end/_files/TraitTargetedWithCoversTraitTest.php
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,23 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <sebastian@phpunit.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\DeprecatedAnnotationsTestFixture; | ||
|
||
use PHPUnit\Framework\Attributes\CoversTrait; | ||
use PHPUnit\Framework\TestCase; | ||
use PHPUnit\TestFixture\CoveredTrait; | ||
|
||
#[CoversTrait(CoveredTrait::class)] | ||
final class TraitTargetedWithCoversTraitTest extends TestCase | ||
{ | ||
public function testSomething(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/end-to-end/_files/TraitTargetedWithUsesTraitTest.php
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,23 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <sebastian@phpunit.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\DeprecatedAnnotationsTestFixture; | ||
|
||
use PHPUnit\Framework\Attributes\UsesTrait; | ||
use PHPUnit\Framework\TestCase; | ||
use PHPUnit\TestFixture\CoveredTrait; | ||
|
||
#[UsesTrait(CoveredTrait::class)] | ||
final class TraitTargetedWithUsesTraitTest extends TestCase | ||
{ | ||
public function testSomething(): 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
45 changes: 45 additions & 0 deletions
45
tests/end-to-end/metadata/targeting-traits-with-coverstrait-attribute-is-deprecated.phpt
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,45 @@ | ||
--TEST-- | ||
The right events are emitted in the right order for a successful test that targets a trait with #[CoversTrait] | ||
--SKIPIF-- | ||
<?php declare(strict_types=1); | ||
require __DIR__ . '/../../_files/skip-if-requires-code-coverage-driver.php'; | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = tempnam(sys_get_temp_dir(), __FILE__); | ||
$coverageFile = 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'][] = '--coverage-text=' . $coverageFile; | ||
$_SERVER['argv'][] = '--coverage-filter'; | ||
$_SERVER['argv'][] = __DIR__ . '/../_files'; | ||
$_SERVER['argv'][] = __DIR__ . '/../_files/TraitTargetedWithCoversTraitTest.php'; | ||
|
||
require __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 | ||
Event Facade Sealed | ||
Test Suite Loaded (1 test) | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (1 test) | ||
Test Suite Started (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversTraitTest, 1 test) | ||
Test Preparation Started (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversTraitTest::testSomething) | ||
Test Prepared (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversTraitTest::testSomething) | ||
Test Passed (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversTraitTest::testSomething) | ||
Test Runner Triggered Deprecation (Targeting a trait such as PHPUnit\TestFixture\CoveredTrait with #[CoversTrait] is deprecated. The traits used by the class(es) you target with #[CoversClass] will be targeted as well.) | ||
Test Finished (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversTraitTest::testSomething) | ||
Test Suite Finished (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversTraitTest, 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
45 changes: 45 additions & 0 deletions
45
tests/end-to-end/metadata/targeting-traits-with-usestrait-attribute-is-deprecated.phpt
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,45 @@ | ||
--TEST-- | ||
The right events are emitted in the right order for a successful test that targets a trait with #[UsesTrait] | ||
--SKIPIF-- | ||
<?php declare(strict_types=1); | ||
require __DIR__ . '/../../_files/skip-if-requires-code-coverage-driver.php'; | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = tempnam(sys_get_temp_dir(), __FILE__); | ||
$coverageFile = 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'][] = '--coverage-text=' . $coverageFile; | ||
$_SERVER['argv'][] = '--coverage-filter'; | ||
$_SERVER['argv'][] = __DIR__ . '/../_files'; | ||
$_SERVER['argv'][] = __DIR__ . '/../_files/TraitTargetedWithUsesTraitTest.php'; | ||
|
||
require __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 | ||
Event Facade Sealed | ||
Test Suite Loaded (1 test) | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (1 test) | ||
Test Suite Started (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesTraitTest, 1 test) | ||
Test Preparation Started (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesTraitTest::testSomething) | ||
Test Prepared (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesTraitTest::testSomething) | ||
Test Passed (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesTraitTest::testSomething) | ||
Test Runner Triggered Deprecation (Targeting a trait such as PHPUnit\TestFixture\CoveredTrait with #[UsesTrait] is deprecated. The traits used by the class(es) you target with #[UsesClass] will be targeted as well.) | ||
Test Finished (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesTraitTest::testSomething) | ||
Test Suite Finished (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesTraitTest, 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