{"action":"created","comment":{"url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/comments/32216692","id":32216692,"diff_hunk":"@@ -0,0 +1,102 @@\n+<?php\n+/**\n+ * Part of Windwalker project. \n+ *\n+ * @copyright  Copyright (C) 2011 - 2014 SMS Taiwan, Inc. All rights reserved.\n+ * @license    GNU General Public License version 2 or later; see LICENSE\n+ */\n+\n+namespace Windwalker\\Test\\Helper;\n+\n+use Windwalker\\Helper\\DateHelper;\n+\n+/**\n+ * Class DateHelperTest\n+ *\n+ * @since 1.0\n+ */\n+class DateHelperTest extends \\PHPUnit_Framework_TestCase\n+{\n+\t/**\n+\t * Method of test testFormat().\n+\t *\n+\t * @return  void\n+\t *\n+\t * @covers \\Windwalker\\Helper\\DateHelper::getDate\n+\t */\n+\tpublic function testFormat()\n+\t{\n+\t\t$targetDate = '2015-06-01';\n+\n+\t\t$getDateObject = DateHelper::getDate($targetDate, 'UTC');\n+\n+\t\t$getDateFormat = $getDateObject->format('Y-m-d');\n+\n+\t\t$this->assertInternalType('string', $getDateFormat);\n+\n+\t\t$this->assertEquals($targetDate, $getDateFormat);\n+\t}\n+\n+\t/**\n+\t * Method of test testFormatForNow()\n+\t *\n+\t * @return  void\n+\t *\n+\t * @covers \\Windwalker\\Helper\\DateHelper::getDate\n+\t */\n+\tpublic function testFormatForNow()\n+\t{\n+\t\t$format = 'Y-m-d';\n+\n+\t\t$getDateNowObject = DateHelper::getDate('now');\n+\n+\t\t$getDateNowFormat = $getDateNowObject->format($format);\n+\n+\t\t$this->assertInternalType('string', $getDateNowFormat);\n+\n+\t\t$phpDate = date($format);\n+\n+\t\t$this->assertInternalType('string', $phpDate);\n+\n+\t\t$this->assertEquals($getDateNowFormat, $phpDate);\n+\t}\n+\n+\t/**\n+\t * Method of test testTimezone()\n+\t *\n+\t * @return  void\n+\t *\n+\t * @dataProvider timeZonesProvider\n+\t *\n+\t * @covers \\Windwalker\\Helper\\DateHelper::getDate\n+\t */\n+\tpublic function testTimezone($timezone)\n+\t{\n+\t\t$inputDateTime = '2015-01-01 08:00:00';\n+\n+\t\t$targetZone = new \\DateTimeZone($timezone);\n+\t\t$targetDatetime = new \\DateTime($inputDateTime, $targetZone);\n+\t\t$targetOffsetHour = $targetDatetime->format('Z')/3600;\n+\n+\t\t$getDate = DateHelper::getDate($inputDateTime, $timezone)->getOffset();\n+\t\t$getDateOffsetHour = $getDate/3600;\n+\n+\t\t$this->assertEquals($targetOffsetHour, $getDateOffsetHour);\n+\t}\n+\n+\t/**\n+\t * timeZonesProvider\n+\t *\n+\t * @return  array\n+\t */\n+\tpublic function timeZonesProvider()\n+\t{\n+\t\treturn array(\n+\t\t\tarray('Asia/Taipei'),\n+\t\t\tarray('Asia/Tokyo'),\n+\t\t\tarray('US/Hawaii'),\n+\t\t\tarray('America/Mexico_City'),\n+\t\t\tarray('Australia/Sydney'),","path":"test/Helper/DateHelperTest.php","position":99,"original_position":99,"commit_id":"a59c8f22a0bd224b2a78263ed3153d2c50a4427c","original_commit_id":"a59c8f22a0bd224b2a78263ed3153d2c50a4427c","user":{"login":"asika32764","id":1639206,"avatar_url":"https://avatars.githubusercontent.com/u/1639206?v=3","gravatar_id":"","url":"https://api.github.com/users/asika32764","html_url":"https://github.com/asika32764","followers_url":"https://api.github.com/users/asika32764/followers","following_url":"https://api.github.com/users/asika32764/following{/other_user}","gists_url":"https://api.github.com/users/asika32764/gists{/gist_id}","starred_url":"https://api.github.com/users/asika32764/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asika32764/subscriptions","organizations_url":"https://api.github.com/users/asika32764/orgs","repos_url":"https://api.github.com/users/asika32764/repos","events_url":"https://api.github.com/users/asika32764/events{/privacy}","received_events_url":"https://api.github.com/users/asika32764/received_events","type":"User","site_admin":false},"body":"我建議這樣測試，把驗證用的時間寫在第二個參數\r\n\r\n``` php\r\narray('UTC', '2015-03-02 00:00:00'),\r\narray('Asia/Taipei', '2015-03-02 08:00:00'),\r\n// ...\r\n```","created_at":"2015-06-11T12:51:48Z","updated_at":"2015-06-11T12:51:48Z","html_url":"https://github.com/smstw/windwalker-joomla-rad/pull/32#discussion_r32216692","pull_request_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/comments/32216692"},"html":{"href":"https://github.com/smstw/windwalker-joomla-rad/pull/32#discussion_r32216692"},"pull_request":{"href":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/32","id":31986965,"html_url":"https://github.com/smstw/windwalker-joomla-rad/pull/32","diff_url":"https://github.com/smstw/windwalker-joomla-rad/pull/32.diff","patch_url":"https://github.com/smstw/windwalker-joomla-rad/pull/32.patch","issue_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/issues/32","number":32,"state":"open","locked":false,"title":"[Update #26] add a test for date helper","user":{"login":"michael520","id":865770,"avatar_url":"https://avatars.githubusercontent.com/u/865770?v=3","gravatar_id":"","url":"https://api.github.com/users/michael520","html_url":"https://github.com/michael520","followers_url":"https://api.github.com/users/michael520/followers","following_url":"https://api.github.com/users/michael520/following{/other_user}","gists_url":"https://api.github.com/users/michael520/gists{/gist_id}","starred_url":"https://api.github.com/users/michael520/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael520/subscriptions","organizations_url":"https://api.github.com/users/michael520/orgs","repos_url":"https://api.github.com/users/michael520/repos","events_url":"https://api.github.com/users/michael520/events{/privacy}","received_events_url":"https://api.github.com/users/michael520/received_events","type":"User","site_admin":false},"body":"for issue  #26","created_at":"2015-03-26T03:35:07Z","updated_at":"2015-06-11T12:51:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00dbd37a764ff3e124eeafafe2eb39e5e47a0dcd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/32/commits","review_comments_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/32/comments","review_comment_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/comments{/number}","comments_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/issues/32/comments","statuses_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/statuses/a59c8f22a0bd224b2a78263ed3153d2c50a4427c","head":{"label":"michael520:dev-test","ref":"dev-test","sha":"a59c8f22a0bd224b2a78263ed3153d2c50a4427c","user":{"login":"michael520","id":865770,"avatar_url":"https://avatars.githubusercontent.com/u/865770?v=3","gravatar_id":"","url":"https://api.github.com/users/michael520","html_url":"https://github.com/michael520","followers_url":"https://api.github.com/users/michael520/followers","following_url":"https://api.github.com/users/michael520/following{/other_user}","gists_url":"https://api.github.com/users/michael520/gists{/gist_id}","starred_url":"https://api.github.com/users/michael520/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael520/subscriptions","organizations_url":"https://api.github.com/users/michael520/orgs","repos_url":"https://api.github.com/users/michael520/repos","events_url":"https://api.github.com/users/michael520/events{/privacy}","received_events_url":"https://api.github.com/users/michael520/received_events","type":"User","site_admin":false},"repo":{"id":32775396,"name":"windwalker-joomla-rad","full_name":"michael520/windwalker-joomla-rad","owner":{"login":"michael520","id":865770,"avatar_url":"https://avatars.githubusercontent.com/u/865770?v=3","gravatar_id":"","url":"https://api.github.com/users/michael520","html_url":"https://github.com/michael520","followers_url":"https://api.github.com/users/michael520/followers","following_url":"https://api.github.com/users/michael520/following{/other_user}","gists_url":"https://api.github.com/users/michael520/gists{/gist_id}","starred_url":"https://api.github.com/users/michael520/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael520/subscriptions","organizations_url":"https://api.github.com/users/michael520/orgs","repos_url":"https://api.github.com/users/michael520/repos","events_url":"https://api.github.com/users/michael520/events{/privacy}","received_events_url":"https://api.github.com/users/michael520/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michael520/windwalker-joomla-rad","description":"Windwalker RAD framework for Joomla CMS","fork":true,"url":"https://api.github.com/repos/michael520/windwalker-joomla-rad","forks_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/forks","keys_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/teams","hooks_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/hooks","issue_events_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/issues/events{/number}","events_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/events","assignees_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/assignees{/user}","branches_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/branches{/branch}","tags_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/tags","blobs_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/git/refs{/sha}","trees_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/statuses/{sha}","languages_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/languages","stargazers_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/stargazers","contributors_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/contributors","subscribers_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/subscribers","subscription_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/subscription","commits_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/commits{/sha}","git_commits_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/git/commits{/sha}","comments_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/comments{/number}","issue_comment_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/issues/comments{/number}","contents_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/contents/{+path}","compare_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/merges","archive_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/downloads","issues_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/issues{/number}","pulls_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/pulls{/number}","milestones_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/milestones{/number}","notifications_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/labels{/name}","releases_url":"https://api.github.com/repos/michael520/windwalker-joomla-rad/releases{/id}","created_at":"2015-03-24T04:07:15Z","updated_at":"2015-03-24T04:07:19Z","pushed_at":"2015-06-08T09:19:35Z","git_url":"git://github.com/michael520/windwalker-joomla-rad.git","ssh_url":"git@github.com:michael520/windwalker-joomla-rad.git","clone_url":"https://github.com/michael520/windwalker-joomla-rad.git","svn_url":"https://github.com/michael520/windwalker-joomla-rad","homepage":"http://ventoviro.github.io/windwalker-rad-doc/","size":2439,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev-2.1"}},"base":{"label":"smstw:dev-2.1","ref":"dev-2.1","sha":"9462e8aaf474a12988f8a6c287e5c6851aae4f3a","user":{"login":"smstw","id":5608018,"avatar_url":"https://avatars.githubusercontent.com/u/5608018?v=3","gravatar_id":"","url":"https://api.github.com/users/smstw","html_url":"https://github.com/smstw","followers_url":"https://api.github.com/users/smstw/followers","following_url":"https://api.github.com/users/smstw/following{/other_user}","gists_url":"https://api.github.com/users/smstw/gists{/gist_id}","starred_url":"https://api.github.com/users/smstw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smstw/subscriptions","organizations_url":"https://api.github.com/users/smstw/orgs","repos_url":"https://api.github.com/users/smstw/repos","events_url":"https://api.github.com/users/smstw/events{/privacy}","received_events_url":"https://api.github.com/users/smstw/received_events","type":"Organization","site_admin":false},"repo":{"id":24495433,"name":"windwalker-joomla-rad","full_name":"smstw/windwalker-joomla-rad","owner":{"login":"smstw","id":5608018,"avatar_url":"https://avatars.githubusercontent.com/u/5608018?v=3","gravatar_id":"","url":"https://api.github.com/users/smstw","html_url":"https://github.com/smstw","followers_url":"https://api.github.com/users/smstw/followers","following_url":"https://api.github.com/users/smstw/following{/other_user}","gists_url":"https://api.github.com/users/smstw/gists{/gist_id}","starred_url":"https://api.github.com/users/smstw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smstw/subscriptions","organizations_url":"https://api.github.com/users/smstw/orgs","repos_url":"https://api.github.com/users/smstw/repos","events_url":"https://api.github.com/users/smstw/events{/privacy}","received_events_url":"https://api.github.com/users/smstw/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/smstw/windwalker-joomla-rad","description":"Windwalker RAD framework for Joomla CMS","fork":true,"url":"https://api.github.com/repos/smstw/windwalker-joomla-rad","forks_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/forks","keys_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/teams","hooks_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/hooks","issue_events_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/issues/events{/number}","events_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/events","assignees_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/assignees{/user}","branches_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/branches{/branch}","tags_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/tags","blobs_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/git/refs{/sha}","trees_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/statuses/{sha}","languages_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/languages","stargazers_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/stargazers","contributors_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/contributors","subscribers_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/subscribers","subscription_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/subscription","commits_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/commits{/sha}","git_commits_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/git/commits{/sha}","comments_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/comments{/number}","issue_comment_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/issues/comments{/number}","contents_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/contents/{+path}","compare_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/merges","archive_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/downloads","issues_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/issues{/number}","pulls_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls{/number}","milestones_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/milestones{/number}","notifications_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/labels{/name}","releases_url":"https://api.github.com/repos/smstw/windwalker-joomla-rad/releases{/id}","created_at":"2014-09-26T10:20:58Z","updated_at":"2015-04-07T02:33:26Z","pushed_at":"2015-06-11T03:13:17Z","git_url":"git://github.com/smstw/windwalker-joomla-rad.git","ssh_url":"git@github.com:smstw/windwalker-joomla-rad.git","clone_url":"https://github.com/smstw/windwalker-joomla-rad.git","svn_url":"https://github.com/smstw/windwalker-joomla-rad","homepage":"http://ventoviro.github.io/windwalker-rad-doc/","size":2854,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":25,"forks":3,"open_issues":25,"watchers":0,"default_branch":"dev-2.1"}},"_links":{"self":{"href":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/32"},"html":{"href":"https://github.com/smstw/windwalker-joomla-rad/pull/32"},"issue":{"href":"https://api.github.com/repos/smstw/windwalker-joomla-rad/issues/32"},"comments":{"href":"https://api.github.com/repos/smstw/windwalker-joomla-rad/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/smstw/windwalker-joomla-rad/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/smstw/windwalker-joomla-rad/statuses/a59c8f22a0bd224b2a78263ed3153d2c50a4427c"}}}}