Index: trunk/phase3/tests/phpunit/includes/media/ExifRotationTest.php |
— | — | @@ -5,11 +5,17 @@ |
6 | 6 | */ |
7 | 7 | class ExifRotationTest extends MediaWikiTestCase { |
8 | 8 | |
| 9 | + /** track directories creations. Content will be deleted. */ |
| 10 | + private $createdDirs = array(); |
| 11 | + |
9 | 12 | function setUp() { |
10 | 13 | parent::setUp(); |
11 | 14 | $this->handler = new BitmapHandler(); |
12 | 15 | $filePath = dirname( __FILE__ ) . '/../../data/media'; |
| 16 | + |
13 | 17 | $tmpDir = wfTempDir() . '/exif-test-' . time() . '-' . mt_rand(); |
| 18 | + $this->createdDirs[] = $tmpDir; |
| 19 | + |
14 | 20 | $this->repo = new FSRepo( array( |
15 | 21 | 'name' => 'temp', |
16 | 22 | 'url' => 'http://localhost/thumbtest', |
— | — | @@ -30,12 +36,25 @@ |
31 | 37 | $this->oldAuto = $wgEnableAutoRotation; |
32 | 38 | $wgEnableAutoRotation = true; |
33 | 39 | } |
| 40 | + |
34 | 41 | public function tearDown() { |
35 | 42 | global $wgShowEXIF, $wgEnableAutoRotation; |
36 | 43 | $wgShowEXIF = $this->show; |
37 | 44 | $wgEnableAutoRotation = $this->oldAuto; |
| 45 | + |
| 46 | + $this->tearDownFiles(); |
38 | 47 | } |
39 | 48 | |
| 49 | + private function tearDownFiles() { |
| 50 | + foreach( $this->createdDirs as $dir ) { |
| 51 | + wfRecursiveRemoveDir( $dir ); |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + function __destruct() { |
| 56 | + $this->tearDownFiles(); |
| 57 | + } |
| 58 | + |
40 | 59 | /** |
41 | 60 | * |
42 | 61 | * @dataProvider providerFiles |