Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4126357
ApiEchoMarkReadTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ApiEchoMarkReadTest.php
View Options
<?php
namespace
MediaWiki\Extension\Notifications\Test\API
;
use
MediaWiki\Tests\Api\ApiTestCase
;
/**
* @group medium
* @group API
* @group Database
* @covers \MediaWiki\Extension\Notifications\Api\ApiEchoMarkRead
*/
class
ApiEchoMarkReadTest
extends
ApiTestCase
{
public
function
testMarkReadWithList
()
{
// Grouping by section
$data
=
$this
->
doApiRequestWithToken
(
[
'action'
=>
'echomarkread'
,
'notlist'
=>
'121|122|123'
,
]
);
$this
->
assertArrayHasKey
(
'query'
,
$data
[
0
]
);
$this
->
assertArrayHasKey
(
'echomarkread'
,
$data
[
0
][
'query'
]
);
$result
=
$data
[
0
][
'query'
][
'echomarkread'
];
// General count
$this
->
assertArrayHasKey
(
'count'
,
$result
);
$this
->
assertArrayHasKey
(
'rawcount'
,
$result
);
$this
->
assertArrayHasKey
(
'alert'
,
$result
);
$alert
=
$result
[
'alert'
];
$this
->
assertArrayHasKey
(
'rawcount'
,
$alert
);
$this
->
assertArrayHasKey
(
'count'
,
$alert
);
$this
->
assertArrayHasKey
(
'message'
,
$result
);
$message
=
$result
[
'message'
];
$this
->
assertArrayHasKey
(
'rawcount'
,
$message
);
$this
->
assertArrayHasKey
(
'count'
,
$message
);
}
public
function
testMarkReadWithAll
()
{
// Grouping by section
$data
=
$this
->
doApiRequestWithToken
(
[
'action'
=>
'echomarkread'
,
'notall'
=>
'1'
,
]
);
$this
->
assertArrayHasKey
(
'query'
,
$data
[
0
]
);
$this
->
assertArrayHasKey
(
'echomarkread'
,
$data
[
0
][
'query'
]
);
$result
=
$data
[
0
][
'query'
][
'echomarkread'
];
// General count
$this
->
assertArrayHasKey
(
'count'
,
$result
);
$this
->
assertArrayHasKey
(
'rawcount'
,
$result
);
$this
->
assertArrayHasKey
(
'alert'
,
$result
);
$alert
=
$result
[
'alert'
];
$this
->
assertArrayHasKey
(
'rawcount'
,
$alert
);
$this
->
assertArrayHasKey
(
'count'
,
$alert
);
$this
->
assertArrayHasKey
(
'message'
,
$result
);
$message
=
$result
[
'message'
];
$this
->
assertArrayHasKey
(
'rawcount'
,
$message
);
$this
->
assertArrayHasKey
(
'count'
,
$message
);
}
public
function
testMarkReadWithSections
()
{
// Grouping by section
$data
=
$this
->
doApiRequestWithToken
(
[
'action'
=>
'echomarkread'
,
'sections'
=>
'alert|message'
,
]
);
$this
->
assertArrayHasKey
(
'query'
,
$data
[
0
]
);
$this
->
assertArrayHasKey
(
'echomarkread'
,
$data
[
0
][
'query'
]
);
$result
=
$data
[
0
][
'query'
][
'echomarkread'
];
// General count
$this
->
assertArrayHasKey
(
'count'
,
$result
);
$this
->
assertArrayHasKey
(
'rawcount'
,
$result
);
$this
->
assertArrayHasKey
(
'alert'
,
$result
);
$alert
=
$result
[
'alert'
];
$this
->
assertArrayHasKey
(
'rawcount'
,
$alert
);
$this
->
assertArrayHasKey
(
'count'
,
$alert
);
$this
->
assertArrayHasKey
(
'message'
,
$result
);
$message
=
$result
[
'message'
];
$this
->
assertArrayHasKey
(
'rawcount'
,
$message
);
$this
->
assertArrayHasKey
(
'count'
,
$message
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 08:03 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e3/42/ee7ed70416eb7df33647ae095a20
Default Alt Text
ApiEchoMarkReadTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment