jenkins-bot has submitted this change and it was merged.
Change subject: Fixes fail in PHP unit tests runned by CI
..
Fixes fail in PHP unit tests runned by CI
Change-Id: Ic606344a21ddd6fdcd74cee11c0487a89b88ddbd
---
M tests/includes/FileProviderTest.php
1 file changed, 46 insertions(+), 37 deletions(-)
Approvals:
Tpt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/includes/FileProviderTest.php
b/tests/includes/FileProviderTest.php
index f298871..2be187b 100644
--- a/tests/includes/FileProviderTest.php
+++ b/tests/includes/FileProviderTest.php
@@ -14,20 +14,6 @@
*/
class FileProviderTest extends ProofreadPageTestCase {
- /**
-* @var FileProvider
-*/
- protected $fileProvider;
-
- protected function setUp() {
- parent::setUp();
-
- $this->fileProvider = new FileProviderMock( [
- $this->getFileFromName( 'LoremIpsum.djvu' ),
- $this->getFileFromName( 'Test.jpg' )
- ] );
- }
-
private function getFileFromName( $fileName ) {
return
$this->getContext()->getFileProvider()->getFileFromTitle( Title::makeTitle(
NS_MEDIA, $fileName ) );
}
@@ -35,18 +21,21 @@
/**
* @dataProvider indexFileProvider
*/
- public function testGetForIndexPage( ProofreadIndexPage $index, File
$file ) {
- $this->assertEquals(
- $file,
- $this->fileProvider->getForIndexPage( $index )
- );
+ public function testGetForIndexPage( ProofreadIndexPage $index, File
$file, FileProvider $fileProvider ) {
+ $this->assertEquals( $file, $fileProvider->getForIndexPage(
$index ) );
}
public function indexFileProvider() {
+ $fileProvider = new FileProviderMock( [
+ $this->getFileFromName( 'LoremIpsum.djvu' ),
+ $this->getFileFromName( 'Test.jpg' )
+ ] );
+
return [
[
ProofreadIndexPage::newFromTitle(
Title::makeTitle( 252, 'LoremIpsum.djvu' ) ),
- $this->getFileFromName( 'LoremIpsum.djvu' )
+ $this->getFileFromName( 'LoremIpsum.djvu' ),
+ $fileProvider
],
];
}
@@ -55,17 +44,24 @@
* @expectedException \ProofreadPage\FileNotFoundException
* @dataProvider indexFileNotFoundProvider
*/
- public function testGetForIndexPageWithFileNotFound( ProofreadIndexPage
$index ) {
- $this->fileProvider->getForIndexPage( $index );
+ public function testGetForIndexPageWithFileNotFound( ProofreadIndexPage
$index, FileProvider $fileProvider ) {
+ $fileProvider->getForIndexPage( $index );
}
public function indexFileNotFoundProvider() {
+ $fileProvider = new FileProviderMock( [
+ $this->getFileFromName( 'LoremIpsum.djvu' ),
+ $this->getFileFromName( 'Test.jpg' )
+ ] );
+
return [
[
- ProofreadIndexPage::newFromTitle(
Title::makeTitle( 252, 'LoremIpsum2.djvu' ) )
+ ProofreadIndexPage::newFromTitle(
Title::makeTitle( 252, 'LoremIpsum2.djvu' ) ),
+ $fileProvider
],
[
- ProofreadIndexPage::newFromTitle(
Title::makeTitle( 252, 'Test' ) )
+ ProofreadIndexPage::newFromTitle(
Title::makeTitle( 252, 'Test' ) ),
+ $fileProvider
],
];
}
@@ -73,30 +69,36 @@
/**
* @dataProvider pageFileProvider
*/
- public function testGetForPagePage( ProofreadPagePage $page, File $file
) {
- $this->assertEquals(
- $file,
- $this->fileProvider->getForPagePage( $page )
- );
+ public function testGetForPagePage( ProofreadPagePage $page, File
$file, FileProvider $fileProvider ) {
+ $this->assertEquals( $file, $fileProvider->getForPagePage(
$page ) );
}
public function pageFileProvider() {
+ $fileProvider = new FileProviderMock( [
+ $this->getFileFromName( 'LoremIpsum.djvu' ),
+ $this->getFileFromName( 'Test.jpg' )
+ ] );
+
return [
[
ProofreadPagePage::newFromTitle(
Title::makeTitle( 250, 'LoremIpsum.djvu/4' ) ),
- $this->getFileFromName( 'LoremIp