CloneTest.php 988 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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\CarbonInterval;
  12. use Carbon\CarbonInterval;
  13. use Tests\AbstractTestCase;
  14. class CloneTest extends AbstractTestCase
  15. {
  16. public function testClone()
  17. {
  18. $first = CarbonInterval::minute();
  19. $second = $first->clone();
  20. $result = $first->compare($second);
  21. $this->assertSame(0, $result);
  22. $this->assertNotSame($second, $first);
  23. $this->assertEquals($second, $first);
  24. }
  25. public function testCopy()
  26. {
  27. $first = CarbonInterval::minute();
  28. $second = $first->copy();
  29. $result = $first->compare($second);
  30. $this->assertSame(0, $result);
  31. $this->assertNotSame($second, $first);
  32. $this->assertEquals($second, $first);
  33. }
  34. }