Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F1136667
ValueRepresentationTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
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, Jul 10, 19:06 (4 w, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
21320
Default Alt Text
ValueRepresentationTest.php (1 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment