Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5957206
VerifyDeprecations.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
VerifyDeprecations.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Doctrine\Deprecations\PHPUnit
;
use
Doctrine\Deprecations\Deprecation
;
use
PHPUnit\Framework\Attributes\After
;
use
PHPUnit\Framework\Attributes\Before
;
use
function
sprintf
;
trait
VerifyDeprecations
{
/** @var array<string,int> */
private
$doctrineDeprecationsExpectations
=
[];
/** @var array<string,int> */
private
$doctrineNoDeprecationsExpectations
=
[];
public
function
expectDeprecationWithIdentifier
(
string
$identifier
):
void
{
$this
->
doctrineDeprecationsExpectations
[
$identifier
]
=
Deprecation
::
getTriggeredDeprecations
()[
$identifier
]
??
0
;
}
public
function
expectNoDeprecationWithIdentifier
(
string
$identifier
):
void
{
$this
->
doctrineNoDeprecationsExpectations
[
$identifier
]
=
Deprecation
::
getTriggeredDeprecations
()[
$identifier
]
??
0
;
}
/** @before */
#[Before]
public
function
enableDeprecationTracking
():
void
{
Deprecation
::
enableTrackingDeprecations
();
}
/** @after */
#[After]
public
function
verifyDeprecationsAreTriggered
():
void
{
foreach
(
$this
->
doctrineDeprecationsExpectations
as
$identifier
=>
$expectation
)
{
$actualCount
=
Deprecation
::
getTriggeredDeprecations
()[
$identifier
]
??
0
;
$this
->
assertTrue
(
$actualCount
>
$expectation
,
sprintf
(
"Expected deprecation with identifier '%s' was not triggered by code executed in test."
,
$identifier
)
);
}
foreach
(
$this
->
doctrineNoDeprecationsExpectations
as
$identifier
=>
$expectation
)
{
$actualCount
=
Deprecation
::
getTriggeredDeprecations
()[
$identifier
]
??
0
;
$this
->
assertTrue
(
$actualCount
===
$expectation
,
sprintf
(
"Expected deprecation with identifier '%s' was triggered by code executed in test, but expected not to."
,
$identifier
)
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 04:57 (3 w, 9 m ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
aa/e1/36ebcaf328b70a09c315310b881d
Default Alt Text
VerifyDeprecations.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment