Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793331
DebuggerTest.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
DebuggerTest.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Keruald\OmniTools\Tests\Debug
;
use
Keruald\OmniTools\Debug\Debugger
;
use
PHPUnit\Framework\TestCase
;
class
DebuggerTest
extends
TestCase
{
///
/// Unit tests
///
public
function
testRegister
()
{
$this
->
assertTestSuiteStateIsValid
();
Debugger
::
register
();
$this
->
assertTrue
(
function_exists
(
"dprint_r"
));
}
private
function
assertTestSuiteStateIsValid
()
:
void
{
$this
->
assertFalse
(
function_exists
(
"dprint_r"
),
"Configure the test suite so dprint_r isn't in global space first."
);
}
///
/// Integration tests
///
/**
* @dataProvider provideDebuggerScripts
*/
public
function
testDebuggerScript
(
$script
,
$message
)
:
void
{
$this
->
assertProgramMatchesOutput
(
$script
,
$message
);
}
private
function
assertProgramMatchesOutput
(
string
$script
,
string
$message
=
""
)
:
void
{
$filename
=
__DIR__
.
"/testers/$script"
;
$expected
=
file_get_contents
(
$filename
.
".txt"
);
$actual
=
`php $filename.php`
;
$this
->
assertSame
(
$expected
,
$actual
,
$message
);
}
public
function
provideDebuggerScripts
()
:
iterable
{
yield
[
"dump_integer"
,
"Can't dump a variable"
];
yield
[
"dump_array"
,
"Can't dump an array"
];
yield
[
"dump_object"
,
"Can't dump an object"
];
yield
[
"check_die"
,
"printVariableAndDie doesn't die"
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 21:45 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2437292
Default Alt Text
DebuggerTest.php (1 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment