Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F15624787
ValueRepresentationTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ValueRepresentationTest.php
View Options
<?php
namespace
Zed\Tests\Engines\API\Format
;
use
PHPUnit\Framework\Attributes\DataProvider
;
use
PHPUnit\Framework\TestCase
;
use
Zed\Engines\API\Format\ValueRepresentation
;
class
ValueRepresentationTest
extends
TestCase
{
public
static
function
provideValuesAndRepresentations
()
:
iterable
{
// Scalars
yield
[
null
,
ValueRepresentation
::
Scalar
];
yield
[
true
,
ValueRepresentation
::
Scalar
];
yield
[
false
,
ValueRepresentation
::
Scalar
];
yield
[
0
,
ValueRepresentation
::
Scalar
];
yield
[
1
,
ValueRepresentation
::
Scalar
];
yield
[
1.1
,
ValueRepresentation
::
Scalar
];
yield
[
""
,
ValueRepresentation
::
Scalar
];
yield
[
"foo"
,
ValueRepresentation
::
Scalar
];
// Arrays
yield
[[],
ValueRepresentation
::
List
];
yield
[[
1
,
2
,
3
],
ValueRepresentation
::
List
];
yield
[
[
"foo"
=>
"bar"
,
],
ValueRepresentation
::
Object
];
// Objects
yield
[
new
\stdClass
,
ValueRepresentation
::
Object
];
yield
[
new
\DateTimeImmutable
,
ValueRepresentation
::
Object
];
}
#[DataProvider('provideValuesAndRepresentations')]
public
function
testFrom
(
$value
,
$representation
)
{
$this
->
assertEquals
(
$representation
,
ValueRepresentation
::
from
(
$value
)
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Nov 26, 04:39 (17 h, 2 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
21320
Default Alt Text
ValueRepresentationTest.php (1 KB)
Attached To
Mode
rZED Zed
Attached
Detach File
Event Timeline
Log In to Comment