Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7427675
MobileCollectionTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
MobileCollectionTest.php
View Options
<?php
use
MediaWiki\Title\Title
;
use
MobileFrontend\Models\MobileCollection
;
use
MobileFrontend\Models\MobilePage
;
/**
* @group MobileFrontend
* @coversDefaultClass \MobileFrontend\Models\MobileCollection
*/
class
MobileCollectionTest
extends
MediaWikiIntegrationTestCase
{
/**
* @covers ::count
*/
public
function
testCountZeroPages
()
{
$mobileCollection
=
new
MobileCollection
();
// Should return 0 by default as $pages = [];
$actual
=
$mobileCollection
->
count
();
$this
->
assertSame
(
0
,
$actual
);
}
/**
* @covers ::count
* @covers ::add
*/
public
function
testAddAndCountPages
()
{
$mobileCollection
=
new
MobileCollection
();
$mobilePage
=
new
MobilePage
(
Title
::
newMainPage
(),
false
);
$mobileCollection
->
add
(
$mobilePage
);
$actual
=
$mobileCollection
->
count
();
$this
->
assertSame
(
1
,
$actual
);
$mobileCollection
->
add
(
$mobilePage
);
$actual
=
$mobileCollection
->
count
();
$this
->
assertSame
(
2
,
$actual
);
}
/**
* @covers ::getIterator
*/
public
function
testGetIterator
()
{
$mobilePage
=
new
MobilePage
(
Title
::
newFromText
(
'Page_test'
,
NS_MAIN
),
false
);
$mobileCollection
=
new
MobileCollection
();
// Let's have say 3 pages and check it's actually 3 pages
// before we move on.
$mobileCollection
->
add
(
$mobilePage
);
$mobileCollection
->
add
(
$mobilePage
);
$mobileCollection
->
add
(
$mobilePage
);
$actual
=
$mobileCollection
->
count
();
$this
->
assertSame
(
3
,
$actual
);
// Create a page of type Title and assert on it.
$expected
=
Title
::
newFromText
(
'Page_test'
,
NS_MAIN
);
foreach
(
$mobileCollection
as
$mbPage
)
{
$actual
=
$mbPage
->
getTitle
();
$this
->
assertSame
(
$expected
,
$actual
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 09:05 (14 h, 55 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2f/40/4a4f77304938d30eaddbbd22b0f7
Default Alt Text
MobileCollectionTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment