-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from johnkary/support60
Add support for PHPUnit 6.0
- Loading branch information
Showing
8 changed files
with
166 additions
and
75 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/phpunit.xml | ||
/vendor | ||
/composer.lock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace JohnKary\PHPUnit\Listener\Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class ExceptionalTest extends TestCase | ||
{ | ||
public function testExceptionCanBeThrownInTest() | ||
{ | ||
$this->expectException('InvalidArgumentException'); | ||
$this->expectExceptionMessage('CODE1'); | ||
throw new \InvalidArgumentException('CODE1'); | ||
} | ||
|
||
public function testSkippedTest() | ||
{ | ||
$this->markTestSkipped('Skipped tests do not cause Exceptions in Listener'); | ||
} | ||
|
||
public function testIncompleteTest() | ||
{ | ||
$this->markTestIncomplete('Incomplete tests do not cause Exceptions in Listener'); | ||
} | ||
} | ||
|
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,86 @@ | ||
<?php | ||
|
||
namespace JohnKary\PHPUnit\Listener\Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class SomeSlowTest extends TestCase | ||
{ | ||
public function testFastTest() | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
|
||
public function testSlowTests() | ||
{ | ||
$this->extendTime(300); | ||
|
||
$this->assertTrue(true); | ||
} | ||
|
||
public function testAnotherSlowTests() | ||
{ | ||
$this->extendTime(500); | ||
|
||
$this->assertTrue(true); | ||
} | ||
|
||
public function testLongEndToEndTest() | ||
{ | ||
$this->extendTime(500); | ||
|
||
$this->assertTrue(true); | ||
} | ||
|
||
/** | ||
* @dataProvider provideTime | ||
*/ | ||
public function testWithDataProvider($time) | ||
{ | ||
$this->extendTime($time); | ||
|
||
$this->assertTrue(true); | ||
} | ||
public function provideTime() | ||
{ | ||
return array( | ||
'Rock' => array(800), | ||
'Chalk' => array(700), | ||
'Jayhawk' => array(600), | ||
); | ||
} | ||
|
||
/** | ||
* This test's runtime would normally be under the suite's threshold, but | ||
* this annotation sets a lower threshold, causing it to be considered slow | ||
* and reported on in the test output. | ||
* | ||
* @slowThreshold 5 | ||
*/ | ||
public function testCanSetLowerSlowThreshold() | ||
{ | ||
$this->extendTime(10); | ||
$this->assertTrue(true); | ||
} | ||
|
||
/** | ||
* This test's runtime would normally be over the suite's threshold, but | ||
* this annotation sets a higher threshold, causing it to be not be | ||
* considered slow and not reported on in the test output. | ||
* | ||
* @slowThreshold 50000 | ||
*/ | ||
public function testCanSetHigherSlowThreshold() | ||
{ | ||
$this->extendTime(600); | ||
$this->assertTrue(true); | ||
} | ||
|
||
/** | ||
* @param int $ms Number of additional microseconds to execute code | ||
*/ | ||
private function extendTime($ms) | ||
{ | ||
usleep($ms * 1000); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.