PHP code example of rachidlaasri / travel

1. Go to this page and download the library: Download rachidlaasri/travel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rachidlaasri / travel example snippets


public function testBasicTest()
{
    Travel::to('01-01-2009');

    // Date is now 01-01-2009
    // code goes here...
}

public function testBasicTest()
{
    // Verify that the user cannot update a post after 10 minutes of its creation time.
    $post = factory(App\Post::class)->create();

    Travel::to('10 minutes', function() use ($post) {
        $this->postJson(route('posts.edit', $post->id), [])
            ->assertStatus(403);
    });
}

public function testBasicTest()
{
    // Travel to multiple dates:
    Travel::each(['01-01-2009', '04-02-2009', '03-02-2006'], function() {
        // Do something.
    });
}

Travel::back();