TestsCarbonCreateFromTimeTest

The Simple Calendar Tests Carbon CreateFromTimeTest class.

Defined (1)

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

/vendor/nesbot/carbon/tests/Carbon/CreateFromTimeTest.php  
  1. class CreateFromTimeTest extends AbstractTestCase 
  2. public function testCreateFromDateWithDefaults() 
  3. $d = Carbon::createFromTime(); 
  4. $this->assertSame($d->timestamp, Carbon::create(null, null, null, null, null, null)->timestamp); 
  5.  
  6. public function testCreateFromDate() 
  7. $d = Carbon::createFromTime(23, 5, 21); 
  8. $this->assertCarbon($d, Carbon::now()->year, Carbon::now()->month, Carbon::now()->day, 23, 5, 21); 
  9.  
  10. public function testCreateFromTimeWithHour() 
  11. $d = Carbon::createFromTime(22); 
  12. $this->assertSame(22, $d->hour); 
  13. $this->assertSame(0, $d->minute); 
  14. $this->assertSame(0, $d->second); 
  15.  
  16. public function testCreateFromTimeWithMinute() 
  17. $d = Carbon::createFromTime(null, 5); 
  18. $this->assertSame(5, $d->minute); 
  19.  
  20. public function testCreateFromTimeWithSecond() 
  21. $d = Carbon::createFromTime(null, null, 21); 
  22. $this->assertSame(21, $d->second); 
  23.  
  24. public function testCreateFromTimeWithDateTimeZone() 
  25. $d = Carbon::createFromTime(12, 0, 0, new \DateTimeZone('Europe/London')); 
  26. $this->assertCarbon($d, Carbon::now()->year, Carbon::now()->month, Carbon::now()->day, 12, 0, 0); 
  27. $this->assertSame('Europe/London', $d->tzName); 
  28.  
  29. public function testCreateFromTimeWithTimeZoneString() 
  30. $d = Carbon::createFromTime(12, 0, 0, 'Europe/London'); 
  31. $this->assertCarbon($d, Carbon::now()->year, Carbon::now()->month, Carbon::now()->day, 12, 0, 0); 
  32. $this->assertSame('Europe/London', $d->tzName);