IssetTest.php 884 B

123456789101112131415161718192021222324252627
  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 IssetTest extends TestFixture
  12. {
  13. public function testIssetReturnFalseForUnknownProperty()
  14. {
  15. $this->assertFalse(isset(Carbon::create(1234, 5, 6, 7, 8, 9)->sdfsdfss));
  16. }
  17. public function testIssetReturnTrueForProperties()
  18. {
  19. $properties = array('year', 'month', 'day', 'hour', 'minute', 'second', 'dayOfWeek', 'dayOfYear', 'daysInMonth', 'timestamp', 'age', 'quarter', 'dst', 'offset', 'offsetHours', 'timezone', 'timezoneName', 'tz', 'tzName');
  20. foreach ($properties as $property) {
  21. $this->assertTrue(isset(Carbon::create(1234, 5, 6, 7, 8, 9)->$property));
  22. }
  23. }
  24. }