[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Fixes ProofreadPage parser tests

2016-12-29 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
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(-)

Approvals:
  jenkins-bot: Verified
  Tpt: Looks good to me, approved
  Phe: Looks good to me, but someone else must approve



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= 
 |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 @@
 ૧ 
૨
 
 !! end
+
+!! test
+pages: with file: Simple transclusion
+!! options
+djvu
+!! wikitext
+
+!! html
+
+2Page 43Page:LoremIpsum.djvu/5
+
+
+
+!! end
+
+!! test
+pages: with file: Simple transclusion without from
+!! options
+djvu
+!! wikitext
+
+!! html
+
+iPage 1II
+Page 2
+
+
+
+!! end
+
+!! test
+pages: with file: Invalid from
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Invalid to
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Invalid range
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Invalid include
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Simple transclusion without to
+!! options
+djvu
+!! wikitext
+
+!! html
+
+2Page 43Page:LoremIpsum.djvu/5
+
+
+
+!! end
+
+!! test
+pages: with file: step
+!! options
+djvu
+!! wikitext
+
+!! html
+
+1Page 33Page:LoremIpsum.djvu/5
+
+
+
+!! end
+
+!! test
+pages: with file: Invalid step
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Numeric value expected
+
+!! end
+
+!! test
+pages: with file: exclude
+!! options
+djvu
+!! wikitext
+
+!! html
+
+1Page 33Page:LoremIpsum.djvu/5
+
+
+
+!! end
+
+!! test
+pages: with file: include
+!! options
+djvu
+!! wikitext
+
+!! html
+
+iPage 1II
+Page 22Page 4
+
+
+
+!! end
+
+!! test
+pages: with file: invalid include (1)
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: invalid include (2)
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Header
+!! options
+djvu
+title="Test/Chapter 2"
+!! wikitext
+
+!! html
+
+Lorem Ipsum -- Author:Me
+II -- 1
+Test/Chapter 1 -- Chapter 3II
+Page 21Page 3
+
+
+
+!! 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..000
--- a/tests/parser/proofreadpage_pages_pagelist_ignored.txt
+++ /dev/null
@@ -1,180 +0,0 @@
-!! test
-pages: with file: Simple 

[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Fixes ProofreadPage parser tests

2016-12-24 Thread Tpt (Code Review)
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= 
 |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 @@
 ૧ 
૨
 
 !! end
+
+!! test
+pages: with file: Simple transclusion
+!! options
+djvu
+!! wikitext
+
+!! html
+
+2Page 43Page:LoremIpsum.djvu/5
+
+
+
+!! end
+
+!! test
+pages: with file: Simple transclusion without from
+!! options
+djvu
+!! wikitext
+
+!! html
+
+iPage 1II
+Page 2
+
+
+
+!! end
+
+!! test
+pages: with file: Invalid from
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Invalid to
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Invalid range
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Invalid include
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Simple transclusion without to
+!! options
+djvu
+!! wikitext
+
+!! html
+
+2Page 43Page:LoremIpsum.djvu/5
+
+
+
+!! end
+
+!! test
+pages: with file: step
+!! options
+djvu
+!! wikitext
+
+!! html
+
+1Page 33Page:LoremIpsum.djvu/5
+
+
+
+!! end
+
+!! test
+pages: with file: Invalid step
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Numeric value expected
+
+!! end
+
+!! test
+pages: with file: exclude
+!! options
+djvu
+!! wikitext
+
+!! html
+
+1Page 33Page:LoremIpsum.djvu/5
+
+
+
+!! end
+
+!! test
+pages: with file: include
+!! options
+djvu
+!! wikitext
+
+!! html
+
+iPage 1II
+Page 22Page 4
+
+
+
+!! end
+
+!! test
+pages: with file: invalid include (1)
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: invalid include (2)
+!! options
+djvu
+!! wikitext
+
+!! html
+Error: Invalid interval
+
+!! end
+
+!! test
+pages: with file: Header
+!! options
+djvu
+title="Test/Chapter 2"
+!! wikitext
+
+!! html
+
+Lorem Ipsum -- Author:Me
+II -- 1
+Test/Chapter 1 -- Chapter 3II
+Page 21Page 3
+
+
+
+!! 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..000
--- a/tests/parser/proofreadpage_pages_pagelist_ignored.txt
+++ /dev/null
@@ -1,180 +0,0 @@
-!! test
-pages: with file: Simple transclusion
-!! options
-djvu
-!!