TestsCarbonIntervalAddTest

The Simple Calendar Tests CarbonInterval AddTest class.

Defined (1)

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

/vendor/nesbot/carbon/tests/CarbonInterval/AddTest.php  
  1. class AddTest extends AbstractTestCase 
  2. public function testAdd() 
  3. $ci = CarbonInterval::create(4, 3, 6, 7, 8, 10, 11)->add(new DateInterval('P2Y1M5DT22H33M44S')); 
  4. $this->assertCarbonInterval($ci, 6, 4, 54, 30, 43, 55); 
  5.  
  6. public function testAddWithDiffDateInterval() 
  7. $diff = Carbon::now()->diff(Carbon::now()->addWeeks(3)); 
  8. $ci = CarbonInterval::create(4, 3, 6, 7, 8, 10, 11)->add($diff); 
  9. $this->assertCarbonInterval($ci, 4, 3, 70, 8, 10, 11); 
  10.  
  11. public function testAddWithNegativeDiffDateInterval() 
  12. $diff = Carbon::now()->diff(Carbon::now()->subWeeks(3)); 
  13. $ci = CarbonInterval::create(4, 3, 6, 7, 8, 10, 11)->add($diff); 
  14. $this->assertCarbonInterval($ci, 4, 3, 28, 8, 10, 11);