Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7490807
ShrinkingTimeLimitTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ShrinkingTimeLimitTest.php
View Options
<?php
use
Eris\Generator
;
use
Eris\Generators
;
function
very_slow_concatenation
(
$first
,
$second
)
{
if
(
strlen
(
$second
)
>
10
)
{
sleep
(
2
);
$second
.=
'ERROR'
;
}
return
$first
.
$second
;
}
class
ShrinkingTimeLimitTest
extends
\PHPUnit\Framework\TestCase
{
use
Eris\TestTrait
;
public
function
testLengthPreservation
()
{
$this
->
shrinkingTimeLimit
(
2
)
->
forAll
(
Generators
::
string
(),
Generators
::
string
()
)
->
then
(
function
(
$first
,
$second
)
{
$result
=
very_slow_concatenation
(
$first
,
$second
);
$this
->
assertEquals
(
strlen
(
$first
)
+
strlen
(
$second
),
strlen
(
$result
),
"Concatenating '$first' to '$second' gives '$result'"
.
PHP_EOL
);
});
}
/**
* @eris-shrink 2
*/
public
function
testLengthPreservationFromAnnotation
()
{
$this
->
forAll
(
Generator\string
(),
Generator\string
()
)
->
then
(
function
(
$first
,
$second
)
{
$result
=
very_slow_concatenation
(
$first
,
$second
);
$this
->
assertEquals
(
strlen
(
$first
)
+
strlen
(
$second
),
strlen
(
$result
),
"Concatenating '$first' to '$second' gives '$result'"
.
PHP_EOL
);
});
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Nov 23, 19:04 (6 d, 5 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ba/e9/145dc5e08060c6cbd452c6ed84a3
Default Alt Text
ShrinkingTimeLimitTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment