TestsCarbonRelativeTest

The Simple Calendar Tests Carbon RelativeTest class.

Defined (1)

The class is defined in the following location(s).

/vendor/nesbot/carbon/tests/Carbon/RelativeTest.php  
  1. class RelativeTest extends AbstractTestCase 
  2. public function testSecondsSinceMidnight() 
  3. $d = Carbon::today()->addSeconds(30); 
  4. $this->assertSame(30, $d->secondsSinceMidnight()); 
  5.  
  6. $d = Carbon::today()->addDays(1); 
  7. $this->assertSame(0, $d->secondsSinceMidnight()); 
  8.  
  9. $d = Carbon::today()->addDays(1)->addSeconds(120); 
  10. $this->assertSame(120, $d->secondsSinceMidnight()); 
  11.  
  12. $d = Carbon::today()->addMonths(3)->addSeconds(42); 
  13. $this->assertSame(42, $d->secondsSinceMidnight()); 
  14.  
  15. public function testSecondsUntilEndOfDay() 
  16. $d = Carbon::today()->endOfDay(); 
  17. $this->assertSame(0, $d->secondsUntilEndOfDay()); 
  18.  
  19. $d = Carbon::today()->endOfDay()->subSeconds(60); 
  20. $this->assertSame(60, $d->secondsUntilEndOfDay()); 
  21.  
  22. $d = Carbon::create(2014, 10, 24, 12, 34, 56); 
  23. $this->assertSame(41103, $d->secondsUntilEndOfDay()); 
  24.  
  25. $d = Carbon::create(2014, 10, 24, 0, 0, 0); 
  26. $this->assertSame(86399, $d->secondsUntilEndOfDay());