TestsCarbonCreateFromFormatTest

The Simple Calendar Tests Carbon CreateFromFormatTest class.

Defined (1)

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

/vendor/nesbot/carbon/tests/Carbon/CreateFromFormatTest.php  
  1. class CreateFromFormatTest extends AbstractTestCase 
  2. public function testCreateFromFormatReturnsCarbon() 
  3. $d = Carbon::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11'); 
  4. $this->assertCarbon($d, 1975, 5, 21, 22, 32, 11); 
  5. $this->assertTrue($d instanceof Carbon); 
  6.  
  7. public function testCreateFromFormatWithTimezoneString() 
  8. $d = Carbon::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11', 'Europe/London'); 
  9. $this->assertCarbon($d, 1975, 5, 21, 22, 32, 11); 
  10. $this->assertSame('Europe/London', $d->tzName); 
  11.  
  12. public function testCreateFromFormatWithTimezone() 
  13. $d = Carbon::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11', new \DateTimeZone('Europe/London')); 
  14. $this->assertCarbon($d, 1975, 5, 21, 22, 32, 11); 
  15. $this->assertSame('Europe/London', $d->tzName); 
  16.  
  17. public function testCreateFromFormatWithMillis() 
  18. $d = Carbon::createFromFormat('Y-m-d H:i:s.u', '1975-05-21 22:32:11.254687'); 
  19. $this->assertSame(254687, $d->micro);