Tpt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/329059 )

Change subject: Fixes ProofreadPage parser tests
......................................................................

Fixes ProofreadPage parser tests

No idea of why the previous code behaved wrongly. I need to learn more about 
PHP objects behaviours.

Bug: T145724
Change-Id: I9f197aa0b8ff4a97258826cce621887f24c21e1d
---
M includes/Context.php
M tests/parser/proofreadpage_pages_pagelist.txt
D tests/parser/proofreadpage_pages_pagelist_ignored.txt
3 files changed, 194 insertions(+), 190 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage 
refs/changes/59/329059/1

diff --git a/includes/Context.php b/includes/Context.php
index 20bb074..d52141d 100644
--- a/includes/Context.php
+++ b/includes/Context.php
@@ -31,11 +31,6 @@
        private $fileProvider;
 
        /**
-        * @var PaginationFactory
-        */
-       private $paginationFactory;
-
-       /**
         * @param int $pageNamespaceId
         * @param int $indexNamespaceId
         * @param FileProvider $fileProvider
@@ -44,7 +39,6 @@
                $this->pageNamespaceId = $pageNamespaceId;
                $this->indexNamespaceId = $indexNamespaceId;
                $this->fileProvider = $fileProvider;
-               $this->paginationFactory = new PaginationFactory( $this );
        }
 
        /**
@@ -72,7 +66,7 @@
         * @return PaginationFactory
         */
        public function getPaginationFactory() {
-               return $this->paginationFactory;
+               return new PaginationFactory( $this );
        }
 
        /**
diff --git a/tests/parser/proofreadpage_pages_pagelist.txt 
b/tests/parser/proofreadpage_pages_pagelist.txt
index 0a008fc..6c2cbf3 100644
--- a/tests/parser/proofreadpage_pages_pagelist.txt
+++ b/tests/parser/proofreadpage_pages_pagelist.txt
@@ -4,6 +4,15 @@
 !! endhooks
 
 !!article
+MediaWiki:Proofreadpage index template
+!!text
+Title: {{{Title}}}
+Author: {{{Author}}}
+Pages: {{{Pages}}}
+TOC: {{{TOC}}}
+!!endarticle
+
+!!article
 MediaWiki:Proofreadpage pagenum template
 !!text
 [[{{{page}}}|{{{num}}}]]
@@ -20,7 +29,7 @@
 !!article
 Index:Test
 !!text
-{{
+{{:MediaWiki:Proofreadpage_index_template
 |Title=Title
 |Pages=[[Page:Test 1.jpg|TOC]] [[Page:Test 2.tiff|1]] [[Page:Test 3.png|2]]
 |Author=[[Author:Me]]
@@ -33,7 +42,7 @@
 !!article
 Index:LoremIpsum.djvu
 !!text
-{{
+{{:MediaWiki:Proofreadpage_index_template
 |Title=Lorem Ipsum
 |Pages=<pagelist 1to1=roman 2to2=highroman to=2/> <pagelist from=3 3=1 5=empty 
/>
 |Author=[[Author:Me]]
@@ -238,7 +247,7 @@
 !!article
 Index:TestSection
 !!text
-{{
+{{:MediaWiki:Proofreadpage_index_template
 |Pages=[[Page:TestSection 1|TOC]] [[Page:TestSection 2|1]] [[Page:TestSection 
3|2]]
 }}
 !!endarticle
@@ -486,3 +495,184 @@
 <p><a href="/wiki/Page:LoremIpsum.djvu/1" title="Page:LoremIpsum.djvu/1">૧</a> 
<a href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">૨</a>
 </p>
 !! end
+
+!! test
+pages: with file: Simple transclusion
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" from="4" to="5" />
+!! html
+<div>
+<p><span><a href="/wiki/Page:LoremIpsum.djvu/4" 
title="Page:LoremIpsum.djvu/4">2</a></span>Page 4&#32;<span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not 
exist)">Page:LoremIpsum.djvu/5</a>&#32;
+</p>
+</div>
+
+!! end
+
+!! test
+pages: with file: Simple transclusion without from
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" to="2" />
+!! html
+<div>
+<p><span><a href="/wiki/Page:LoremIpsum.djvu/1" 
title="Page:LoremIpsum.djvu/1">i</a></span>Page 1&#32;<span><a 
href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">II</a></span>
+</p><p>Page 2&#32;
+</p>
+</div>
+
+!! end
+
+!! test
+pages: with file: Invalid from
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" from="-1" />
+!! html
+<p><strong class="error">Error: Invalid interval</strong>
+</p>
+!! end
+
+!! test
+pages: with file: Invalid to
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" to="42" />
+!! html
+<p><strong class="error">Error: Invalid interval</strong>
+</p>
+!! end
+
+!! test
+pages: with file: Invalid range
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" from="4" to="3" />
+!! html
+<p><strong class="error">Error: Invalid interval</strong>
+</p>
+!! end
+
+!! test
+pages: with file: Invalid include
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" include="42" />
+!! html
+<p><strong class="error">Error: Invalid interval</strong>
+</p>
+!! end
+
+!! test
+pages: with file: Simple transclusion without to
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" from="4" />
+!! html
+<div>
+<p><span><a href="/wiki/Page:LoremIpsum.djvu/4" 
title="Page:LoremIpsum.djvu/4">2</a></span>Page 4&#32;<span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not 
exist)">Page:LoremIpsum.djvu/5</a>&#32;
+</p>
+</div>
+
+!! end
+
+!! test
+pages: with file: step
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" from="3" step=2 />
+!! html
+<div>
+<p><span><a href="/wiki/Page:LoremIpsum.djvu/3" 
title="Page:LoremIpsum.djvu/3">1</a></span>Page 3&#32;<span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not 
exist)">Page:LoremIpsum.djvu/5</a>&#32;
+</p>
+</div>
+
+!! end
+
+!! test
+pages: with file: Invalid step
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" from="4" step="-1" />
+!! html
+<p><strong class="error">Error: Numeric value expected</strong>
+</p>
+!! end
+
+!! test
+pages: with file: exclude
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" from="3" exclude=4 />
+!! html
+<div>
+<p><span><a href="/wiki/Page:LoremIpsum.djvu/3" 
title="Page:LoremIpsum.djvu/3">1</a></span>Page 3&#32;<span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not 
exist)">Page:LoremIpsum.djvu/5</a>&#32;
+</p>
+</div>
+
+!! end
+
+!! test
+pages: with file: include
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" include="1-2,4" />
+!! html
+<div>
+<p><span><a href="/wiki/Page:LoremIpsum.djvu/1" 
title="Page:LoremIpsum.djvu/1">i</a></span>Page 1&#32;<span><a 
href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">II</a></span>
+</p><p>Page 2&#32;<span><a href="/wiki/Page:LoremIpsum.djvu/4" 
title="Page:LoremIpsum.djvu/4">2</a></span>Page 4&#32;
+</p>
+</div>
+
+!! end
+
+!! test
+pages: with file: invalid include (1)
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" include="2-1,4" />
+!! html
+<p><strong class="error">Error: Invalid interval</strong>
+</p>
+!! end
+
+!! test
+pages: with file: invalid include (2)
+!! options
+djvu
+!! wikitext
+<pages index="LoremIpsum.djvu" include="." />
+!! html
+<p><strong class="error">Error: Invalid interval</strong>
+</p>
+!! end
+
+!! test
+pages: with file: Header
+!! options
+djvu
+title="Test/Chapter 2"
+!! wikitext
+<pages index="LoremIpsum.djvu" from="2" to="3" header=1 />
+!! html
+<div>
+<p>Lorem Ipsum -- <a href="/wiki/Author:Me" title="Author:Me">Author:Me</a>
+II -- 1
+<a href="/wiki/Test/Chapter_1" title="Test/Chapter 1">Test/Chapter 1</a> -- <a 
href="/wiki/Test/Chapter_3" title="Test/Chapter 3">Chapter 3</a><span><a 
href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">II</a></span>
+</p><p>Page 2&#32;<span><a href="/wiki/Page:LoremIpsum.djvu/3" 
title="Page:LoremIpsum.djvu/3">1</a></span>Page 3&#32;
+</p>
+</div>
+
+!! end
diff --git a/tests/parser/proofreadpage_pages_pagelist_ignored.txt 
b/tests/parser/proofreadpage_pages_pagelist_ignored.txt
deleted file mode 100644
index f9c1b0c..0000000
--- a/tests/parser/proofreadpage_pages_pagelist_ignored.txt
+++ /dev/null
@@ -1,180 +0,0 @@
-!! test
-pages: with file: Simple transclusion
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" from="4" to="5" />
-!! html
-<div>
-<p><span><a href="/wiki/Page:LoremIpsum.djvu/4" 
title="Page:LoremIpsum.djvu/4">2</a></span>Page 4&#32;<span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not 
exist)">Page:LoremIpsum.djvu/5</a>&#32;
-</p>
-</div>
-
-!! end
-
-!! test
-pages: with file: Simple transclusion without from
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" to="2" />
-!! html
-<div>
-<p><span><a href="/wiki/Page:LoremIpsum.djvu/1" 
title="Page:LoremIpsum.djvu/1">i</a></span>Page 1&#32;<span><a 
href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">II</a></span>
-</p><p>Page 2&#32;
-</p>
-</div>
-
-!! end
-
-!! test
-pages: with file: Invalid from
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" from="-1" />
-!! html
-<p><strong class="error">Error: Invalid interval</strong>
-</p>
-!! end
-
-!! test
-pages: with file: Invalid to
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" to="42" />
-!! html
-<p><strong class="error">Error: Invalid interval</strong>
-</p>
-!! end
-
-!! test
-pages: with file: Invalid range
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" from="4" to="3" />
-!! html
-<p><strong class="error">Error: Invalid interval</strong>
-</p>
-!! end
-
-!! test
-pages: with file: Invalid include
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" include="42" />
-!! html
-<p><strong class="error">Error: Invalid interval</strong>
-</p>
-!! end
-
-!! test
-pages: with file: Simple transclusion without to
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" from="4" />
-!! html
-<div>
-<p><span><a href="/wiki/Page:LoremIpsum.djvu/4" 
title="Page:LoremIpsum.djvu/4">2</a></span>Page 4&#32;<span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not 
exist)">Page:LoremIpsum.djvu/5</a>&#32;
-</p>
-</div>
-
-!! end
-
-!! test
-pages: with file: step
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" from="3" step=2 />
-!! html
-<div>
-<p><span><a href="/wiki/Page:LoremIpsum.djvu/3" 
title="Page:LoremIpsum.djvu/3">1</a></span>Page 3&#32;<span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not 
exist)">Page:LoremIpsum.djvu/5</a>&#32;
-</p>
-</div>
-
-!! end
-
-!! test
-pages: with file: Invalid step
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" from="4" step="-1" />
-!! html
-<p><strong class="error">Error: Numeric value expected</strong>
-</p>
-!! end
-
-!! test
-pages: with file: exclude
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" from="3" exclude=4 />
-!! html
-<div>
-<p><span><a href="/wiki/Page:LoremIpsum.djvu/3" 
title="Page:LoremIpsum.djvu/3">1</a></span>Page 3&#32;<span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a 
href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" 
class="new" title="Page:LoremIpsum.djvu/5 (page does not 
exist)">Page:LoremIpsum.djvu/5</a>&#32;
-</p>
-</div>
-
-!! end
-
-!! test
-pages: with file: include
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" include="1-2,4" />
-!! html
-<div>
-<p><span><a href="/wiki/Page:LoremIpsum.djvu/1" 
title="Page:LoremIpsum.djvu/1">i</a></span>Page 1&#32;<span><a 
href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">II</a></span>
-</p><p>Page 2&#32;<span><a href="/wiki/Page:LoremIpsum.djvu/4" 
title="Page:LoremIpsum.djvu/4">2</a></span>Page 4&#32;
-</p>
-</div>
-
-!! end
-
-!! test
-pages: with file: invalid include (1)
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" include="2-1,4" />
-!! html
-<p><strong class="error">Error: Invalid interval</strong>
-</p>
-!! end
-
-!! test
-pages: with file: invalid include (2)
-!! options
-djvu
-!! wikitext
-<pages index="LoremIpsum.djvu" include="." />
-!! html
-<p><strong class="error">Error: Invalid interval</strong>
-</p>
-!! end
-
-!! test
-pages: with file: Header
-!! options
-djvu
-title="Test/Chapter 2"
-!! wikitext
-<pages index="LoremIpsum.djvu" from="2" to="3" header=1 />
-!! html
-<div>
-<p>Lorem Ipsum -- <a href="/wiki/Author:Me" title="Author:Me">Author:Me</a>
-II -- 1
-<a href="/wiki/Test/Chapter_1" title="Test/Chapter 1">Test/Chapter 1</a> -- <a 
href="/wiki/Test/Chapter_3" title="Test/Chapter 3">Chapter 3</a><span><a 
href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">II</a></span>
-</p><p>Page 2&#32;<span><a href="/wiki/Page:LoremIpsum.djvu/3" 
title="Page:LoremIpsum.djvu/3">1</a></span>Page 3&#32;
-</p>
-</div>
-
-!! end

-- 
To view, visit https://gerrit.wikimedia.org/r/329059
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f197aa0b8ff4a97258826cce621887f24c21e1d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Tpt <thoma...@hotmail.fr>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to