Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F13144504
StringPadTest.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
StringPadTest.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Keruald\OmniTools\Tests\Strings\Multibyte
;
use
Keruald\OmniTools\Strings\Multibyte\StringPad
as
Pad
;
use
PHPUnit\Framework\TestCase
;
use
InvalidArgumentException
;
class
StringPadTest
extends
TestCase
{
public
function
testSetPadTypeWithBogusValue
()
:
void
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$pad
=
new
Pad
;
$pad
->
setPadType
(
7
);
}
public
function
testIsValidPadType
()
:
void
{
$this
->
assertTrue
(
Pad
::
isValidPadType
(
STR_PAD_LEFT
));
$this
->
assertTrue
(
Pad
::
isValidPadType
(
STR_PAD_RIGHT
));
$this
->
assertTrue
(
Pad
::
isValidPadType
(
STR_PAD_BOTH
));
$this
->
assertFalse
(
Pad
::
isValidPadType
(
7
));
}
public
function
testSetPadTypeWithBogusEncoding
()
:
void
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$pad
=
new
Pad
;
$pad
->
setEncoding
(
"notexisting"
);
}
public
function
testSetLeftPad
()
:
void
{
$pad
=
new
Pad
;
$pad
->
setLeftPad
();
$this
->
assertEquals
(
STR_PAD_LEFT
,
$pad
->
getPadType
());
}
public
function
testSetRightPad
()
:
void
{
$pad
=
new
Pad
;
$pad
->
setRightPad
();
$this
->
assertEquals
(
STR_PAD_RIGHT
,
$pad
->
getPadType
());
}
public
function
testSetBothPad
()
:
void
{
$pad
=
new
Pad
;
$pad
->
setBothPad
();
$this
->
assertEquals
(
STR_PAD_BOTH
,
$pad
->
getPadType
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 21, 16:59 (9 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3140943
Default Alt Text
StringPadTest.php (1 KB)
Attached To
Mode
rKOT Keruald OmniTools
Attached
Detach File
Event Timeline
Log In to Comment