Skip to content

Commit 5b35a7f

Browse files
author
Frederik Ring
committed
test: seed wikis only when needed for test
1 parent 94ada90 commit 5b35a7f

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

tests/Jobs/PlatformStatsSummaryJobTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,18 @@ protected function setUp(): void {
2929
for($n = 0; $n < $this->numWikis; $n++ ) {
3030
DB::connection('mysql')->getPdo()->exec("DROP DATABASE IF EXISTS {$this->db_name}{$n};");
3131
}
32-
$this->seedWikis();
33-
$this->manager = $this->app->make('db');
32+
$this->wikis = [];
3433
}
3534

3635
protected function tearDown(): void {
37-
foreach($this->wikis as $wiki) {
36+
foreach ($this->wikis as $wiki) {
3837
$wiki['wiki']->wikiDb()->forceDelete();
3938
$wiki['wiki']->forceDelete();
4039
}
4140
parent::tearDown();
4241
}
4342

4443
private function seedWikis() {
45-
$this->wikis = [];
4644
$manager = $this->app->make('db');
4745
for($n = 0; $n < $this->numWikis; $n++ ) {
4846

@@ -65,6 +63,7 @@ private function seedWikis() {
6563
}
6664
public function testQueryGetsStats()
6765
{
66+
$this->seedWikis();
6867
$manager = $this->app->make('db');
6968

7069
$mockJob = $this->createMock(Job::class);
@@ -89,7 +88,6 @@ public function testGroupings()
8988
Wiki::factory()->create( [ 'deleted_at' => null, 'domain' => 'wiki2.com' ] ),
9089
Wiki::factory()->create( [ 'deleted_at' => Carbon::now()->subDays(90)->timestamp, 'domain' => 'wiki3.com' ] ),
9190
Wiki::factory()->create( [ 'deleted_at' => null, 'domain' => 'wiki4.com' ] )
92-
9391
];
9492

9593
foreach($testWikis as $wiki) {

0 commit comments

Comments
 (0)