SetDateAndTimeFromTest.php 1015 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of the Carbon package.
  5. *
  6. * (c) Brian Nesbitt <brian@nesbot.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Tests\CarbonImmutable;
  12. use Carbon\CarbonImmutable as Carbon;
  13. use Tests\AbstractTestCase;
  14. class SetDateAndTimeFromTest extends AbstractTestCase
  15. {
  16. public function testSetDateFrom()
  17. {
  18. $this->assertCarbon(
  19. Carbon::create(2001, 1, 1, 1, 1, 1)
  20. ->setDateFrom(Carbon::create(2002, 2, 2, 2, 2, 2)),
  21. 2002,
  22. 2,
  23. 2,
  24. 1,
  25. 1,
  26. 1
  27. );
  28. }
  29. public function testSetTimeFrom()
  30. {
  31. $this->assertCarbon(
  32. Carbon::create(2001, 1, 1, 1, 1, 1)
  33. ->setTimeFrom(Carbon::create(2002, 2, 2, 2, 2, 2)),
  34. 2001,
  35. 1,
  36. 1,
  37. 2,
  38. 2,
  39. 2
  40. );
  41. }
  42. }