CopyTest.php 723 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /*
  3. * This file is part of the Carbon package.
  4. *
  5. * (c) Brian Nesbitt <brian@nesbot.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Carbon\Carbon;
  11. class CopyTest extends TestFixture
  12. {
  13. public function testCopy()
  14. {
  15. $dating = Carbon::now();
  16. $dating2 = $dating->copy();
  17. $this->assertNotSame($dating, $dating2);
  18. }
  19. public function testCopyEnsureTzIsCopied()
  20. {
  21. $dating = Carbon::createFromDate(2000, 1, 1, 'Europe/London');
  22. $dating2 = $dating->copy();
  23. $this->assertSame($dating->tzName, $dating2->tzName);
  24. $this->assertSame($dating->offset, $dating2->offset);
  25. }
  26. }