Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4792477
ItemGroupMappingTest.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
ItemGroupMappingTest.php
View Options
<?php
namespace
Nasqueron\Notifications\Tests\Analyzers
;
use
Illuminate\Foundation\Testing\WithoutMiddleware
;
use
Nasqueron\Notifications\Analyzers\ItemGroupMapping
;
use
Nasqueron\Notifications\Tests\TestCase
;
class
ItemGroupMappingTest
extends
TestCase
{
public
function
testDoesItemMatch
()
{
$this
->
assertTrue
(
ItemGroupMapping
::
doesItemMatch
(
'quux*'
,
'quuxians'
)
);
$this
->
assertTrue
(
ItemGroupMapping
::
doesItemMatch
(
'quux*'
,
'quux'
)
);
$this
->
assertFalse
(
ItemGroupMapping
::
doesItemMatch
(
'foobar'
,
'quux'
)
);
$this
->
assertFalse
(
ItemGroupMapping
::
doesItemMatch
(
''
,
'quuxians'
)
);
$this
->
assertFalse
(
ItemGroupMapping
::
doesItemMatch
(
'quux*'
,
''
)
);
}
/**
* @dataProvider payloadProvider
*/
public
function
testDeserialize
(
ItemGroupMapping
$payload
,
ItemGroupMapping
$expected
)
{
$this
->
assertEquals
(
$payload
,
$expected
);
}
private
function
deserialize
(
$file
)
:
ItemGroupMapping
{
$mapper
=
new
\JsonMapper
();
$payload
=
json_decode
(
file_get_contents
(
$file
));
return
$mapper
->
map
(
$payload
,
new
ItemGroupMapping
);
}
public
function
payloadProvider
()
:
array
{
$toProvide
=
[];
$path
=
__DIR__
.
'/../data/ItemGroupMapping'
;
$files
=
glob
(
$path
.
"/*.expected.json"
);
foreach
(
$files
as
$expectedResultFile
)
{
$resultFile
=
str_replace
(
".expected"
,
""
,
$expectedResultFile
);
$toProvide
[]
=
[
$this
->
deserialize
(
$resultFile
),
$this
->
deserialize
(
$expectedResultFile
),
];
}
return
$toProvide
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 20:13 (50 m, 54 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2438858
Default Alt Text
ItemGroupMappingTest.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment