Skip to content

Instantly share code, notes, and snippets.

@stefanledin
Created September 12, 2017 15:58
Show Gist options
  • Select an option

  • Save stefanledin/f76b0a043887450429303555ef0da677 to your computer and use it in GitHub Desktop.

Select an option

Save stefanledin/f76b0a043887450429303555ef0da677 to your computer and use it in GitHub Desktop.
<?php
// (Laravel)
use Tests\TestCase;
use Carbon\Carbon;
class TimeCounterTest extends TestCase
{
public function test_duration()
{
$counter = new TimeCounter();
Carbon::setTestNow(Carbon::create(2017, 09, 12, 17, 45);
$counter->start();
Carbon::setTestNow(Carbon::create(2017, 09, 12, 18, 00);
$counter->stop();
Carbon::setTestNow();
$this->assertEquals($counter->duration(), 15);
}
}
@midnite81
Copy link
Copy Markdown

Hi @stefanledin

Carbon::setTestNow(Carbon::create(2017, 09, 12, 17, 45);
// and 
Carbon::setTestNow(Carbon::create(2017, 09, 12, 18, 00);

are missing closing brackets, should be

Carbon::setTestNow(Carbon::create(2017, 09, 12, 17, 45));
// and 
Carbon::setTestNow(Carbon::create(2017, 09, 12, 18, 00));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment