-
-
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.
Add nicer user error reporting for tearDownAfterClass(), plus new test
- Loading branch information
1 parent
ef6d03e
commit 96c1264
Showing
4 changed files
with
84 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/* | ||
* 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. | ||
*/ | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class ExceptionInTearDownAfterClassTest extends TestCase | ||
{ | ||
public $setUp = false; | ||
|
||
public $assertPreConditions = false; | ||
|
||
public $assertPostConditions = false; | ||
|
||
public $tearDown = false; | ||
|
||
public $tearDownAfterClass = false; | ||
|
||
public $testSomething = false; | ||
|
||
public static function tearDownAfterClass(): void | ||
{ | ||
throw new Exception('throw Exception in tearDownAfterClass()'); | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->setUp = true; | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
$this->tearDown = true; | ||
} | ||
|
||
public function testOne(): void | ||
{ | ||
$this->testSomething = true; | ||
$this->assertTrue(true); | ||
} | ||
|
||
public function testTwo(): void | ||
{ | ||
$this->testSomething = $this->testSomething && true; | ||
$this->assertTrue(true); | ||
} | ||
|
||
protected function assertPreConditions(): void | ||
{ | ||
$this->assertPreConditions = true; | ||
} | ||
|
||
protected function assertPostConditions(): void | ||
{ | ||
$this->assertPostConditions = 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
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