Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12741865
OmniArrayTest.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
OmniArrayTest.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Keruald\OmniTools\Tests\Collections
;
use
Keruald\OmniTools\Collections\OmniArray
;
use
PHPUnit\Framework\TestCase
;
class
OmniArrayTest
extends
TestCase
{
public
function
testMap
()
:
void
{
$actual
=
(
new
OmniArray
([
1
,
2
,
3
,
4
,
5
]))
->
map
(
function
(
$x
)
{
return
$x
*
$x
;
})
->
toArray
();
$this
->
assertEquals
([
1
,
4
,
9
,
16
,
25
],
$actual
);
}
public
function
testImplode
()
:
void
{
$actual
=
(
new
OmniArray
([
"a"
,
"b"
,
"c"
]))
->
implode
(
"."
)
->
__toString
();
$this
->
assertEquals
(
"a.b.c"
,
$actual
);
}
public
function
testImplodeWithoutDelimiter
()
:
void
{
$actual
=
(
new
OmniArray
([
"a"
,
"b"
,
"c"
]))
->
implode
(
""
)
->
__toString
();
$this
->
assertEquals
(
"abc"
,
$actual
);
}
public
function
testExplode
()
:
void
{
$actual
=
OmniArray
::
explode
(
"."
,
"a.b.c"
);
$this
->
assertEquals
([
"a"
,
"b"
,
"c"
],
$actual
->
toArray
());
}
public
function
testExplodeWithoutDelimiter
()
:
void
{
$actual
=
OmniArray
::
explode
(
""
,
"a.b.c"
);
$this
->
assertEquals
([
"a.b.c"
],
$actual
->
toArray
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 16, 13:35 (1 d, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3160721
Default Alt Text
OmniArrayTest.php (1 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment