Skip to content

Commit

Permalink
[11.x] Fix LazilyRefreshDatabase when using Laravel BrowserKit Testing (
Browse files Browse the repository at this point in the history
#51538)

* Check mockConsoleOutput property exists

* Update src/Illuminate/Foundation/Testing/LazilyRefreshDatabase.php

Co-authored-by: AJ <[email protected]>

* Update src/Illuminate/Foundation/Testing/LazilyRefreshDatabase.php

Co-authored-by: AJ <[email protected]>

* Update LazilyRefreshDatabase.php

---------

Co-authored-by: AJ <[email protected]>
Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
3 people authored May 22, 2024
1 parent 8367367 commit b7a95f7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Illuminate/Foundation/Testing/LazilyRefreshDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ public function refreshDatabase()

RefreshDatabaseState::$lazilyRefreshed = true;

$shouldMockOutput = $this->mockConsoleOutput;

$this->mockConsoleOutput = false;
if (property_exists($this, 'mockConsoleOutput')) {
$shouldMockOutput = $this->mockConsoleOutput;

$this->mockConsoleOutput = false;
}

$this->baseRefreshDatabase();

$this->mockConsoleOutput = $shouldMockOutput;
if (property_exists($this, 'mockConsoleOutput')) {
$this->mockConsoleOutput = $shouldMockOutput;
}
};

$database->beforeStartingTransaction($callback);
Expand Down

0 comments on commit b7a95f7

Please sign in to comment.