No Description

IssetTest.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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(
  20. 'year',
  21. 'month',
  22. 'day',
  23. 'hour',
  24. 'minute',
  25. 'second',
  26. 'dayOfWeek',
  27. 'dayOfYear',
  28. 'daysInMonth',
  29. 'timestamp',
  30. 'age',
  31. 'quarter',
  32. 'dst',
  33. 'offset',
  34. 'offsetHours',
  35. 'timezone',
  36. 'timezoneName',
  37. 'tz',
  38. 'tzName'
  39. );
  40. foreach ($properties as $property) {
  41. $this->assertTrue(isset(Carbon::create(1234, 5, 6, 7, 8, 9)->$property));
  42. }
  43. }
  44. }