CloneTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\CarbonPeriod;
  12. use Tests\AbstractTestCase;
  13. class CloneTest extends AbstractTestCase
  14. {
  15. public function testClone()
  16. {
  17. $periodClass = $this->periodClass;
  18. $period = $periodClass::create('R4/2012-07-01T00:00:00/P7D');
  19. $clone = $period->clone();
  20. $this->assertSame((string) $period, (string) $clone);
  21. $this->assertNotSame($period, $clone);
  22. $this->assertEquals($period, $clone);
  23. }
  24. public function testCopy()
  25. {
  26. $periodClass = $this->periodClass;
  27. $period = $periodClass::create('R4/2012-07-01T00:00:00/P7D');
  28. $clone = $period->copy();
  29. $this->assertSame((string) $period, (string) $clone);
  30. $this->assertNotSame($period, $clone);
  31. $this->assertEquals($period, $clone);
  32. }
  33. }