Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4094993
AutoLoaderTest.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
AutoLoaderTest.php
View Options
<?php
use
Wikimedia\TestingAccessWrapper
;
/**
* @group Autoload
* @covers \AutoLoader
*/
class
AutoLoaderTest
extends
MediaWikiIntegrationTestCase
{
/** @var string[] */
private
$oldPsr4
;
/** @var string[] */
private
$oldClassFiles
;
protected
function
setUp
():
void
{
parent
::
setUp
();
$this
->
mergeMwGlobalArrayValue
(
'wgAutoloadLocalClasses'
,
[
'TestAutoloadedLocalClass'
=>
__DIR__
.
'/../data/autoloader/TestAutoloadedLocalClass.php'
,
]
);
$this
->
mergeMwGlobalArrayValue
(
'wgAutoloadClasses'
,
[
'TestAutoloadedClass'
=>
__DIR__
.
'/../data/autoloader/TestAutoloadedClass.php'
,
]
);
$access
=
TestingAccessWrapper
::
newFromClass
(
AutoLoader
::
class
);
$this
->
oldPsr4
=
$access
->
psr4Namespaces
;
$this
->
oldClassFiles
=
$access
->
classFiles
;
AutoLoader
::
registerNamespaces
(
[
'Test
\\
MediaWiki
\\
AutoLoader
\\
'
=>
__DIR__
.
'/../data/autoloader/psr4/'
]
);
AutoLoader
::
registerClasses
(
[
'TestAnotherAutoloadedClass'
=>
__DIR__
.
'/../data/autoloader/TestAnotherAutoloadedClass.php'
,
]
);
}
protected
function
tearDown
():
void
{
$access
=
TestingAccessWrapper
::
newFromClass
(
AutoLoader
::
class
);
$access
->
psr4Namespaces
=
$this
->
oldPsr4
;
$access
->
classFiles
=
$this
->
oldClassFiles
;
parent
::
tearDown
();
}
public
function
testFind
()
{
$path
=
__DIR__
.
'/../data/autoloader/TestAutoloadedLocalClass.php'
;
$this
->
assertSame
(
$path
,
AutoLoader
::
find
(
TestAutoloadedLocalClass
::
class
)
);
}
public
function
testCoreClass
()
{
$this
->
assertTrue
(
class_exists
(
'TestAutoloadedLocalClass'
)
);
}
public
function
testExtensionClass
()
{
$this
->
assertTrue
(
class_exists
(
'TestAnotherAutoloadedClass'
)
);
}
public
function
testLegacyExtensionClass
()
{
$this
->
assertTrue
(
class_exists
(
'TestAutoloadedClass'
)
);
}
public
function
testPsr4
()
{
$this
->
assertTrue
(
class_exists
(
'Test
\\
MediaWiki
\\
AutoLoader
\\
TestFooBar'
)
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 13:36 (4 w, 22 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
bf/1b/d86630252146d0446a3e1ce7c9dc
Default Alt Text
AutoLoaderTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment