{"action":"created","comment":{"url":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/comments/23322640","id":23322640,"diff_hunk":"@@ -0,0 +1,223 @@\n+<?php\n+\n+use Laracasts\\TestDummy\\Factory;\n+use SaveMyProposals\\Exceptions\\ValidationException;\n+use SaveMyProposals\\Services\\CreateConferenceForm;\n+\n+class CreateConferenceFormTest extends IntegrationTestCase\n+{\n+    /**\n+     * @test\n+     * @expectedException SaveMyProposals\\Exceptions\\ValidationException\n+     */\n+    public function conference_title_is_required()\n+    {\n+        $input = [\n+            'description' => 'The best conference in the world!',\n+            'url' => 'http://example.com',\n+        ];\n+\n+        $form = CreateConferenceForm::fillOut($input, Factory::create('user'));\n+        $form->complete();\n+    }\n+\n+    /**\n+     * @test\n+     * @expectedException SaveMyProposals\\Exceptions\\ValidationException\n+     */\n+    public function conference_description_is_required()\n+    {\n+        $input = [\n+            'title' => 'AwesomeConf 2015',\n+            'url' => 'http://example.com',\n+        ];\n+\n+        $form = CreateConferenceForm::fillOut($input, Factory::create('user'));\n+        $form->complete();\n+    }\n+\n+    /**\n+     * @test\n+     * @expectedException SaveMyProposals\\Exceptions\\ValidationException\n+     */\n+    public function conference_url_is_required()\n+    {\n+        $input = [\n+            'title' => 'AwesomeConf 2015',\n+            'description' => 'The best conference in the world!',\n+        ];\n+\n+        $form = CreateConferenceForm::fillOut($input, Factory::create('user'));\n+        $form->complete();\n+    }\n+\n+    /**\n+     * @test\n+     * @expectedException SaveMyProposals\\Exceptions\\ValidationException\n+     */\n+    public function conference_start_date_must_be_a_valid_date()\n+    {\n+        $input = [\n+            'title' => 'AwesomeConf 2015',\n+            'description' => 'The best conference in the world!',\n+            'url' => 'http://example.com',\n+            'starts_at' => 'potato',\n+        ];\n+\n+        $form = CreateConferenceForm::fillOut($input, Factory::create('user'));\n+        $form->complete();\n+    }\n+\n+    /**\n+     * @test\n+     * @expectedException SaveMyProposals\\Exceptions\\ValidationException\n+     */\n+    public function conference_end_date_must_be_a_valid_date()\n+    {\n+        $input = [\n+            'title' => 'AwesomeConf 2015',\n+            'description' => 'The best conference in the world!',\n+            'url' => 'http://example.com',\n+            'ends_at' => 'potato',\n+        ];\n+\n+        $form = CreateConferenceForm::fillOut($input, Factory::create('user'));\n+        $form->complete();\n+    }\n+\n+    /**\n+     * @test\n+     * @expectedException SaveMyProposals\\Exceptions\\ValidationException\n+     */\n+    public function conference_cfp_start_date_must_be_a_valid_date()\n+    {\n+        $input = [\n+            'title' => 'AwesomeConf 2015',\n+            'description' => 'The best conference in the world!',\n+            'url' => 'http://example.com',\n+            'cfp_starts_at' => 'potato',\n+        ];\n+\n+        $form = CreateConferenceForm::fillOut($input, Factory::create('user'));\n+        $form->complete();\n+    }\n+\n+    /**\n+     * @test\n+     * @expectedException SaveMyProposals\\Exceptions\\ValidationException\n+     */\n+    public function conference_cfp_end_date_must_be_a_valid_date()\n+    {\n+        $input = [\n+            'title' => 'AwesomeConf 2015',\n+            'description' => 'The best conference in the world!',\n+            'url' => 'http://example.com',\n+            'cfp_ends_at' => 'potato',\n+        ];\n+\n+        $form = CreateConferenceForm::fillOut($input, Factory::create('user'));\n+        $form->complete();\n+    }\n+\n+    /**\n+     * @test\n+     */\n+    public function it_creates_a_conference_with_the_minimum_required_input()\n+    {\n+        $input = [\n+            'title' => 'AwesomeConf 2015',\n+            'description' => 'The best conference in the world!',\n+            'url' => 'http://example.com',\n+        ];\n+\n+        $form = CreateConferenceForm::fillOut($input, Factory::create('user'));\n+        $form->complete();\n+\n+        $conference = Conference::first();\n+        $this->assertEquals('AwesomeConf 2015', $conference->title);\n+        $this->assertEquals('The best conference in the world!', $conference->description);\n+        $this->assertEquals('http://example.com', $conference->url);\n+    }\n+\n+    /**\n+     * @test\n+     */\n+    public function conference_dates_are_saved_if_provided()\n+    {\n+        $input = [\n+            'title' => 'AwesomeConf 2015',\n+            'description' => 'The best conference in the world!',\n+            'url' => 'http://example.com',\n+            'starts_at' => '2015-02-01',\n+            'ends_at' => '2015-02-04',\n+            'cfp_starts_at' => '2015-01-15',\n+            'cfp_ends_at' => '2015-01-18',\n+        ];\n+\n+        $form = CreateConferenceForm::fillOut($input, Factory::create('user'));\n+        $form->complete();\n+\n+        $conference = Conference::first();\n+        $this->assertEquals(new DateTime('2015-02-01'), $conference->starts_at);\n+        $this->assertEquals(new DateTime('2015-02-04'), $conference->ends_at);\n+        $this->assertEquals(new DateTime('2015-01-15'), $conference->cfp_starts_at);\n+        $this->assertEquals(new DateTime('2015-01-18'), $conference->cfp_ends_at);\n+    }\n+\n+    /**\n+     * @test\n+     */\n+    public function empty_dates_are_treated_as_null()","path":"tests/CreateConferenceFormTest.php","position":170,"original_position":170,"commit_id":"387a1787f4c57569d9975a0ed0ffc80cdd5d2bbd","original_commit_id":"387a1787f4c57569d9975a0ed0ffc80cdd5d2bbd","user":{"login":"mattstauffer","id":151829,"avatar_url":"https://avatars.githubusercontent.com/u/151829?v=3","gravatar_id":"","url":"https://api.github.com/users/mattstauffer","html_url":"https://github.com/mattstauffer","followers_url":"https://api.github.com/users/mattstauffer/followers","following_url":"https://api.github.com/users/mattstauffer/following{/other_user}","gists_url":"https://api.github.com/users/mattstauffer/gists{/gist_id}","starred_url":"https://api.github.com/users/mattstauffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattstauffer/subscriptions","organizations_url":"https://api.github.com/users/mattstauffer/orgs","repos_url":"https://api.github.com/users/mattstauffer/repos","events_url":"https://api.github.com/users/mattstauffer/events{/privacy}","received_events_url":"https://api.github.com/users/mattstauffer/received_events","type":"User","site_admin":false},"body":"I think if we can just duplicate this test with one that saves it Non-null, and then re-submits it with null dates, and make sure it overrides the old ones.","created_at":"2015-01-21T18:41:14Z","updated_at":"2015-01-21T18:41:14Z","html_url":"https://github.com/mattstauffer/savemyproposals/pull/40#discussion_r23322640","pull_request_url":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/comments/23322640"},"html":{"href":"https://github.com/mattstauffer/savemyproposals/pull/40#discussion_r23322640"},"pull_request":{"href":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/40","id":27765177,"html_url":"https://github.com/mattstauffer/savemyproposals/pull/40","diff_url":"https://github.com/mattstauffer/savemyproposals/pull/40.diff","patch_url":"https://github.com/mattstauffer/savemyproposals/pull/40.patch","issue_url":"https://api.github.com/repos/mattstauffer/savemyproposals/issues/40","number":40,"state":"open","locked":false,"title":"Introduce CreateConferenceForm form object","user":{"login":"adamwathan","id":4323180,"avatar_url":"https://avatars.githubusercontent.com/u/4323180?v=3","gravatar_id":"","url":"https://api.github.com/users/adamwathan","html_url":"https://github.com/adamwathan","followers_url":"https://api.github.com/users/adamwathan/followers","following_url":"https://api.github.com/users/adamwathan/following{/other_user}","gists_url":"https://api.github.com/users/adamwathan/gists{/gist_id}","starred_url":"https://api.github.com/users/adamwathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamwathan/subscriptions","organizations_url":"https://api.github.com/users/adamwathan/orgs","repos_url":"https://api.github.com/users/adamwathan/repos","events_url":"https://api.github.com/users/adamwathan/events{/privacy}","received_events_url":"https://api.github.com/users/adamwathan/received_events","type":"User","site_admin":false},"body":"Pulled out the logic from the `ConferenceController@store` action into a form object. A little different than going the FormRequest route but I think these sorts of objects are nicer to test and easier to follow. You don't have to know anything about how the framework magically instantiates a certain request object or calls certain validation methods on it, etc.\r\n\r\nFeel free to ignore if you want to use a FormRequest instead, it was fun either way :)","created_at":"2015-01-21T14:57:24Z","updated_at":"2015-01-21T18:41:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f22bb68036eef7cd1c6e3c703c81d8697080e7d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/40/commits","review_comments_url":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/40/comments","review_comment_url":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mattstauffer/savemyproposals/issues/40/comments","statuses_url":"https://api.github.com/repos/mattstauffer/savemyproposals/statuses/387a1787f4c57569d9975a0ed0ffc80cdd5d2bbd","head":{"label":"adamwathan:aw-create-conference-form-object","ref":"aw-create-conference-form-object","sha":"387a1787f4c57569d9975a0ed0ffc80cdd5d2bbd","user":{"login":"adamwathan","id":4323180,"avatar_url":"https://avatars.githubusercontent.com/u/4323180?v=3","gravatar_id":"","url":"https://api.github.com/users/adamwathan","html_url":"https://github.com/adamwathan","followers_url":"https://api.github.com/users/adamwathan/followers","following_url":"https://api.github.com/users/adamwathan/following{/other_user}","gists_url":"https://api.github.com/users/adamwathan/gists{/gist_id}","starred_url":"https://api.github.com/users/adamwathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamwathan/subscriptions","organizations_url":"https://api.github.com/users/adamwathan/orgs","repos_url":"https://api.github.com/users/adamwathan/repos","events_url":"https://api.github.com/users/adamwathan/events{/privacy}","received_events_url":"https://api.github.com/users/adamwathan/received_events","type":"User","site_admin":false},"repo":{"id":29400175,"name":"savemyproposals","full_name":"adamwathan/savemyproposals","owner":{"login":"adamwathan","id":4323180,"avatar_url":"https://avatars.githubusercontent.com/u/4323180?v=3","gravatar_id":"","url":"https://api.github.com/users/adamwathan","html_url":"https://github.com/adamwathan","followers_url":"https://api.github.com/users/adamwathan/followers","following_url":"https://api.github.com/users/adamwathan/following{/other_user}","gists_url":"https://api.github.com/users/adamwathan/gists{/gist_id}","starred_url":"https://api.github.com/users/adamwathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamwathan/subscriptions","organizations_url":"https://api.github.com/users/adamwathan/orgs","repos_url":"https://api.github.com/users/adamwathan/repos","events_url":"https://api.github.com/users/adamwathan/events{/privacy}","received_events_url":"https://api.github.com/users/adamwathan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adamwathan/savemyproposals","description":"Management of proposals, bios, photos, etc. for conference speakers.","fork":true,"url":"https://api.github.com/repos/adamwathan/savemyproposals","forks_url":"https://api.github.com/repos/adamwathan/savemyproposals/forks","keys_url":"https://api.github.com/repos/adamwathan/savemyproposals/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamwathan/savemyproposals/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamwathan/savemyproposals/teams","hooks_url":"https://api.github.com/repos/adamwathan/savemyproposals/hooks","issue_events_url":"https://api.github.com/repos/adamwathan/savemyproposals/issues/events{/number}","events_url":"https://api.github.com/repos/adamwathan/savemyproposals/events","assignees_url":"https://api.github.com/repos/adamwathan/savemyproposals/assignees{/user}","branches_url":"https://api.github.com/repos/adamwathan/savemyproposals/branches{/branch}","tags_url":"https://api.github.com/repos/adamwathan/savemyproposals/tags","blobs_url":"https://api.github.com/repos/adamwathan/savemyproposals/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamwathan/savemyproposals/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamwathan/savemyproposals/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamwathan/savemyproposals/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamwathan/savemyproposals/statuses/{sha}","languages_url":"https://api.github.com/repos/adamwathan/savemyproposals/languages","stargazers_url":"https://api.github.com/repos/adamwathan/savemyproposals/stargazers","contributors_url":"https://api.github.com/repos/adamwathan/savemyproposals/contributors","subscribers_url":"https://api.github.com/repos/adamwathan/savemyproposals/subscribers","subscription_url":"https://api.github.com/repos/adamwathan/savemyproposals/subscription","commits_url":"https://api.github.com/repos/adamwathan/savemyproposals/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamwathan/savemyproposals/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamwathan/savemyproposals/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamwathan/savemyproposals/issues/comments/{number}","contents_url":"https://api.github.com/repos/adamwathan/savemyproposals/contents/{+path}","compare_url":"https://api.github.com/repos/adamwathan/savemyproposals/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamwathan/savemyproposals/merges","archive_url":"https://api.github.com/repos/adamwathan/savemyproposals/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamwathan/savemyproposals/downloads","issues_url":"https://api.github.com/repos/adamwathan/savemyproposals/issues{/number}","pulls_url":"https://api.github.com/repos/adamwathan/savemyproposals/pulls{/number}","milestones_url":"https://api.github.com/repos/adamwathan/savemyproposals/milestones{/number}","notifications_url":"https://api.github.com/repos/adamwathan/savemyproposals/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamwathan/savemyproposals/labels{/name}","releases_url":"https://api.github.com/repos/adamwathan/savemyproposals/releases{/id}","created_at":"2015-01-17T18:00:23Z","updated_at":"2015-01-21T11:55:43Z","pushed_at":"2015-01-21T14:52:13Z","git_url":"git://github.com/adamwathan/savemyproposals.git","ssh_url":"git@github.com:adamwathan/savemyproposals.git","clone_url":"https://github.com/adamwathan/savemyproposals.git","svn_url":"https://github.com/adamwathan/savemyproposals","homepage":"http://savemyproposals.com/","size":2136,"stargazers_count":0,"watchers_count":0,"language":"CSS","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":"master"}},"base":{"label":"mattstauffer:master","ref":"master","sha":"5cfe3fa4be0fda6044a6d8b5604daf84797be28f","user":{"login":"mattstauffer","id":151829,"avatar_url":"https://avatars.githubusercontent.com/u/151829?v=3","gravatar_id":"","url":"https://api.github.com/users/mattstauffer","html_url":"https://github.com/mattstauffer","followers_url":"https://api.github.com/users/mattstauffer/followers","following_url":"https://api.github.com/users/mattstauffer/following{/other_user}","gists_url":"https://api.github.com/users/mattstauffer/gists{/gist_id}","starred_url":"https://api.github.com/users/mattstauffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattstauffer/subscriptions","organizations_url":"https://api.github.com/users/mattstauffer/orgs","repos_url":"https://api.github.com/users/mattstauffer/repos","events_url":"https://api.github.com/users/mattstauffer/events{/privacy}","received_events_url":"https://api.github.com/users/mattstauffer/received_events","type":"User","site_admin":false},"repo":{"id":28258457,"name":"savemyproposals","full_name":"mattstauffer/savemyproposals","owner":{"login":"mattstauffer","id":151829,"avatar_url":"https://avatars.githubusercontent.com/u/151829?v=3","gravatar_id":"","url":"https://api.github.com/users/mattstauffer","html_url":"https://github.com/mattstauffer","followers_url":"https://api.github.com/users/mattstauffer/followers","following_url":"https://api.github.com/users/mattstauffer/following{/other_user}","gists_url":"https://api.github.com/users/mattstauffer/gists{/gist_id}","starred_url":"https://api.github.com/users/mattstauffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattstauffer/subscriptions","organizations_url":"https://api.github.com/users/mattstauffer/orgs","repos_url":"https://api.github.com/users/mattstauffer/repos","events_url":"https://api.github.com/users/mattstauffer/events{/privacy}","received_events_url":"https://api.github.com/users/mattstauffer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mattstauffer/savemyproposals","description":"Management of proposals, bios, photos, etc. for conference speakers.","fork":false,"url":"https://api.github.com/repos/mattstauffer/savemyproposals","forks_url":"https://api.github.com/repos/mattstauffer/savemyproposals/forks","keys_url":"https://api.github.com/repos/mattstauffer/savemyproposals/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattstauffer/savemyproposals/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattstauffer/savemyproposals/teams","hooks_url":"https://api.github.com/repos/mattstauffer/savemyproposals/hooks","issue_events_url":"https://api.github.com/repos/mattstauffer/savemyproposals/issues/events{/number}","events_url":"https://api.github.com/repos/mattstauffer/savemyproposals/events","assignees_url":"https://api.github.com/repos/mattstauffer/savemyproposals/assignees{/user}","branches_url":"https://api.github.com/repos/mattstauffer/savemyproposals/branches{/branch}","tags_url":"https://api.github.com/repos/mattstauffer/savemyproposals/tags","blobs_url":"https://api.github.com/repos/mattstauffer/savemyproposals/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattstauffer/savemyproposals/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattstauffer/savemyproposals/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattstauffer/savemyproposals/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattstauffer/savemyproposals/statuses/{sha}","languages_url":"https://api.github.com/repos/mattstauffer/savemyproposals/languages","stargazers_url":"https://api.github.com/repos/mattstauffer/savemyproposals/stargazers","contributors_url":"https://api.github.com/repos/mattstauffer/savemyproposals/contributors","subscribers_url":"https://api.github.com/repos/mattstauffer/savemyproposals/subscribers","subscription_url":"https://api.github.com/repos/mattstauffer/savemyproposals/subscription","commits_url":"https://api.github.com/repos/mattstauffer/savemyproposals/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattstauffer/savemyproposals/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattstauffer/savemyproposals/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattstauffer/savemyproposals/issues/comments/{number}","contents_url":"https://api.github.com/repos/mattstauffer/savemyproposals/contents/{+path}","compare_url":"https://api.github.com/repos/mattstauffer/savemyproposals/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattstauffer/savemyproposals/merges","archive_url":"https://api.github.com/repos/mattstauffer/savemyproposals/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattstauffer/savemyproposals/downloads","issues_url":"https://api.github.com/repos/mattstauffer/savemyproposals/issues{/number}","pulls_url":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls{/number}","milestones_url":"https://api.github.com/repos/mattstauffer/savemyproposals/milestones{/number}","notifications_url":"https://api.github.com/repos/mattstauffer/savemyproposals/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattstauffer/savemyproposals/labels{/name}","releases_url":"https://api.github.com/repos/mattstauffer/savemyproposals/releases{/id}","created_at":"2014-12-20T05:54:55Z","updated_at":"2015-01-21T03:52:50Z","pushed_at":"2015-01-21T03:52:49Z","git_url":"git://github.com/mattstauffer/savemyproposals.git","ssh_url":"git@github.com:mattstauffer/savemyproposals.git","clone_url":"https://github.com/mattstauffer/savemyproposals.git","svn_url":"https://github.com/mattstauffer/savemyproposals","homepage":"http://savemyproposals.com/","size":2136,"stargazers_count":6,"watchers_count":6,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":21,"forks":4,"open_issues":21,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/40"},"html":{"href":"https://github.com/mattstauffer/savemyproposals/pull/40"},"issue":{"href":"https://api.github.com/repos/mattstauffer/savemyproposals/issues/40"},"comments":{"href":"https://api.github.com/repos/mattstauffer/savemyproposals/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mattstauffer/savemyproposals/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/mattstauffer/savemyproposals/statuses/387a1787f4c57569d9975a0ed0ffc80cdd5d2bbd"}}}}