Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F15183087
ApiTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Unknown
Size
864 B
Referenced Files
None
Subscribers
None
ApiTest.php
View Options
<?php
// use the phpunit framework
use
PHPUnit
\
Framework
\
TestCase
;
/**
* Test Query class
*/
final
class
ApiTest
extends
TestCase
{
/**
* Test the itwiki API with Category members
*/
public
function
testItwikiQueryCategoryMembers
(
)
{
$limit
=
3
;
$queries
=
itwiki
(
)
->
createQuery
(
[
'action'
=>
'query'
,
'list'
=>
'categorymembers'
,
'cmtitle'
=>
'Categoria:Software con licenza GNU GPL'
,
'cmlimit'
=>
$limit
,
]
)
;
$i
=
0
;
foreach
(
$queries
as
$query
)
{
foreach
(
$query
->
query
->
categorymembers
as
$member
)
{
$member
->
pageid
;
$member
->
ns
;
$member
->
title
;
// count the pages
$i
++
;
}
// it's not necessary to do consecutive queries
// this is just a test on the first page
break
;
}
// check whenever we were able to find $limit pages
$this
->
assertEquals
(
$i
,
$limit
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Nov 19, 07:11 (9 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2265282
Default Alt Text
ApiTest.php (864 B)
Attached To
Mode
R21 boz-mw: MediaWiki API client
Attached
Detach File
Event Timeline