###################################################### #### Warning: run these tests via parserTests.php # #### # #### These tests tend to fail when run from phpunit. # ###################################################### # Not clear if this does anything, but other extension do it. # However, seems to make this not work, so commenting out for now. #!! hooks #DynamicPageList #!! endhooks # Some of these might fail if some other # extension adds articles to the tests, which is bad. # Things not tested: ## *Flagged revs related props ## *Actual intersection (multiple notcategory/category clauses) ## due to issue with mysql self-joins on temp tables. ## *Date related things (Addcategorydate) since the output ## varries depending on today's date. ## *gallery stuff (lack of images) ## *some order methods, due to lack of flexibity in page creation ## googlehack (dpl_id) stuff because page_id changes depending on other tests. !!article MediaWiki:Bad_image_list !!text * [[:File:Bad.jpg]] except [[Nasty page]] !!endarticle !! article DPLTest1 !! text [[category:DPLtest]] !! endarticle !! article Talk:DPLTest2 !! text [[category:DPLtest]] [[category:DPLtest3]] [[category:DPLtest2]] !! endarticle !! article Talk:no_Categories !! text no cats !! endarticle !! article Yet another DPL test page! !! text [[category:DPLtest]] [[category:DPLtest2]] !! endarticle !! article help:DPLTest3 !! text Article. [[category:DPLtest2]] !! endarticle !! article DPLRedir !! text #Redirect[[DPLtest]] [[category:DPLtest]] !! endarticle # start actual tests. !!test basic, single category list, ordered by cat add, desc. !!input <DynamicPageList> category=DPLtest </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end !!test basic, single category list, but ascending !!input <DynamicPageList> order = ascending category=DPLtest </DynamicPageList> !!result <ul> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li></ul> !!end # Depnds on page id of other pages # so could break depending on other tests # if they get different page id # # Low and behold that actually does happen. Commenting out. #!!test #dpl_id #!!input #<DynamicPageList> #category=DPLtest #googlehack=true #</DynamicPageList> #!!result #<ul> #<li><a href="/wiki/Yet_another_DPL_test_page!?dpl_id=53">Yet another DPL test page!</a></li> #<li><a href="/wiki/Talk:DPLTest2?dpl_id=51">Talk:DPLTest2</a></li> #<li><a href="/wiki/DPLTest1?dpl_id=50">DPLTest1</a></li></ul> # #!!end !!test nofollow !!input <DynamicPageList> category=DPLtest nofollow=true </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!" rel="nofollow">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2" rel="nofollow">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1" rel="nofollow">DPLTest1</a></li></ul> !!end !!test supresserrors !!input <DynamicPageList> category=DPLtest category=DPLtest1 category=DPLtest2 category=DPLtest3 category=DPLtest4 category=DPLtest5 category=DPLtest7 category=DPLtest6 category=DPLtest8 category=DPLtest9 category=DPLtest10 suppresserrors=true </DynamicPageList> !!result !!end ## BROKEN!! mysql doesn't like using self-joins on temporary tables ## which breaks this test. #!!test #Intersection. #!!input #<DynamicPageList> #category=DPLtest #category=DPLtest2 #</DynamicPageList> #!!result #<ul> #<li><a href="/wiki/Yet_another_DPL_test_page!">Yet another DPL test page!</a></li> # <li><a href="/wiki/Talk:DPLTest2">Talk:DPLTest2</a></li></ul> # #!!end ## BROKEN!! (same as above) #!!test #Intersection and negation. #!!input #<DynamicPageList> #category=DPLtest #category=DPLtest2 #notcategory=DPLtest3 #</DynamicPageList> #!!result #<ul> #<li><a href="/wiki/Talk:DPLTest2">Talk:DPLTest2</a></li></ul> # #!!end !!test Negation with namespace. !!input <DynamicPageList> namespace=talk notcategory=DPLtest3 </DynamicPageList> !!result <ul> <li><a href="/wiki/Talk:No_Categories" title="Talk:No Categories">Talk:No Categories</a></li></ul> !!end !!test Namespace limited to category. !!input <DynamicPageList> category=DPLtest namespace=talk </DynamicPageList> !!result <ul> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li></ul> !!end !!test Namespace no category. !!input <DynamicPageList> namespace=help </DynamicPageList> !!result <ul> <li><a href="/wiki/Help:DPLTest3" title="Help:DPLTest3">Help:DPLTest3</a></li></ul> !!end !!test Don't show namespace name. (shownamespace=false) !!input <DynamicPageList> namespace=help shownamespace=false </DynamicPageList> !!result <ul> <li><a href="/wiki/Help:DPLTest3" title="Help:DPLTest3">DPLTest3</a></li></ul> !!end # This one has count=1 to avoid articles from other tests. !!test Invalid ns treated as main namespace !!input <DynamicPageList> namespace=Look mummy, this totally isn't a namespace count=2 </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end !!test count and offset combined. !!input <DynamicPageList> category=DPLtest count=1 offset=1 </DynamicPageList> !!result <ul> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li></ul> !!end !!test include redirects !!input <DynamicPageList> category=DPLtest redirects=include </DynamicPageList> !!result <ul> <li><a href="/wiki/DPLRedir" class="mw-redirect" title="DPLRedir">DPLRedir</a></li> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end !!test only redirect !!input <DynamicPageList> category=DPLtest redirects=only </DynamicPageList> !!result <ul> <li><a href="/wiki/DPLRedir" class="mw-redirect" title="DPLRedir">DPLRedir</a></li></ul> !!end # Should behave like false. # Can't actually test true, since the date would vary. !!test addfirstcategorydate=INVALID !!input <DynamicPageList> category=DPLtest addfirstcategorydate=INVALID </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end !!test addfirstcategorydate=false !!input <DynamicPageList> category=DPLtest addfirstcategorydate=false </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end !!test mode=unordered (default) !!input <DynamicPageList> category=DPLtest mode=unordered </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end !!test mode=INVALID !!input <DynamicPageList> category=DPLtest mode=INVALID </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end !!test mode=ordered !!input <DynamicPageList> category=DPLtest mode=ordered </DynamicPageList> !!result <ol> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ol> !!end # This is broken !!test mode=none (line breaks) !!input <DynamicPageList> category=DPLtest mode=none </DynamicPageList> !!result <p><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a><br /> <a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a><br /> <a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a><br /> </p> !!end !!test mode=inline (comma list) !!input <DynamicPageList> category=DPLtest mode=inline </DynamicPageList> !!result <p><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a>, <a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a>, <a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a> </p> !!end # None of these are images, so crappy test. !!test mode=gallery (complex, no image) !!input <DynamicPageList> category=DPLtest imagewidth=70 galleryshowfilesize=yes galleryshowfilename=yes imagesperrow=7 gallerycaption=Look at my pretty gallery. {{SERVER}} mode=gallery </DynamicPageList> !!result <ul class="gallery" style="max-width: 791px;_width: 791px;"> <li class='gallerycaption'>Look at my pretty gallery. http://Britney-Spears</li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> <div style="height: 150px;">Yet another DPL test page!</div> <div class="gallerytext"> <p><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test p...</a><br /> File missing<br /> </p> </div> </div></li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> <div style="height: 150px;">DPLTest2</div> <div class="gallerytext"> <p><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">DPLTest2</a><br /> File missing<br /> </p> </div> </div></li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> <div style="height: 150px;">DPLTest1</div> <div class="gallerytext"> <p><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a><br /> File missing<br /> </p> </div> </div></li> </ul> !!end !!test mode=gallery (simple, no image) !!input <DynamicPageList> category=DPLtest mode=gallery </DynamicPageList> !!result <ul class="gallery"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> <div style="height: 150px;">Yet another DPL test page!</div> <div class="gallerytext"> <p><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test p...</a><br /> </p> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> <div style="height: 150px;">DPLTest2</div> <div class="gallerytext"> <p><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">DPLTest2</a><br /> </p> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> <div style="height: 150px;">DPLTest1</div> <div class="gallerytext"> <p><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a><br /> </p> </div> </div></li> </ul> !!end !!test mode=gallery (complex, with image + bad image) !!input <DynamicPageList> mode=gallery namespace=file addfirstcategorydate=ymd imagewidth=70 galleryshowfilesize=yes galleryshowfilename=yes imagesperrow=7 gallerycaption=I love Captions ordermethod=sortkey order=descending </DynamicPageList> !!result <ul class="gallery" style="max-width: 791px;_width: 791px;"> <li class='gallerycaption'>I love Captions</li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> <div style="height: 150px;"><a href="/wiki/File:Bad.jpg" title="File:Bad.jpg">Bad.jpg</a></div> <div class="gallerytext"> <p><a href="/wiki/File:Bad.jpg" title="File:Bad.jpg">Bad.jpg</a><br /> 8 KB<br /> </p> </div> </div></li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> <div class="thumb" style="width: 100px;"><div style="margin:71px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div> <div class="gallerytext"> <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> 8 KB<br /> </p> </div> </div></li> </ul> !!end !!test mode=gallery (simple showfilesize, no image) !!input <DynamicPageList> category=DPLtest mode=gallery galleryshowfilesize=yes galleryshowfilename=no </DynamicPageList> !!result <ul class="gallery"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> <div style="height: 150px;">Yet another DPL test page!</div> <div class="gallerytext"> <p>File missing<br /> </p> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> <div style="height: 150px;">DPLTest2</div> <div class="gallerytext"> <p>File missing<br /> </p> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> <div style="height: 150px;">DPLTest1</div> <div class="gallerytext"> <p>File missing<br /> </p> </div> </div></li> </ul> !!end # This is a crappy test since creation and categoryadd are the # same for parser tests. !!test ordermethod=created (by article id) !!input <DynamicPageList> category=DPLtest ordermethod=created </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end # This one is BROKEN! I'm not sure why. # Seems to order it in opposite order. Maybe timestamp isn't # fine grained enough or something given how parsertests creates them. #!!test #ordermethod=lastedit (by page_touched) #!!input #<DynamicPageList> #category=DPLtest #ordermethod=lastedit #</DynamicPageList> #!!result #<ul> #<li><a href="/wiki/Yet_another_DPL_test_page!">Yet another DPL test page!</a></li> # <li><a href="/wiki/Talk:DPLTest2">Talk:DPLTest2</a></li> # <li><a href="/wiki/DPLTest1">DPLTest1</a></li></ul> # #!!end !!test ordermethod=length !!input <DynamicPageList> category=DPLtest ordermethod=length </DynamicPageList> !!result <ul> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end !!test ordermethod=sortkey !!input <DynamicPageList> category=DPLtest ordermethod=sortkey </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end #check to make sure the alias works. !!test ordermethod=categorysortkey !!input <DynamicPageList> category=DPLtest ordermethod=categorysortkey order=ascending </DynamicPageList> !!result <ul> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li></ul> !!end # Check {{PAGENAME}} in category clause (dates variables are somewhat more common, but # this is easier to check. # # using {{PAGENAME:DPLtest}} because dpl uses a weird (and probably wrong way) of # expanding {{PAGENAME}} and friends, which doesn't work with parsertests and # the title= option. !!test Magic word in category clause !!input <DynamicPageList> category={{PAGENAME:DPLtest}} </DynamicPageList> !!result <ul> <li><a href="/wiki/Yet_another_DPL_test_page!" title="Yet another DPL test page!">Yet another DPL test page!</a></li> <li><a href="/wiki/Talk:DPLTest2" title="Talk:DPLTest2">Talk:DPLTest2</a></li> <li><a href="/wiki/DPLTest1" title="DPLTest1">DPLTest1</a></li></ul> !!end