-
-
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
85ea34f
commit 8c7ccf6
Showing
7 changed files
with
166 additions
and
8 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
23 changes: 23 additions & 0 deletions
23
tests/end-to-end/_files/TraitTargetedWithCoversMethodTest.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 <[email protected]> | ||
* | ||
* 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\CoversMethod; | ||
use PHPUnit\Framework\TestCase; | ||
use PHPUnit\TestFixture\CoveredTrait; | ||
|
||
#[CoversMethod(CoveredTrait::class, 'm')] | ||
final class TraitTargetedWithCoversMethodTest extends TestCase | ||
{ | ||
public function testSomething(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/end-to-end/_files/TraitTargetedWithUsesMethodTest.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 <[email protected]> | ||
* | ||
* 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\UsesMethod; | ||
use PHPUnit\Framework\TestCase; | ||
use PHPUnit\TestFixture\CoveredTrait; | ||
|
||
#[UsesMethod(CoveredTrait::class, 'm')] | ||
final class TraitTargetedWithUsesMethodTest extends TestCase | ||
{ | ||
public function testSomething(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
tests/end-to-end/metadata/targeting-traits-with-coversmethod-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,46 @@ | ||
--TEST-- | ||
The right events are emitted in the right order for a successful test that targets a trait with #[CoversMethod] | ||
--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/TraitTargetedWithCoversMethodTest.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
print file_get_contents($traceFile); | ||
|
||
unlink($traceFile); | ||
unlink($coverageFile); | ||
--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\TraitTargetedWithCoversMethodTest, 1 test) | ||
Test Preparation Started (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversMethodTest::testSomething) | ||
Test Prepared (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversMethodTest::testSomething) | ||
Test Passed (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversMethodTest::testSomething) | ||
Test Runner Triggered Deprecation (Targeting a trait such as PHPUnit\TestFixture\CoveredTrait with #[CoversMethod] is deprecated.) | ||
Test Finished (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversMethodTest::testSomething) | ||
Test Suite Finished (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithCoversMethodTest, 1 test) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 0) |
46 changes: 46 additions & 0 deletions
46
tests/end-to-end/metadata/targeting-traits-with-usesmethod-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,46 @@ | ||
--TEST-- | ||
The right events are emitted in the right order for a successful test that targets a trait with #[UsesMethod] | ||
--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/TraitTargetedWithUsesMethodTest.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
print file_get_contents($traceFile); | ||
|
||
unlink($traceFile); | ||
unlink($coverageFile); | ||
--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\TraitTargetedWithUsesMethodTest, 1 test) | ||
Test Preparation Started (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesMethodTest::testSomething) | ||
Test Prepared (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesMethodTest::testSomething) | ||
Test Passed (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesMethodTest::testSomething) | ||
Test Runner Triggered Deprecation (Targeting a trait such as PHPUnit\TestFixture\CoveredTrait with #[UsesMethod] is deprecated.) | ||
Test Finished (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesMethodTest::testSomething) | ||
Test Suite Finished (PHPUnit\DeprecatedAnnotationsTestFixture\TraitTargetedWithUsesMethodTest, 1 test) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 0) |