Use MediaWikiTestCase methods for tempdir in unit tests
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 11 Feb 2015 01:42:33 +0000 (01:42 +0000)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 11 Feb 2015 03:49:02 +0000 (03:49 +0000)
commit48d715148bad09faf56b5f854fde0029ac7f5dac
treec591d68365b2e6561e751aa8504da62df16a5f7e
parent9bd8dc6e2dedebf4a6b3cc045ffec154c296cf25
Use MediaWikiTestCase methods for tempdir in unit tests

* Use MediaWikiTestCase::getNewTempFile and getNewTempDirectory
  instead of wfTempDir().

  The upload api tests wrote a tempnam() file directly (where
  wfTempDir() is typically shared with other systems and concurrent
  runs). Use MediaWikiTestCase::getNewTempFile and
  getNewTempDirectory instead.

  This also ensures its removal by the teardown handler without
  needing manual unlink() calls. And it doesn't rely on the test
  passing. (Many unlink calls where at the bottom of tests,
  which wouldn't be reached in case of failure).

* For the upload test, the presistent storing of
  'Oberaargletscher_from_Oberaar.jpg' (downloaded from Commons)
  was removed. Note that this didn't work for Jenkins builds anyway
  as Jenkins builds set $wgTmpDirectory to a unique directory
  in tmpfs associated with an individual build.

* For filebackend tests, moved directory creation from the dataProvider
  to the main test.

  Implemented addTmpFiles() to allow subclasses to register
  additional files (created by other means) to be cleaned up also.

  Removed unused $tmpName and $toPath parameters in data
  provider for FileBackendTest::testStore. And fixed weird double
  $op2 variable name to be called $op3.

* Skipped parserTest.inc, MockFileBackend.php, and
  UploadFromUrlTestSuite.php as those don't use MediaWikiTestCase.

Change-Id: Ic7feb06ef0c1006eb99485470a1a59419f972545
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/GlobalFunctions/GlobalTest.php
tests/phpunit/includes/api/ApiTestCaseUpload.php
tests/phpunit/includes/api/ApiUploadTest.php
tests/phpunit/includes/filebackend/FileBackendTest.php
tests/phpunit/includes/parser/NewParserTest.php
tests/phpunit/includes/upload/UploadBaseTest.php