Skip to content
Permalink
Browse files

Prevent failure in end-to-end test from affecting others

  • Loading branch information...
muglug committed Jun 26, 2019
1 parent 9042676 commit 0da801fee114e97fc2d07eeee4b6b282ccd591d8
Showing with 4 additions and 10 deletions.
  1. +4 −10 tests/EndToEnd/PsalmEndToEndTest.php
@@ -21,9 +21,6 @@ class PsalmEndToEndTest extends TestCase
/** @var string */
private $psalter = __DIR__ . '/../../psalter';
/** @var string */
private static $previousWorkingDir;
/** @var string */
private static $tmpDir;
@@ -37,19 +34,16 @@ public static function setUpBeforeClass(): void
if (! is_string($getcwd)) {
throw new \Exception('Couldn\'t get working directory');
}
self::$previousWorkingDir = $getcwd;
chdir(self::$tmpDir);
mkdir('src');
mkdir(self::$tmpDir . '/src');
copy(__DIR__ . '/../fixtures/DummyProjectWithErrors/composer.json', 'composer.json');
copy(__DIR__ . '/../fixtures/DummyProjectWithErrors/composer.json', self::$tmpDir . '/composer.json');
(new Process(['composer', 'install']))->mustRun();
(new Process(['composer', 'install'], self::$tmpDir))->mustRun();
}
public static function tearDownAfterClass(): void
{
chdir(self::$previousWorkingDir);
self::recursiveRemoveDirectory(self::$tmpDir);
parent::tearDownAfterClass();
}
@@ -112,7 +106,7 @@ public function testPsalm(): void
*/
private function runPsalm(array $args, bool $shouldFail = false): array
{
$process = new Process(array_merge([$this->psalm], $args));
$process = new Process(array_merge([$this->psalm], $args), self::$tmpDir);
if (! $shouldFail) {
$process->mustRun();

0 comments on commit 0da801f

Please sign in to comment.
You can’t perform that action at this time.