-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] Adds an ability for the Wormhole class to take us back to the p…
…resent. (#35261) * Adds an ability for the Wormhole to take us back to the present. * Fixes styling.
- Loading branch information
Showing
3 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Foundation\Testing; | ||
|
||
use Illuminate\Foundation\Testing\Wormhole; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class WormholeTest extends TestCase | ||
{ | ||
public function testCanTravelBackToPresent() | ||
{ | ||
// Preserve the timelines we want to compare the reality with.. | ||
$present = now(); | ||
$future = now()->addDays(10); | ||
|
||
// Travel in time.. | ||
(new Wormhole(10))->days(); | ||
|
||
// Assert we are now in the future.. | ||
$this->assertEquals($future->format('Y-m-d'), now()->format('Y-m-d')); | ||
|
||
// Assert we can go back to the present.. | ||
$this->assertEquals($present->format('Y-m-d'), Wormhole::back()->format('Y-m-d')); | ||
} | ||
} |