- mkdir( __DIR__ . '/../data/gitrepo' );
- mkdir( __DIR__ . '/../data/gitrepo/1' );
- mkdir( __DIR__ . '/../data/gitrepo/2' );
- mkdir( __DIR__ . '/../data/gitrepo/3' );
- mkdir( __DIR__ . '/../data/gitrepo/1/.git' );
- mkdir( __DIR__ . '/../data/gitrepo/1/.git/refs' );
- mkdir( __DIR__ . '/../data/gitrepo/1/.git/refs/heads' );
- file_put_contents( __DIR__ . '/../data/gitrepo/1/.git/HEAD',
+ self::$tempDir = wfTempDir() . '/mw-phpunit-' . wfRandomString( 8 );
+ if ( !mkdir( self::$tempDir ) ) {
+ self::$tempDir = null;
+ throw new Exception( 'Unable to create temporary directory' );
+ }
+ mkdir( self::$tempDir . '/gitrepo' );
+ mkdir( self::$tempDir . '/gitrepo/1' );
+ mkdir( self::$tempDir . '/gitrepo/2' );
+ mkdir( self::$tempDir . '/gitrepo/3' );
+ mkdir( self::$tempDir . '/gitrepo/1/.git' );
+ mkdir( self::$tempDir . '/gitrepo/1/.git/refs' );
+ mkdir( self::$tempDir . '/gitrepo/1/.git/refs/heads' );
+ file_put_contents( self::$tempDir . '/gitrepo/1/.git/HEAD',