diff options
Diffstat (limited to 'SemanticMediaWiki/tests/phpunit/includes/MediaWiki/Hooks/FileUploadTest.php')
-rw-r--r-- | SemanticMediaWiki/tests/phpunit/includes/MediaWiki/Hooks/FileUploadTest.php | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/SemanticMediaWiki/tests/phpunit/includes/MediaWiki/Hooks/FileUploadTest.php b/SemanticMediaWiki/tests/phpunit/includes/MediaWiki/Hooks/FileUploadTest.php deleted file mode 100644 index 05c53ab9..00000000 --- a/SemanticMediaWiki/tests/phpunit/includes/MediaWiki/Hooks/FileUploadTest.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -namespace SMW\Tests\MediaWiki\Hooks; - -use SMW\MediaWiki\Hooks\FileUpload; -use SMW\Application; -use SMW\Settings; - -use ParserOutput; -use Title; - -/** - * @covers \SMW\MediaWiki\Hooks\FileUpload - * - * @ingroup Test - * - * @group SMW - * @group SMWExtension - * - * @license GNU GPL v2+ - * @since 1.9 - * - * @author mwjames - */ -class FileUploadTest extends \PHPUnit_Framework_TestCase { - - private $application; - - protected function setUp() { - parent::setUp(); - - $this->application = Application::getInstance(); - - $settings = Settings::newFromArray( array( - 'smwgPageSpecialProperties' => array( '_MEDIA', '_MIME' ), - 'smwgCacheType' => 'hash', - 'smwgEnableUpdateJobs' => false - ) ); - - $this->application->registerObject( 'Settings', $settings ); - } - - protected function tearDown() { - $this->application->clear(); - - parent::tearDown(); - } - - public function testCanConstruct() { - - $file = $this->getMockBuilder( 'File' ) - ->disableOriginalConstructor() - ->getMock(); - - $this->assertInstanceOf( - '\SMW\MediaWiki\Hooks\FileUpload', - new FileUpload( $file ) - ); - } - - public function testPerformUpdate() { - - $store = $this->getMockBuilder( 'SMW\Store' ) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - - $this->application->registerObject( 'Store', $store ); - - $file = $this->getMockBuilder( 'File' ) - ->disableOriginalConstructor() - ->getMock(); - - $file->expects( $this->atLeastOnce() ) - ->method( 'getTitle' ) - ->will( $this->returnValue( Title::newFromText( __METHOD__ ) ) ); - - $contentParser = $this->getMockBuilder( '\SMW\ContentParser' ) - ->disableOriginalConstructor() - ->getMock(); - - $contentParser->expects( $this->atLeastOnce() ) - ->method( 'getOutput' ) - ->will( $this->returnValue( new ParserOutput() ) ); - - $this->application->registerObject( 'ContentParser', $contentParser ); - - $instance = new FileUpload( $file, false ); - $this->assertTrue( $instance->process() ); - } - -} |