Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5961453
SomeSlowTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
SomeSlowTest.php
View Options
<?php
declare
(
strict_types
=
1
);
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
(
int
$time
)
{
$this
->
extendTime
(
$time
);
$this
->
assertTrue
(
true
);
}
public
function
provideTime
()
{
return
[
'Rock'
=>
[
800
],
'Chalk'
=>
[
700
],
'Jayhawk'
=>
[
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 not to be
* considered slow and not reported in the test output.
*
* @slowThreshold 50000
*/
public
function
testCanSetHigherSlowThreshold
()
{
$this
->
extendTime
(
600
);
$this
->
assertTrue
(
true
);
}
/**
* This test's runtime would normally be over the suite's threshold, but
* this annotation disables threshold checks causing it not to be
* considered slow and not reported in the test output.
*
* @slowThreshold 0
*/
public
function
testCanDisableSlowThreshold
()
{
$this
->
extendTime
(
600
);
$this
->
assertTrue
(
true
);
}
/**
* @param int $ms Number of additional microseconds to execute code
*/
private
function
extendTime
(
int
$ms
)
{
usleep
(
$ms
*
1000
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 08:06 (1 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ad/41/c5ef50b5ac18cc3331bed34fc27c
Default Alt Text
SomeSlowTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment