Skip to content

Commit

Permalink
[5.x] Fix test state issues around sites cache (#11455)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Varga <[email protected]>
  • Loading branch information
jesseleite and jasonvarga authored Feb 14, 2025
1 parent 97a8268 commit 8439c2c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
use Illuminate\Testing\TestResponse;
use PHPUnit\Framework\Assert;
use Statamic\Facades\Config;
use Statamic\Facades\File;
use Statamic\Facades\Site;
use Statamic\Facades\YAML;
use Statamic\Http\Middleware\CP\AuthenticateSession;

abstract class TestCase extends \Orchestra\Testbench\TestCase
Expand Down Expand Up @@ -44,15 +42,6 @@ protected function setUp(): void
}

$this->addGqlMacros();

// We changed the default sites setup but the tests assume defaults like the following.
File::put(resource_path('sites.yaml'), YAML::dump([
'en' => [
'name' => 'English',
'url' => 'http://localhost/',
'locale' => 'en_US',
],
]));
}

public function tearDown(): void
Expand Down Expand Up @@ -133,6 +122,15 @@ protected function getEnvironmentSetUp($app)
$viewPaths[] = __DIR__.'/__fixtures__/views/';

$app['config']->set('view.paths', $viewPaths);

// We changed the default sites setup but the tests assume defaults like the following.
// We write the file early so its ready the first time Site facade is used.
$app['files']->put(resource_path('sites.yaml'), <<<'YAML'
en:
name: English
url: http://localhost/
locale: en_US
YAML);
}

protected function setSites($sites)
Expand Down

0 comments on commit 8439c2c

Please sign in to comment.