Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793726
AutoloaderTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
AutoloaderTest.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Keruald\OmniTools\Tests\Registration
;
use
Keruald\OmniTools\Registration\Autoloader
;
use
Keruald\OmniTools\Tests\WithData
;
use
PHPUnit\Framework\TestCase
;
use
Acme\MockLib\Foo
;
// a mock class in a mock namespace to test autoload.
class
AutoloaderTest
extends
TestCase
{
use
WithData
;
public
function
testRegisterPSR4
()
:
void
{
$class
=
Foo
::
class
;
$this
->
assertFalse
(
class_exists
(
$class
),
"Please reconfigure the test suite not to include the $class class."
);
Autoloader
::
registerPSR4
(
"Acme
\\
MockLib
\\
"
,
$this
->
getDataPath
(
"MockLib"
));
$this
->
assertTrue
(
class_exists
(
$class
));
$this
->
assertFalse
(
class_exists
(
"NotExisting"
));
}
public
function
testGetLibraryPath
()
:
void
{
$this
->
assertStringStartsWith
(
dirname
(
Autoloader
::
getLibraryPath
()),
// lib is in <root>/src
__DIR__
// we are in <root>/tests/…
);
}
public
function
testRegister
()
:
void
{
$count
=
count
(
spl_autoload_functions
());
Autoloader
::
selfRegister
();
$this
->
assertEquals
(++
$count
,
count
(
spl_autoload_functions
()));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 22:47 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2435951
Default Alt Text
AutoloaderTest.php (1 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment